-- cgit v1.2.1 From 6fbff3ab06b04fadc29f8dce5feb5ad98556ea14 Mon Sep 17 00:00:00 2001 From: Sho Amano Date: Thu, 15 Apr 2021 04:58:57 +0900 Subject: fix: reduce logs during streaming (#1778) * Reduce some logs to TRACE level Each time SDL Core receives a video packet from mobile, it generates a large amount of logs. Instead of completely removing them, this commit decreases their levels to TRACE. Head unit systems with video streaming feature can set log output level to DEBUG (or higher) to get rid of the logs. Co-authored-by: Jacob Keeler --- .../application_manager/src/application_state.cc | 2 +- .../src/connection_handler_impl.cc | 4 ++-- .../media_manager/src/file_streamer_adapter.cc | 2 +- .../media_manager/src/pipe_streamer_adapter.cc | 2 +- .../media_manager/src/socket_streamer_adapter.cc | 2 +- src/components/media_manager/src/streamer_adapter.cc | 2 +- .../protocol_handler/src/incoming_data_handler.cc | 18 +++++++++--------- .../protocol_handler/src/multiframe_builder.cc | 20 ++++++++++---------- .../protocol_handler/src/protocol_handler_impl.cc | 16 ++++++++-------- .../protocol_handler/src/protocol_packet.cc | 4 ++-- .../transport_adapter/threaded_socket_connection.cc | 6 +++--- .../transport_manager/src/transport_manager_impl.cc | 12 ++++++------ 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc index 1ec4abaed7..adaefd2e95 100644 --- a/src/components/application_manager/src/application_state.cc +++ b/src/components/application_manager/src/application_state.cc @@ -127,7 +127,7 @@ HmiStatePtr ApplicationState::GetState(const WindowID window_id, SDL_LOG_DEBUG("Getting postponed state for window " << window_id); return PostponedHmiState(window_id); default: - SDL_LOG_DEBUG("Getting current state for window " << window_id); + SDL_LOG_TRACE("Getting current state for window " << window_id); return CurrentHmiState(window_id); } } diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index cb7fc31575..c2c70ccae8 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -1002,7 +1002,7 @@ uint32_t ConnectionHandlerImpl::KeyFromPair( transport_manager::ConnectionUID connection_handle, uint8_t session_id) const { const uint32_t key = connection_handle | (session_id << 16); - SDL_LOG_DEBUG("Key for ConnectionHandle:" + SDL_LOG_TRACE("Key for ConnectionHandle:" << static_cast(connection_handle) << " Session:" << static_cast(session_id) << " is: 0x" << std::hex << static_cast(key)); @@ -1020,7 +1020,7 @@ void ConnectionHandlerImpl::PairFromKey( uint8_t* session_id) const { *connection_handle = key & 0xFF00FFFF; *session_id = key >> 16; - SDL_LOG_DEBUG("ConnectionHandle: " + SDL_LOG_TRACE("ConnectionHandle: " << static_cast(*connection_handle) << " Session: " << static_cast(*session_id) << " for key: " << static_cast(key)); diff --git a/src/components/media_manager/src/file_streamer_adapter.cc b/src/components/media_manager/src/file_streamer_adapter.cc index 301b093829..f17d1f89ed 100644 --- a/src/components/media_manager/src/file_streamer_adapter.cc +++ b/src/components/media_manager/src/file_streamer_adapter.cc @@ -95,7 +95,7 @@ bool FileStreamerAdapter::FileStreamer::Send( return false; } - SDL_LOG_INFO("Streamer::sent " << msg->data_size()); + SDL_LOG_TRACE("Streamer::sent " << msg->data_size()); return true; } diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc index 5e4c87c73d..b4e66be483 100644 --- a/src/components/media_manager/src/pipe_streamer_adapter.cc +++ b/src/components/media_manager/src/pipe_streamer_adapter.cc @@ -144,7 +144,7 @@ bool PipeStreamerAdapter::PipeStreamer::Send( // Loop to send remaining data if there is any. } while (data_remaining); - SDL_LOG_INFO("Streamer::sent " << msg->data_size()); + SDL_LOG_TRACE("Streamer::sent " << msg->data_size()); return true; } diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc index 2f10a29c7d..134ccb8038 100644 --- a/src/components/media_manager/src/socket_streamer_adapter.cc +++ b/src/components/media_manager/src/socket_streamer_adapter.cc @@ -149,7 +149,7 @@ bool SocketStreamerAdapter::SocketStreamer::Send( SDL_LOG_WARN("Couldn't send all the data to socket " << send_socket_fd_); } - SDL_LOG_INFO("Streamer::sent " << msg->data_size()); + SDL_LOG_TRACE("Streamer::sent " << msg->data_size()); return true; } diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc index 808b9715af..ad61ac1f63 100644 --- a/src/components/media_manager/src/streamer_adapter.cc +++ b/src/components/media_manager/src/streamer_adapter.cc @@ -150,7 +150,7 @@ void StreamerAdapter::Streamer::threadMain() { static int32_t messages_for_session = 0; ++messages_for_session; - SDL_LOG_DEBUG("Handling map streaming message. This is " + SDL_LOG_TRACE("Handling map streaming message. This is " << messages_for_session << " message for " << adapter_->current_application_); std::set::iterator it = diff --git a/src/components/protocol_handler/src/incoming_data_handler.cc b/src/components/protocol_handler/src/incoming_data_handler.cc index 08997acaac..c7a3f095a8 100644 --- a/src/components/protocol_handler/src/incoming_data_handler.cc +++ b/src/components/protocol_handler/src/incoming_data_handler.cc @@ -63,8 +63,8 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData( out_result = RESULT_FAIL; return ProtocolFramePtrList(); } - SDL_LOG_INFO("Processing incoming data of size " - << tm_message_size << " for connection " << connection_id); + SDL_LOG_TRACE("Processing incoming data of size " + << tm_message_size << " for connection " << connection_id); ConnectionsDataMap::iterator it = connections_data_.find(connection_id); if (connections_data_.end() == it) { SDL_LOG_WARN("ProcessData requested for unknown connection"); @@ -73,16 +73,16 @@ ProtocolFramePtrList IncomingDataHandler::ProcessData( } std::vector& connection_data = it->second; connection_data.insert(connection_data.end(), data, data + tm_message_size); - SDL_LOG_DEBUG("Total data size for connection " << connection_id << " is " + SDL_LOG_TRACE("Total data size for connection " << connection_id << " is " << connection_data.size()); ProtocolFramePtrList out_frames; *malformed_occurrence = 0; out_result = CreateFrame( connection_data, out_frames, *malformed_occurrence, connection_id); - SDL_LOG_DEBUG("New data size for connection " << connection_id << " is " + SDL_LOG_TRACE("New data size for connection " << connection_id << " is " << connection_data.size()); if (!out_frames.empty()) { - SDL_LOG_INFO("Created and passed " << out_frames.size() << " packets"); + SDL_LOG_TRACE("Created and passed " << out_frames.size() << " packets"); } else { if (RESULT_DEFERRED == out_result) { SDL_LOG_DEBUG( @@ -156,7 +156,7 @@ RESULT_CODE IncomingDataHandler::CreateFrame( << std::hex << static_cast(&*data_it)); continue; } - SDL_LOG_DEBUG("Payload size " << header_.dataSize); + SDL_LOG_TRACE("Payload size " << header_.dataSize); const uint32_t packet_size = GetPacketSize(header_); if (packet_size == 0) { SDL_LOG_WARN("Null packet size"); @@ -167,14 +167,14 @@ RESULT_CODE IncomingDataHandler::CreateFrame( continue; } if (data_size < packet_size) { - SDL_LOG_DEBUG("Packet data is not available yet"); + SDL_LOG_TRACE("Packet data is not available yet"); incoming_data.erase(incoming_data.begin(), data_it); return RESULT_DEFERRED; } ProtocolFramePtr frame(new protocol_handler::ProtocolPacket(connection_id)); const RESULT_CODE deserialize_result = frame->deserializePacket(&*data_it, packet_size); - SDL_LOG_DEBUG("Deserialized frame " << frame); + SDL_LOG_TRACE("Deserialized frame " << frame); if (deserialize_result != RESULT_OK) { SDL_LOG_WARN("Packet deserialization failed"); incoming_data.erase(incoming_data.begin(), data_it); @@ -183,7 +183,7 @@ RESULT_CODE IncomingDataHandler::CreateFrame( out_frames.push_back(frame); last_portion_of_data_was_malformed_ = false; - SDL_LOG_DEBUG("Frame added. " + SDL_LOG_TRACE("Frame added. " << "Connection ID " << connection_id); data_it += packet_size; diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc index 0cffe724c7..875b5b5933 100644 --- a/src/components/protocol_handler/src/multiframe_builder.cc +++ b/src/components/protocol_handler/src/multiframe_builder.cc @@ -91,8 +91,8 @@ bool MultiFrameBuilder::RemoveConnection(const ConnectionID connection_id) { ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() { SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(multiframes_map_lock_); - SDL_LOG_DEBUG("Current state is: " << multiframes_map_); - SDL_LOG_DEBUG("Current multiframe map size is: " << multiframes_map_.size()); + SDL_LOG_TRACE("Current state is: " << multiframes_map_); + SDL_LOG_TRACE("Current multiframe map size is: " << multiframes_map_.size()); ProtocolFramePtrList outpute_frame_list; for (MultiFrameMap::iterator connection_it = multiframes_map_.begin(); connection_it != multiframes_map_.end(); @@ -115,7 +115,7 @@ ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() { if (frame && frame->frame_data() == FRAME_DATA_LAST_CONSECUTIVE && frame->payload_size() > 0u) { - SDL_LOG_DEBUG("Ready frame: " << frame); + SDL_LOG_TRACE("Ready frame: " << frame); outpute_frame_list.push_back(frame); messageId_map.erase(messageId_it++); continue; @@ -136,7 +136,7 @@ ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() { } // iteration over messageId_map } // iteration over session_map } // iteration over multiframes_map_ - SDL_LOG_DEBUG("Result frames count: " << outpute_frame_list.size()); + SDL_LOG_TRACE("Result frames count: " << outpute_frame_list.size()); return outpute_frame_list; } @@ -164,8 +164,8 @@ RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) { RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_FIRST, RESULT_FAIL); sync_primitives::AutoLock lock(multiframes_map_lock_); - SDL_LOG_DEBUG("Waiting : " << multiframes_map_); - SDL_LOG_DEBUG("Handling FIRST frame: " << packet); + SDL_LOG_TRACE("Waiting : " << multiframes_map_); + SDL_LOG_TRACE("Handling FIRST frame: " << packet); if (packet->payload_size() != 0u) { SDL_LOG_ERROR("First frame shall have no data:" << packet); return RESULT_FAIL; @@ -193,7 +193,7 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { return RESULT_FAIL; } - SDL_LOG_DEBUG("Start waiting frames for connection_id: " + SDL_LOG_TRACE("Start waiting frames for connection_id: " << connection_id << ", session_id: " << static_cast(session_id) << ", message_id: " << message_id); @@ -240,7 +240,7 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( if (is_last_consecutive) { // TODO(EZamakhov): implement count of frames and result size verification - SDL_LOG_DEBUG("Last CONSECUTIVE frame"); + SDL_LOG_TRACE("Last CONSECUTIVE frame"); } else { uint8_t previous_frame_data = assembling_frame->frame_data(); if (previous_frame_data == std::numeric_limits::max()) { @@ -275,8 +275,8 @@ RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame( SDL_LOG_ERROR("Failed to append frame for multiframe message."); return RESULT_FAIL; } - SDL_LOG_INFO("Assembled frame with payload size: " - << assembling_frame->payload_size()); + SDL_LOG_TRACE("Assembled frame with payload size: " + << assembling_frame->payload_size()); frame_data.append_time = date_time::getCurrentTime(); return RESULT_OK; } diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 525e825d84..ae1721c6c0 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -1021,7 +1021,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { } const uint32_t connection_key = tm_message->connection_key(); - SDL_LOG_DEBUG("Received data from TM with connection id " + SDL_LOG_TRACE("Received data from TM with connection id " << connection_key << " msg data_size " << tm_message->data_size()); @@ -1030,7 +1030,7 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) { const ProtocolFramePtrList protocol_frames = incoming_data_handler_.ProcessData( *tm_message, result, &malformed_occurs); - SDL_LOG_DEBUG("Processed " << protocol_frames.size() << " frames"); + SDL_LOG_TRACE("Processed " << protocol_frames.size() << " frames"); if (result != RESULT_OK) { if (result == RESULT_MALFORMED_OCCURS) { SDL_LOG_WARN("Malformed message occurs, connection id " @@ -1464,7 +1464,7 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage( RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) { DCHECK_OR_RETURN(packet, RESULT_UNKNOWN); - SDL_LOG_DEBUG("Handling message " << packet); + SDL_LOG_TRACE("Handling message " << packet); switch (packet->frame_type()) { case FRAME_TYPE_CONTROL: SDL_LOG_TRACE("FRAME_TYPE_CONTROL"); @@ -1488,7 +1488,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage( const ProtocolFramePtr packet) { SDL_LOG_AUTO_TRACE(); - SDL_LOG_DEBUG( + SDL_LOG_TRACE( "FRAME_TYPE_SINGLE message of size " << packet->data_size() << "; message " << utils::ConvertBinaryDataToString(packet->data(), packet->data_size())); @@ -2182,7 +2182,7 @@ void ProtocolHandlerImpl::PopValidAndExpiredMultiframes() { const uint32_t connection_key = session_observer_.KeyFromPair( frame->connection_id(), frame->session_id()); - SDL_LOG_DEBUG("Result frame" << frame << "for connection " + SDL_LOG_TRACE("Result frame" << frame << "for connection " << connection_key); const RawMessagePtr rawMessage(new RawMessage(connection_key, frame->protocol_version(), @@ -2261,7 +2261,7 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) { } } break; } - SDL_LOG_DEBUG("Message : " << message.get()); + SDL_LOG_TRACE("Message : " << message.get()); const uint8_t c_id = message->connection_id(); const uint32_t m_id = message->session_id(); @@ -2273,7 +2273,7 @@ void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) { if (((0 != message->data()) && (0 != message->data_size())) || FRAME_TYPE_CONTROL == message->frame_type() || FRAME_TYPE_FIRST == message->frame_type()) { - SDL_LOG_DEBUG("Packet: dataSize " << message->data_size()); + SDL_LOG_TRACE("Packet: dataSize " << message->data_size()); HandleMessage(message); PopValidAndExpiredMultiframes(); } else { @@ -2448,7 +2448,7 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key, int32_t number_of_frames) { - SDL_LOG_DEBUG("SendFramesNumber MobileNaviAck for session " + SDL_LOG_TRACE("SendFramesNumber MobileNaviAck for session " << connection_key); transport_manager::ConnectionUID connection_id = 0; diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc index db2f124c53..9c3dd03141 100644 --- a/src/components/protocol_handler/src/protocol_packet.cc +++ b/src/components/protocol_handler/src/protocol_packet.cc @@ -262,7 +262,7 @@ ProtocolPacket::ProtocolHeaderValidator::max_payload_size_by_service_type( RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( const ProtocolHeader& header) const { - SDL_LOG_DEBUG("Validating header - " << header); + SDL_LOG_TRACE("Validating header - " << header); // expected payload size will be calculated depending // on used protocol version and service type size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE; @@ -390,7 +390,7 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( return RESULT_FAIL; } } - SDL_LOG_DEBUG("Message header is completely correct."); + SDL_LOG_TRACE("Message header is completely correct."); return RESULT_OK; } diff --git a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc index eb92599ae5..61562d88c0 100644 --- a/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc +++ b/src/components/transport_manager/src/transport_adapter/threaded_socket_connection.cc @@ -237,13 +237,13 @@ void ThreadedSocketConnection::Transmit() { poll_fds[1].fd = read_fd_; poll_fds[1].events = POLLIN | POLLPRI; - SDL_LOG_DEBUG("poll " << this); + SDL_LOG_TRACE("poll " << this); if (-1 == poll(poll_fds, kPollFdsSize, -1)) { SDL_LOG_ERROR_WITH_ERRNO("poll failed for connection " << this); Abort(); return; } - SDL_LOG_DEBUG("poll is ok " << this << " revents0: " << std::hex + SDL_LOG_TRACE("poll is ok " << this << " revents0: " << std::hex << poll_fds[0].revents << " revents1:" << std::hex << poll_fds[1].revents); // error check @@ -307,7 +307,7 @@ bool ThreadedSocketConnection::Receive() { bytes_read = recv(socket_, buffer, sizeof(buffer), MSG_DONTWAIT); if (bytes_read > 0) { - SDL_LOG_DEBUG("Received " << bytes_read << " bytes for connection " + SDL_LOG_TRACE("Received " << bytes_read << " bytes for connection " << this); ::protocol_handler::RawMessagePtr frame( new protocol_handler::RawMessage(0, 0, buffer, bytes_read, false)); diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index ee6398db44..bb6f3626e1 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -768,7 +768,7 @@ void TransportManagerImpl::PostMessage( void TransportManagerImpl::PostEvent(const TransportAdapterEvent& event) { SDL_LOG_AUTO_TRACE(); - SDL_LOG_DEBUG("TransportAdapterEvent: " << &event); + SDL_LOG_TRACE("TransportAdapterEvent: " << &event); event_queue_.PostMessage(event); } @@ -823,12 +823,12 @@ void TransportManagerImpl::DeactivateDeviceConnections( TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( const ConnectionUID id) { SDL_LOG_AUTO_TRACE(); - SDL_LOG_DEBUG("ConnectionUID: " << id); + SDL_LOG_TRACE("ConnectionUID: " << id); for (std::vector::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->id == id) { - SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it); + SDL_LOG_TRACE("ConnectionInternal. It's address: " << &*it); return &*it; } } @@ -838,13 +838,13 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( const DeviceUID& device, const ApplicationHandle& application) { SDL_LOG_AUTO_TRACE(); - SDL_LOG_DEBUG("DeviceUID: " << device + SDL_LOG_TRACE("DeviceUID: " << device << "ApplicationHandle: " << application); for (std::vector::iterator it = connections_.begin(); it != connections_.end(); ++it) { if (it->device == device && it->application == application) { - SDL_LOG_DEBUG("ConnectionInternal. It's address: " << &*it); + SDL_LOG_TRACE("ConnectionInternal. It's address: " << &*it); return &*it; } } @@ -1297,7 +1297,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { #endif // TELEMETRY_MONITOR RaiseEvent(&TransportManagerListener::OnTMMessageReceived, event.event_data); - SDL_LOG_DEBUG("event_type = ON_RECEIVED_DONE"); + SDL_LOG_TRACE("event_type = ON_RECEIVED_DONE"); break; } case EventTypeEnum::ON_RECEIVED_FAIL: { -- cgit v1.2.1 From 65db384c67484f73492c100ea301a90ed0e0ff4e Mon Sep 17 00:00:00 2001 From: Sho Amano Date: Thu, 15 Apr 2021 22:20:54 +0900 Subject: Specify a dedicated folder for icon storage (#2202) --- src/appMain/smartDeviceLink.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index ed0e672552..da85809197 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -269,7 +269,8 @@ HashStringSize = 32 [SDL4] ; Section for features added in protocol version 4 ; Path where apps icons must be stored -AppIconsFolder = storage +; Specify a dedicated folder, as old files in this folder can be automatically removed +AppIconsFolder = icons ; Max size of the folder in bytes AppIconsFolderMaxSize = 104857600 ; Amount of oldest icons to remove in case of max folder size was reached -- cgit v1.2.1 From c947f44c72eb86ba15f4f28f16fcc49e1bd1941d Mon Sep 17 00:00:00 2001 From: "Anna Pipko (GitHub)" <39483182+APipko@users.noreply.github.com> Date: Thu, 15 Apr 2021 18:52:48 +0300 Subject: Change default HeartBeat value (#2513) kDefaultHeartBeatTimeout = 5000ms Co-authored-by: Anna Pipko (GitHub) --- src/components/config_profile/src/profile.cc | 2 +- src/components/config_profile/test/profile_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 27829d478f..dd4ecab2b7 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -342,7 +342,7 @@ const uint32_t kDefaultSecurityLevel = 1; #endif // ENABLE_SECURITY const uint32_t kDefaultHubProtocolIndex = 0; -const uint32_t kDefaultHeartBeatTimeout = 0; +const uint32_t kDefaultHeartBeatTimeout = 5000; const uint16_t kDefaultMaxSupportedProtocolVersion = 5; const uint16_t kDefautTransportManagerTCPPort = 12345; const uint16_t kDefaultWebSocketServerPort = 2020; diff --git a/src/components/config_profile/test/profile_test.cc b/src/components/config_profile/test/profile_test.cc index 7b9bb374b9..f0f01d978d 100644 --- a/src/components/config_profile/test/profile_test.cc +++ b/src/components/config_profile/test/profile_test.cc @@ -373,7 +373,7 @@ TEST_F(ProfileTest, IntInsteadOfPair) { TEST_F(ProfileTest, WrongIntValue) { // Default value - uint32_t heart_beat_timeout = 0; + uint32_t heart_beat_timeout = 5000; EXPECT_EQ(heart_beat_timeout, profile_.heart_beat_timeout()); // Change config file @@ -381,7 +381,7 @@ TEST_F(ProfileTest, WrongIntValue) { EXPECT_EQ("smartDeviceLink_invalid_int.ini", profile_.config_file_name()); // Value in file includes letters. Check that value is default - heart_beat_timeout = 0; + heart_beat_timeout = 5000; EXPECT_EQ(heart_beat_timeout, profile_.heart_beat_timeout()); // Update config file -- cgit v1.2.1 From 0045eb26abceea77c9b843e6bd1256dbab381c56 Mon Sep 17 00:00:00 2001 From: Sho Amano Date: Fri, 16 Apr 2021 03:06:44 +0900 Subject: Format hex dump in control_message_matcher (#2311) Co-authored-by: Jacob Keeler --- .../test/include/protocol_handler/control_message_matcher.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h b/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h index a099cff225..cfbc5d6b53 100644 --- a/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h +++ b/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h @@ -32,6 +32,7 @@ #ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_PROTOCOL_HANDLER_CONTROL_MESSAGE_MATCHER_H_ #define SRC_COMPONENTS_PROTOCOL_HANDLER_TEST_INCLUDE_PROTOCOL_HANDLER_CONTROL_MESSAGE_MATCHER_H_ +#include #include #include #include @@ -153,7 +154,8 @@ MATCHER_P4(ControlMessage, *result_listener << "Message with " << data_vector.size() << " byte data : 0x"; for (size_t i = 0u; i < data_vector.size(); ++i) { - *result_listener << std::hex << static_cast(data_vector[i]); + *result_listener << std::setw(2) << std::setfill('0') << std::hex + << static_cast(data_vector[i]); } return false; } -- cgit v1.2.1 From 0736ea16ce07caaf9ea83bfadb3b8e3eee950b3b Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Thu, 15 Apr 2021 14:24:27 -0400 Subject: Update travis distro to Ubuntu 20.04 (#3626) * Update travis distro to 20.04 * Add cppcheck exclusions for false positives * Fix cppcheck issues --- .travis.yml | 4 ++-- src/components/application_manager/src/application_manager_impl.cc | 2 +- src/components/utils/test/file_system_test.cc | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d9cfedb82..d180ba2a85 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: cpp -dist: xenial +dist: focal sudo: required only: - master @@ -20,7 +20,7 @@ before_install: - sudo apt-get install -f clang-format-6.0 script: - - cppcheck --force -isrc/3rd_party -isrc/3rd_party-static --quiet --error-exitcode=1 src + - cppcheck --force -isrc/3rd_party -isrc/3rd_party-static --library=googletest --suppress=unknownMacro --suppress=syntaxError:*_test.cc --quiet --error-exitcode=1 src - ./tools/infrastructure/check_style.sh - mkdir build && cd build - cmake ../ -DBUILD_TESTS=ON diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 948f7944d4..475baae9ec 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -614,7 +614,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( } HmiStatePtr initial_state = - CreateRegularState(std::shared_ptr(application), + CreateRegularState(ApplicationSharedPtr(application), mobile_apis::WindowType::MAIN, mobile_apis::HMILevel::INVALID_ENUM, mobile_apis::AudioStreamingState::INVALID_ENUM, diff --git a/src/components/utils/test/file_system_test.cc b/src/components/utils/test/file_system_test.cc index a94392f81c..9d4e943df6 100644 --- a/src/components/utils/test/file_system_test.cc +++ b/src/components/utils/test/file_system_test.cc @@ -47,8 +47,8 @@ typedef std::vector StringArray; using namespace file_system; namespace { -StringArray MergeStringsToArray(const std::string& first, - const std::string& second) { +StringArray MergeStringsToArray(const std::string first, + const std::string second) { StringArray array_of_strings; array_of_strings.reserve(2); -- cgit v1.2.1 From d7c804de1e5bc90f9359ea21b9d9c54de70bb947 Mon Sep 17 00:00:00 2001 From: Yurii Postolov <32772773+Ypostolov@users.noreply.github.com> Date: Fri, 16 Apr 2021 19:52:40 +0300 Subject: Fix SDL respond UNSUPPORTED_RESOURCE on SystemRequest (QUERY_APPS) (#2502) * SDL respond UNSUPPORTED_RESOURCE on SystemRequest (QUERY_APPS) if SDL is below version 4.0 * answer review comments Co-authored-by: Collin --- .../sdl_rpc_plugin/src/commands/mobile/system_request.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc index cca088ed2d..518c256d94 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc @@ -430,7 +430,6 @@ void SystemRequest::Run() { SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; } - const mobile_apis::RequestType::eType request_type = static_cast( (*message_)[strings::msg_params][strings::request_type].asInt()); @@ -479,6 +478,15 @@ void SystemRequest::Run() { return; } + const uint16_t query_apps_min_version = 4; + + if (mobile_apis::RequestType::QUERY_APPS == request_type && + application_manager_.get_settings().max_supported_protocol_version() < + query_apps_min_version) { + SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); + return; + } + if (!file_system::IsFileNameValid(file_name) && mobile_apis::RequestType::ICON_URL != request_type) { const std::string err_msg = "Sync file name contains forbidden symbols."; -- cgit v1.2.1 From 08d12403dd73b4fc374969e644ef1391bfdc5316 Mon Sep 17 00:00:00 2001 From: Collin Date: Tue, 20 Apr 2021 10:29:07 -0400 Subject: replace applicable post-operators to pre-operators (#3687) * replace applicable X++ with ++X * replace applicable X-- with --X * change for loop updates --- .../src/app_service_app_extension.cc | 2 +- .../as_get_app_service_data_request_from_hmi.cc | 8 ++--- .../hmi/as_get_app_service_records_request.cc | 2 +- .../hmi/on_as_app_service_data_notification.cc | 8 ++--- .../get_interior_vehicle_data_consent_request.cc | 4 +-- .../commands/hmi/navi_set_video_config_request.cc | 2 +- ...on_bc_system_capability_updated_notification.cc | 2 +- .../hmi/on_tts_language_change_notification.cc | 3 +- .../hmi/on_ui_language_change_notification.cc | 3 +- .../sdl_get_policy_configuration_data_request.cc | 2 +- .../src/commands/mobile/alert_request.cc | 4 +-- .../create_interaction_choice_set_request.cc | 2 +- .../on_system_capability_updated_notification.cc | 2 +- .../mobile/on_system_request_notification.cc | 2 +- .../commands/mobile/show_constant_tbt_request.cc | 15 ++++++--- .../src/commands/mobile/subtle_alert_request.cc | 2 +- .../extensions/system_capability_app_extension.cc | 2 +- .../commands/mobile/get_vehicle_data_request.cc | 2 +- .../mobile/on_vehicle_data_notification.cc | 2 +- .../src/custom_vehicle_data_manager_impl.cc | 2 +- .../src/vehicle_info_app_extension.cc | 3 +- .../src/app_launch/app_launch_data_json.cc | 2 +- .../src/application_data_impl.cc | 2 +- .../src/application_manager_impl.cc | 8 ++--- .../src/hmi_language_handler.cc | 5 +-- .../src/message_helper/message_helper.cc | 2 +- .../application_manager/src/request_controller.cc | 6 ++-- .../application_manager/src/request_info.cc | 2 +- .../resumption/resumption_data_processor_impl.cc | 2 +- .../application_manager/src/rpc_passing_handler.cc | 4 +-- src/components/config_profile/src/ini_file.cc | 38 +++++++++++----------- src/components/config_profile/src/profile.cc | 6 ++-- .../formatters/src/CFormatterJsonBase.cc | 6 ++-- .../transport_manager/transport_adapter/device.h | 2 +- .../src/audio/from_mic_to_file_recorder_thread.cc | 4 +-- .../protocol_handler/src/protocol_handler_impl.cc | 6 ++-- .../security_manager/src/crypto_manager_impl.cc | 6 ++-- .../include/smart_objects/enum_schema_item.h | 2 +- .../smart_objects/src/array_schema_item.cc | 2 +- .../smart_objects/src/object_schema_item.cc | 2 +- .../src/cloud/cloud_websocket_transport_adapter.cc | 2 +- src/components/utils/src/lock_boost.cc | 8 ++--- 42 files changed, 100 insertions(+), 91 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc index 5a1815d974..1b8c5bfd1d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc @@ -91,7 +91,7 @@ void AppServiceAppExtension::SaveResumptionData( int i = 0; for (const auto& subscription : subscribed_data_) { resumption_data[app_mngr::hmi_interface::app_service][i] = subscription; - i++; + ++i; } } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc index 32fccb0192..989c606085 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc @@ -92,7 +92,7 @@ void ASGetAppServiceDataRequestFromHMI::GetWeatherImagePaths( if (data.keyExists(strings::minute_forecast)) { smart_objects::SmartObject& minute_forecast = data[strings::minute_forecast]; - for (size_t i = 0; i < minute_forecast.length(); i++) { + for (size_t i = 0; i < minute_forecast.length(); ++i) { if (minute_forecast[i].keyExists(strings::weather_icon)) { MessageHelper::VerifyImage(minute_forecast[i][strings::weather_icon], app, @@ -104,7 +104,7 @@ void ASGetAppServiceDataRequestFromHMI::GetWeatherImagePaths( if (data.keyExists(strings::hourly_forecast)) { smart_objects::SmartObject& hourly_forecast = data[strings::hourly_forecast]; - for (size_t i = 0; i < hourly_forecast.length(); i++) { + for (size_t i = 0; i < hourly_forecast.length(); ++i) { if (hourly_forecast[i].keyExists(strings::weather_icon)) { MessageHelper::VerifyImage(hourly_forecast[i][strings::weather_icon], app, @@ -116,7 +116,7 @@ void ASGetAppServiceDataRequestFromHMI::GetWeatherImagePaths( if (data.keyExists(strings::multiday_forecast)) { smart_objects::SmartObject& multiday_forecast = data[strings::multiday_forecast]; - for (size_t i = 0; i < multiday_forecast.length(); i++) { + for (size_t i = 0; i < multiday_forecast.length(); ++i) { if (multiday_forecast[i].keyExists(strings::weather_icon)) { MessageHelper::VerifyImage(multiday_forecast[i][strings::weather_icon], app, @@ -145,7 +145,7 @@ void ASGetAppServiceDataRequestFromHMI::GetNavigationImagePaths( if (data.keyExists(strings::instructions)) { smart_objects::SmartObject& instructions = data[strings::instructions]; - for (size_t i = 0; i < instructions.length(); i++) { + for (size_t i = 0; i < instructions.length(); ++i) { if (instructions[i].keyExists(strings::image)) { MessageHelper::VerifyImage( instructions[i][strings::image], app, application_manager_); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc index ac3666bf2e..843971e16d 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_records_request.cc @@ -75,7 +75,7 @@ void ASGetAppServiceRecordsRequest::Run() { continue; } records[index] = record; - index++; + ++index; } if (!records.empty()) { diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc index 0f1fbcf1ce..15b5e093a5 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/on_as_app_service_data_notification.cc @@ -84,7 +84,7 @@ void OnASAppServiceDataNotification::GetWeatherImagePaths( if (data.keyExists(strings::minute_forecast)) { smart_objects::SmartObject& minute_forecast = data[strings::minute_forecast]; - for (size_t i = 0; i < minute_forecast.length(); i++) { + for (size_t i = 0; i < minute_forecast.length(); ++i) { if (minute_forecast[i].keyExists(strings::weather_icon)) { MessageHelper::VerifyImage(minute_forecast[i][strings::weather_icon], app, @@ -96,7 +96,7 @@ void OnASAppServiceDataNotification::GetWeatherImagePaths( if (data.keyExists(strings::hourly_forecast)) { smart_objects::SmartObject& hourly_forecast = data[strings::hourly_forecast]; - for (size_t i = 0; i < hourly_forecast.length(); i++) { + for (size_t i = 0; i < hourly_forecast.length(); ++i) { if (hourly_forecast[i].keyExists(strings::weather_icon)) { MessageHelper::VerifyImage(hourly_forecast[i][strings::weather_icon], app, @@ -108,7 +108,7 @@ void OnASAppServiceDataNotification::GetWeatherImagePaths( if (data.keyExists(strings::multiday_forecast)) { smart_objects::SmartObject& multiday_forecast = data[strings::multiday_forecast]; - for (size_t i = 0; i < multiday_forecast.length(); i++) { + for (size_t i = 0; i < multiday_forecast.length(); ++i) { if (multiday_forecast[i].keyExists(strings::weather_icon)) { MessageHelper::VerifyImage(multiday_forecast[i][strings::weather_icon], app, @@ -137,7 +137,7 @@ void OnASAppServiceDataNotification::GetNavigationImagePaths( if (data.keyExists(strings::instructions)) { smart_objects::SmartObject& instructions = data[strings::instructions]; - for (size_t i = 0; i < instructions.length(); i++) { + for (size_t i = 0; i < instructions.length(); ++i) { if (instructions[i].keyExists(strings::image)) { MessageHelper::VerifyImage( instructions[i][strings::image], app, application_manager_); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc index a13a7f2a9e..b2b164b9ad 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_consent_request.cc @@ -116,7 +116,7 @@ void GetInteriorVehicleDataConsentRequest::Execute() { module_ids_for_consent->clear(); auto module_ids = msg_params[message_params::kModuleIds].asArray(); - for (uint32_t i = 0; i < module_ids->size(); i++) { + for (uint32_t i = 0; i < module_ids->size(); ++i) { // Only add modules whose consent is unknown(needs to be sent to the hmi) bool is_consent_undefined = (*hmi_request_consents_.asArray())[i].getType() == @@ -207,7 +207,7 @@ void GetInteriorVehicleDataConsentRequest::on_event( consent.getType() == smart_objects::SmartType::SmartType_Null; if (is_consent_undefined) { consent = (*response_consents)[response_consents_counter]; - response_consents_counter++; + ++response_consents_counter; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc index ff9d861def..613dfc24a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc @@ -106,7 +106,7 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartArray* list = message[strings::msg_params][strings::rejected_params].asArray(); if (list != NULL) { - for (unsigned int i = 0; i < list->size(); i++) { + for (unsigned int i = 0; i < list->size(); ++i) { const std::string& param = (*list)[i].asString(); // Make sure that we actually sent the parameter in the request if ((*message_)[strings::msg_params].keyExists(strings::config) && diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc index 9caec22bd2..ed2b36b413 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc @@ -134,7 +134,7 @@ void OnBCSystemCapabilityUpdatedNotification::Run() { smart_objects::SmartObject& updated_capabilities = msg_params[strings::system_capability] [strings::app_services_capabilities][strings::app_services]; - for (size_t i = 0; i < updated_capabilities.length(); i++) { + for (size_t i = 0; i < updated_capabilities.length(); ++i) { std::string service_id = updated_capabilities[i][strings::updated_app_service_record] [strings::service_id] diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc index f652761178..3c25ff5386 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc @@ -92,7 +92,8 @@ void OnTTSLanguageChangeNotification::Run() { application_manager_.applications().GetData(); ApplicationSetIt it = accessor.begin(); for (; accessor.end() != it;) { - ApplicationSharedPtr app = *it++; + ApplicationSharedPtr app = *it; + ++it; (*message_)[strings::params][strings::connection_key] = app->app_id(); SendNotificationToMobile(message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc index 2f2cb2ddc6..7f6ffaa4eb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_language_change_notification.cc @@ -85,7 +85,8 @@ void OnUILanguageChangeNotification::Run() { ApplicationSetConstIt it = accessor.begin(); for (; accessor.end() != it;) { - ApplicationSharedPtr app = *it++; + ApplicationSharedPtr app = *it; + ++it; (*message_)[strings::params][strings::connection_key] = app->app_id(); SendNotificationToMobile(message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc index 7478a40eeb..f366da82d6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_get_policy_configuration_data_request.cc @@ -144,7 +144,7 @@ smart_objects::SmartObject SDLGetPolicyConfigurationDataRequest::GetValueParam( }; if (policy_property.type() == Json::arrayValue) { - for (Json::ArrayIndex i = 0; i < policy_property.size(); i++) { + for (Json::ArrayIndex i = 0; i < policy_property.size(); ++i) { put_element_in_value_array(policy_property[i], i); } return value; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc index 9f04541b46..5d1a058f16 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc @@ -325,14 +325,14 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { hmi_apis::Common_TextFieldName::alertText1; msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::alert_text1]; - index++; + ++index; } if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = hmi_apis::Common_TextFieldName::alertText2; msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::alert_text2]; - index++; + ++index; } if ((*message_)[strings::msg_params].keyExists(strings::alert_text3)) { msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 0d1d876497..f3e0b67921 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -364,7 +364,7 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse( } void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { - received_chs_count_++; + ++received_chs_count_; SDL_LOG_DEBUG("Got VR.AddCommand response, there are " << expected_chs_count_ - received_chs_count_ << " more to wait."); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc index 1f15170ffe..92b381456f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -96,7 +96,7 @@ void OnSystemCapabilityUpdatedNotification::Run() { smart_objects::SmartObject& updated_capabilities = msg_params[strings::system_capability] [strings::app_services_capabilities][strings::app_services]; - for (size_t i = 0; i < updated_capabilities.length(); i++) { + for (size_t i = 0; i < updated_capabilities.length(); ++i) { std::string service_id = updated_capabilities[i][strings::updated_app_service_record] [strings::service_id] diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc index 40705491fc..af0a5a6539 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc @@ -228,7 +228,7 @@ size_t OnSystemRequestNotification::ParsePTString( if (pt_string[i] == '\"' || pt_string[i] == '\\') { result += '\\'; } else if (pt_string[i] == '\n') { - result_length--; // contentLength is adjusted when this character is + --result_length; // contentLength is adjusted when this character is // not copied to result. continue; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc index cfb9d5896e..e8dbe579c5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc @@ -132,8 +132,9 @@ void ShowConstantTBTRequest::Run() { msg_params.erase(strings::navigation_text_1); msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = static_cast(hmi_apis::Common_TextFieldName::navigationText1); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = + msg_params[hmi_request::navi_texts][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::navigation_text_1]; + ++index; } if (msg_params.keyExists(strings::navigation_text_2)) { @@ -141,8 +142,9 @@ void ShowConstantTBTRequest::Run() { msg_params.erase(strings::navigation_text_2); msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = static_cast(hmi_apis::Common_TextFieldName::navigationText2); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = + msg_params[hmi_request::navi_texts][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::navigation_text_2]; + ++index; } if (msg_params.keyExists(strings::eta)) { @@ -150,8 +152,9 @@ void ShowConstantTBTRequest::Run() { msg_params.erase(strings::eta); msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = static_cast(hmi_apis::Common_TextFieldName::ETA); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = + msg_params[hmi_request::navi_texts][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::eta]; + ++index; } if (msg_params.keyExists(strings::total_distance)) { @@ -159,8 +162,9 @@ void ShowConstantTBTRequest::Run() { msg_params.erase(strings::total_distance); msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = static_cast(hmi_apis::Common_TextFieldName::totalDistance); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = + msg_params[hmi_request::navi_texts][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::total_distance]; + ++index; } if (msg_params.keyExists(strings::time_to_destination)) { @@ -168,8 +172,9 @@ void ShowConstantTBTRequest::Run() { msg_params.erase(strings::time_to_destination); msg_params[hmi_request::navi_texts][index][hmi_request::field_name] = static_cast(hmi_apis::Common_TextFieldName::timeToDestination); - msg_params[hmi_request::navi_texts][index++][hmi_request::field_text] = + msg_params[hmi_request::navi_texts][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::time_to_destination]; + ++index; } if (msg_params.keyExists(strings::soft_buttons)) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc index 1a54f7f106..2a8e267436 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc @@ -336,7 +336,7 @@ void SubtleAlertRequest::SendSubtleAlertRequest(int32_t app_id) { hmi_apis::Common_TextFieldName::subtleAlertText1; msg_params[hmi_request::alert_strings][index][hmi_request::field_text] = (*message_)[strings::msg_params][strings::alert_text1]; - index++; + ++index; } if ((*message_)[strings::msg_params].keyExists(strings::alert_text2)) { msg_params[hmi_request::alert_strings][index][hmi_request::field_name] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc index 311ba5d4aa..117e65d2cb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc @@ -63,7 +63,7 @@ void SystemCapabilityAppExtension::SaveResumptionData( int i = 0; for (const auto& subscription : subscribed_data_) { resumption_data[strings::system_capability][i] = subscription; - i++; + ++i; } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc index e5656d60c5..17a450ca89 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc @@ -91,7 +91,7 @@ void GetVehicleDataRequest::Run() { continue; } hmi_msg_params[name] = msg_params[name]; - params_count++; + ++params_count; } const int minimal_params_count = 1; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc index 60dea0a24b..e062728217 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc @@ -103,7 +103,7 @@ void OnVehicleDataNotification::Run() { } } - for (size_t idx = 0; idx < notify_apps.size(); idx++) { + for (size_t idx = 0; idx < notify_apps.size(); ++idx) { CommandParametersPermissions params_permissions; application_manager_.CheckPolicyPermissions( notify_apps[idx], diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc index af9d605ff0..c1cf905e31 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc @@ -114,7 +114,7 @@ void CustomVehicleDataManagerImpl::CreateMobileMessageParams( auto& input_param = input_params[key]; if (*schema->array && input_param.getType() == smart_objects::SmartType_Array) { - for (size_t i = 0; i < input_param.length(); i++) { + for (size_t i = 0; i < input_param.length(); ++i) { const auto param = fill_mobile_msg(input_param[i], SearchMethod::RECURSIVE); out_params[item_name][i] = param; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc index dd6d797e39..1b503ff943 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc @@ -138,7 +138,8 @@ void VehicleInfoAppExtension::SaveResumptionData( int i = 0; sync_primitives::AutoLock lock(*subscribed_data_lock_); for (const auto& subscription : subscribed_data_) { - resumption_data[strings::application_vehicle_info][i++] = subscription; + resumption_data[strings::application_vehicle_info][i] = subscription; + ++i; } } diff --git a/src/components/application_manager/src/app_launch/app_launch_data_json.cc b/src/components/application_manager/src/app_launch/app_launch_data_json.cc index d618e63e15..ed0fc37974 100644 --- a/src/components/application_manager/src/app_launch/app_launch_data_json.cc +++ b/src/components/application_manager/src/app_launch/app_launch_data_json.cc @@ -257,7 +257,7 @@ bool AppLaunchDataJson::DeleteOldestAppData() { // Copy in temporary vector Json list without oldest record int32_t i = 0; - for (auto it = apps_list.begin(); it != apps_list.end(); ++it, i++) { + for (auto it = apps_list.begin(); it != apps_list.end(); ++it, ++i) { if ((*it).isMember(strings::device_id) && (*it).isMember(strings::bundle_id) && (*it).isMember(strings::app_id) && (*it).isMember(strings::app_launch_last_session)) { diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc index 8f7a1e2815..e190025add 100644 --- a/src/components/application_manager/src/application_data_impl.cc +++ b/src/components/application_manager/src/application_data_impl.cc @@ -611,7 +611,7 @@ void DynamicApplicationDataImpl::set_display_capabilities( } else if (window_id == 0) { return index; } - index++; + ++index; } return -1; }; diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 475baae9ec..c7bb4b3210 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1119,7 +1119,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() { } // Delete the cloud device connection_handler().RemoveCloudAppDevice(app->device()); - removed_app_count++; + ++removed_app_count; } // Update app list if disabled apps were removed @@ -1364,7 +1364,7 @@ ApplicationManagerImpl::GetCloudAppConnectionStatus( uint32_t ApplicationManagerImpl::GetNextMobileCorrelationID() { if (mobile_correlation_id_ < max_correlation_id_) { - mobile_correlation_id_++; + ++mobile_correlation_id_; } else { mobile_correlation_id_ = 0; } @@ -1374,7 +1374,7 @@ uint32_t ApplicationManagerImpl::GetNextMobileCorrelationID() { uint32_t ApplicationManagerImpl::GetNextHMICorrelationID() { if (correlation_id_ < max_correlation_id_) { - correlation_id_++; + ++correlation_id_; } else { correlation_id_ = 0; } @@ -1848,7 +1848,7 @@ bool ApplicationManagerImpl::CheckResumptionRequiredTransportAvailable( return false; } else { // check all AppHMITypes that the app has - for (size_t i = 0; i < app_types_array->length(); i++) { + for (size_t i = 0; i < app_types_array->length(); ++i) { std::string app_type_string = EnumToString(static_cast( app_types_array->getElement(i).asUInt())); diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc index 750755478e..2d9c7cb48a 100644 --- a/src/components/application_manager/src/hmi_language_handler.cc +++ b/src/components/application_manager/src/hmi_language_handler.cc @@ -263,10 +263,11 @@ void HMILanguageHandler::VerifyWithPersistedLanguages() { const ApplicationSet& accessor = application_manager_.applications().GetData(); + ApplicationSetIt it = accessor.begin(); for (; accessor.end() != it;) { - ApplicationConstSharedPtr app = *it++; - + ApplicationConstSharedPtr app = *it; + ++it; SDL_LOG_INFO("Application with app_id " << app->app_id() << " will be unregistered because of " diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index b25e07c8f3..488a5f6eef 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -520,7 +520,7 @@ smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities( smart_objects::SmartType_Map); app_service_capability[strings::updated_app_service_record] = record; app_services[i] = app_service_capability; - i++; + ++i; } app_service_capabilities[strings::app_services] = app_services; diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index a34457ff66..d94bb0e4df 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -80,7 +80,7 @@ void RequestController::InitializeThreadpool() { // TODO(DK): Consider lazy loading threads instead of creating all at once pool_state_ = TPoolState::STARTED; char name[50]; - for (uint32_t i = 0; i < pool_size_; i++) { + for (uint32_t i = 0; i < pool_size_; ++i) { snprintf(name, sizeof(name) / sizeof(name[0]), "AM Pool %u", i); pool_.push_back(threads::CreateThread(name, new Worker(this))); pool_[i]->Start(); @@ -96,7 +96,7 @@ void RequestController::DestroyThreadpool() { SDL_LOG_DEBUG("Broadcasting STOP signal to all threads..."); cond_var_.Broadcast(); // notify all threads we are shutting down } - for (size_t i = 0; i < pool_.size(); i++) { + for (size_t i = 0; i < pool_.size(); ++i) { threads::Thread* thread = pool_[i]; thread->Stop(threads::Thread::kThreadSoftStop); delete thread->GetDelegate(); @@ -246,7 +246,7 @@ void RequestController::TerminateRequest(const uint32_t correlation_id, AutoLock auto_lock(duplicate_message_count_lock_); auto dup_it = duplicate_message_count_.find(correlation_id); if (duplicate_message_count_.end() != dup_it) { - duplicate_message_count_[correlation_id]--; + --duplicate_message_count_[correlation_id]; if (0 == duplicate_message_count_[correlation_id]) { duplicate_message_count_.erase(dup_it); } diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index e1fffdf6fe..b1c1d68eaa 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -244,7 +244,7 @@ uint32_t RequestInfoSet::RemoveRequests( HashSortedRequestInfoSet::iterator to_erase = it++; Erase(*to_erase); it = std::find_if(it, hash_sorted_pending_requests_.end(), filter); - erased++; + ++erased; } CheckSetSizes(); return erased; diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc index dffb1ea094..5c18ef4b9b 100644 --- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc +++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc @@ -975,7 +975,7 @@ void ResumptionDataProcessorImpl::DeletePluginsSubscriptions( smart_objects::SmartObject(smart_objects::SmartType_Map); module_data_so[index][message_params::kModuleType] = module.first; module_data_so[index][message_params::kModuleId] = module.second; - index++; + ++index; } } diff --git a/src/components/application_manager/src/rpc_passing_handler.cc b/src/components/application_manager/src/rpc_passing_handler.cc index 74a865ff4f..b2ac58c4f7 100644 --- a/src/components/application_manager/src/rpc_passing_handler.cc +++ b/src/components/application_manager/src/rpc_passing_handler.cc @@ -85,7 +85,7 @@ bool RPCPassingHandler::CanHandleFunctionID(int32_t function_id) { for (auto it = services.begin(); it != services.end(); ++it) { auto handled_rpcs = it->record[strings::service_manifest][strings::handled_rpcs]; - for (size_t i = 0; i < handled_rpcs.length(); i++) { + for (size_t i = 0; i < handled_rpcs.length(); ++i) { if (handled_rpcs[i].asInt() == function_id) { return true; } @@ -266,7 +266,7 @@ void RPCPassingHandler::PopulateRPCRequestQueue( ++services_it) { auto handled_rpcs = services_it->record[strings::service_manifest][strings::handled_rpcs]; - for (size_t i = 0; i < handled_rpcs.length(); i++) { + for (size_t i = 0; i < handled_rpcs.length(); ++i) { if (handled_rpcs[i].asInt() == function_id) { // Add requests to queue ServiceInfo service_info{ diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc index dd64f48afa..f5817896bf 100644 --- a/src/components/config_profile/src/ini_file.cc +++ b/src/components/config_profile/src/ini_file.cc @@ -118,7 +118,7 @@ char* ini_read_value(const char* fname, return NULL; snprintf(tag, INI_LINE_LEN, "%s", chapter); - for (uint32_t i = 0; i < strlen(tag); i++) { + for (uint32_t i = 0; i < strlen(tag); ++i) { tag[i] = toupper(tag[i]); } @@ -130,7 +130,7 @@ char* ini_read_value(const char* fname, chapter_found = true; snprintf(tag, INI_LINE_LEN, "%s", item); - for (uint32_t i = 0; i < strlen(tag); i++) + for (uint32_t i = 0; i < strlen(tag); ++i) tag[i] = toupper(tag[i]); } } else { @@ -216,7 +216,7 @@ char ini_write_value(const char* fname, #endif // #else #if USE_MKSTEMP snprintf(tag, INI_LINE_LEN, "%s", chapter); - for (uint32_t i = 0; i < strlen(tag); i++) + for (uint32_t i = 0; i < strlen(tag); ++i) tag[i] = toupper(tag[i]); wr_result = 1; @@ -231,7 +231,7 @@ char ini_write_value(const char* fname, chapter_found = true; // coding style snprintf(tag, INI_LINE_LEN, "%s", item); - for (uint32_t i = 0; i < strlen(tag); i++) + for (uint32_t i = 0; i < strlen(tag); ++i) tag[i] = toupper(tag[i]); } } else { @@ -244,7 +244,7 @@ char ini_write_value(const char* fname, first chapter is significant */ value_written = true; } else if (result == INI_RIGHT_ITEM) { - for (uint16_t i = 0; i < cr_count; i++) + for (uint16_t i = 0; i < cr_count; ++i) fprintf(wr_fp, "\n"); cr_count = 0; wr_result = fprintf(wr_fp, "%s=%s\n", item, value); @@ -255,9 +255,9 @@ char ini_write_value(const char* fname, } /* if (!value_written) */ if (0 == strcmp(val, "\n")) { - cr_count++; + ++cr_count; } else { - for (uint32_t i = 0; i < cr_count; i++) + for (uint32_t i = 0; i < cr_count; ++i) fprintf(wr_fp, "\n"); cr_count = 0; wr_result = fprintf(wr_fp, "%s", line); @@ -297,11 +297,11 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { /* cut leading spaces */ line_ptr = line; - for (uint32_t i = 0; i < strlen(line); i++) { + for (uint32_t i = 0; i < strlen(line); ++i) { if ((line[i] == ' ') || (line[i] == 9) || // TAB (line[i] == 10) || // LF (line[i] == 13)) { // CR - line_ptr++; + ++line_ptr; } else { break; } @@ -315,15 +315,15 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { return INI_REMARK; if (*line_ptr == '[' && strrchr(line_ptr, ']') != NULL) { - line_ptr++; + ++line_ptr; /* cut leading stuff */ uint16_t len = strlen(line_ptr); - for (int32_t i = 0; i < len; i++) { + for (int32_t i = 0; i < len; ++i) { if ((*line_ptr == ' ') || (*line_ptr == 9) || // TAB (*line_ptr == 10) || // LF (*line_ptr == 13)) { // CR - line_ptr++; + ++line_ptr; } else { break; } @@ -340,7 +340,7 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { } /* cut trailing stuff */ - for (int32_t i = strlen(temp_str) - 1; i > 0; i--) { + for (int32_t i = strlen(temp_str) - 1; i > 0; --i) { if ((temp_str[i] == ' ') || (temp_str[i] == 9) || // TAB (temp_str[i] == 10) || // LF (temp_str[i] == 13)) { // CR @@ -352,7 +352,7 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { snprintf(value, INI_LINE_LEN, "%s", temp_str); - for (uint32_t i = 0; i < strlen(temp_str); i++) + for (uint32_t i = 0; i < strlen(temp_str); ++i) temp_str[i] = toupper(temp_str[i]); if (strcmp(temp_str, tag) == 0) return INI_RIGHT_CHAPTER; @@ -363,7 +363,7 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { if (NULL != strchr(line_ptr, '=')) { strncpy(temp_str, line_ptr, (strchr(line_ptr, '=') - line_ptr)); /* cut trailing stuff */ - for (int32_t i = strlen(temp_str) - 1; i > 0; i--) { + for (int32_t i = strlen(temp_str) - 1; i > 0; --i) { if ((temp_str[i] == '=') || (temp_str[i] == ' ') || (temp_str[i] == 9) || // TAB (temp_str[i] == 10) || // LF @@ -376,17 +376,17 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { snprintf(value, INI_LINE_LEN, "%s", temp_str); - for (uint32_t i = 0; i < strlen(temp_str); i++) + for (uint32_t i = 0; i < strlen(temp_str); ++i) temp_str[i] = toupper(temp_str[i]); if (strcmp(temp_str, tag) == 0) { line_ptr = strchr(line_ptr, '=') + 1; uint16_t len = strlen(line_ptr); /* cut trailing stuff */ - for (uint32_t i = 0; i < len; i++) { + for (uint32_t i = 0; i < len; ++i) { if ((*line_ptr == ' ') || (*line_ptr == 9) || // TAB (*line_ptr == 10) || // LF (*line_ptr == 13)) { // CR - line_ptr++; + ++line_ptr; } else { break; } @@ -396,7 +396,7 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { if (value[0] != '\0') { /* cut trailing stuff */ - for (int32_t i = strlen(value) - 1; i > 0; i--) { + for (int32_t i = strlen(value) - 1; i > 0; --i) { if ((value[i] == ' ') || (value[i] == ';') || (value[i] == 9) || // TAB (value[i] == 10) || // LF diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index dd4ecab2b7..7836e0c755 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -2361,7 +2361,7 @@ void Profile::UpdateValues() { entry->ini_key_name, kTransportRequiredForResumptionSection); } - entry++; + ++entry; } } @@ -2561,7 +2561,7 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE( list_with_comma, entry->ini_key_name, entry->ini_section_name); } - entry++; + ++entry; } } @@ -2599,7 +2599,7 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE( list_with_comma, entry->ini_key_name, entry->ini_section_name); } - entry++; + ++entry; } } } diff --git a/src/components/formatters/src/CFormatterJsonBase.cc b/src/components/formatters/src/CFormatterJsonBase.cc index d88ffc7158..4e67d5dcbe 100644 --- a/src/components/formatters/src/CFormatterJsonBase.cc +++ b/src/components/formatters/src/CFormatterJsonBase.cc @@ -45,14 +45,14 @@ void ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase:: Json::Value::Members members = value.getMemberNames(); - for (uint32_t i = 0; i < members.size(); i++) { + for (uint32_t i = 0; i < members.size(); ++i) { jsonValueToObj(value[members[i]], obj[members[i]]); } } else if (value.type() == Json::arrayValue) { obj = ns_smart_device_link::ns_smart_objects::SmartObject( ns_smart_device_link::ns_smart_objects::SmartType_Array); - for (uint32_t i = 0; i < value.size(); i++) { + for (uint32_t i = 0; i < value.size(); ++i) { jsonValueToObj(value[i], obj[i]); } } else if (value.type() == Json::intValue) { @@ -81,7 +81,7 @@ void ns_smart_device_link::ns_json_handler::formatters::CFormatterJsonBase:: obj.getType()) { item = Json::arrayValue; - for (uint32_t i = 0; i < obj.length(); i++) { + for (uint32_t i = 0; i < obj.length(); ++i) { Json::Value value(Json::nullValue); objToJsonValue(obj.getElement(i), value); diff --git a/src/components/include/transport_manager/transport_adapter/device.h b/src/components/include/transport_manager/transport_adapter/device.h index 184616d714..770b55a347 100644 --- a/src/components/include/transport_manager/transport_adapter/device.h +++ b/src/components/include/transport_manager/transport_adapter/device.h @@ -163,7 +163,7 @@ class Device { * @brief Increment @link retry_count_ @endlink value */ inline void next_retry() { - retry_count_++; + ++retry_count_; } /** diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc index d2634214fa..09ee931f40 100644 --- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc +++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc @@ -111,7 +111,7 @@ void FromMicToFileRecorderThread::deinitArgs() { SDL_LOG_AUTO_TRACE(); if (argv_) { - for (int32_t i = 0; i < argc_; i++) { + for (int32_t i = 0; i < argc_; ++i) { delete[] argv_[i]; } delete[] argv_; @@ -164,7 +164,7 @@ void FromMicToFileRecorderThread::threadMain() { // g_option_context_parse() modifies params, so keep argc_ and argv_ int32_t argc = argc_; gchar** argv = new gchar*[argc]; - for (int32_t i = 0; i < argc; i++) { + for (int32_t i = 0; i < argc; ++i) { argv[i] = argv_[i]; } diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index ae1721c6c0..2595b26886 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -371,7 +371,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( BsonArray secondaryTransportsArr; bson_array_initialize(&secondaryTransportsArr, secondaryTransports.size()); - for (unsigned int i = 0; i < secondaryTransports.size(); i++) { + for (unsigned int i = 0; i < secondaryTransports.size(); ++i) { char secondaryTransport[255]; strncpy(secondaryTransport, secondaryTransports[i].c_str(), @@ -389,7 +389,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( BsonArray audioServiceTransportsArr; bson_array_initialize(&audioServiceTransportsArr, audioServiceTransports.size()); - for (unsigned int i = 0; i < audioServiceTransports.size(); i++) { + for (unsigned int i = 0; i < audioServiceTransports.size(); ++i) { SDL_LOG_DEBUG("Adding " << audioServiceTransports[i] << " to audioServiceTransports parameter " "of StartSessionAck"); @@ -403,7 +403,7 @@ void ProtocolHandlerImpl::SendStartSessionAck( BsonArray videoServiceTransportsArr; bson_array_initialize(&videoServiceTransportsArr, videoServiceTransports.size()); - for (unsigned int i = 0; i < videoServiceTransports.size(); i++) { + for (unsigned int i = 0; i < videoServiceTransports.size(); ++i) { SDL_LOG_DEBUG("Adding " << videoServiceTransports[i] << " to videoServiceTransports parameter " "of StartSessionAck"); diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc index 717991cf5c..8d9755963c 100644 --- a/src/components/security_manager/src/crypto_manager_impl.cc +++ b/src/components/security_manager/src/crypto_manager_impl.cc @@ -91,7 +91,7 @@ CryptoManagerImpl::CryptoManagerImpl( : settings_(set), context_(NULL) { SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(instance_lock_); - instance_count_++; + ++instance_count_; if (instance_count_ == 1) { SDL_LOG_DEBUG("Openssl engine initialization"); SSL_load_error_strings(); @@ -110,7 +110,7 @@ CryptoManagerImpl::~CryptoManagerImpl() { } else { SSL_CTX_free(context_); } - instance_count_--; + --instance_count_; if (instance_count_ == 0) { SDL_LOG_DEBUG("Openssl engine deinitialization"); EVP_cleanup(); @@ -251,7 +251,7 @@ bool CryptoManagerImpl::Init() { #if OPENSSL_VERSION_NUMBER > OPENSSL1_1_VERSION auto sk = SSL_CTX_get_ciphers(context_); const char* p; - for (int i = 0; i < sk_SSL_CIPHER_num(sk); i++) { + for (int i = 0; i < sk_SSL_CIPHER_num(sk); ++i) { const SSL_CIPHER* c = sk_SSL_CIPHER_value(sk, i); p = SSL_CIPHER_get_name(c); if (p == NULL) diff --git a/src/components/smart_objects/include/smart_objects/enum_schema_item.h b/src/components/smart_objects/include/smart_objects/enum_schema_item.h index de4c3adcc8..07b4f38f62 100644 --- a/src/components/smart_objects/include/smart_objects/enum_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/enum_schema_item.h @@ -296,7 +296,7 @@ template const ElementSignature TEnumSchemaItem::getSignature( const std::vector& signatures, const utils::SemanticVersion& MessageVersion) { - for (uint i = 0; i < signatures.size(); i++) { + for (uint i = 0; i < signatures.size(); ++i) { ElementSignature signature = signatures[i]; // Check if signature matches message version if (signature.mSince != boost::none && diff --git a/src/components/smart_objects/src/array_schema_item.cc b/src/components/smart_objects/src/array_schema_item.cc index 3c28396213..fd8f3ce71d 100644 --- a/src/components/smart_objects/src/array_schema_item.cc +++ b/src/components/smart_objects/src/array_schema_item.cc @@ -146,7 +146,7 @@ void CArraySchemaItem::BuildObjectBySchema(const SmartObject& pattern_object, if (SmartType_Array == pattern_object.getType()) { const size_t array_len = pattern_object.length(); if (array_len > 0) { - for (size_t i = 0u; i < array_len; i++) { + for (size_t i = 0u; i < array_len; ++i) { mElementSchemaItem->BuildObjectBySchema(pattern_object.getElement(i), result_object[i]); } diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc index 920d548c48..d22f1692c8 100644 --- a/src/components/smart_objects/src/object_schema_item.cc +++ b/src/components/smart_objects/src/object_schema_item.cc @@ -326,7 +326,7 @@ const SMember* CObjectSchemaItem::GetCorrectMember( } // Check for history tag items if (!member.mHistoryVector.empty()) { - for (uint i = 0; i < member.mHistoryVector.size(); i++) { + for (uint i = 0; i < member.mHistoryVector.size(); ++i) { if (member.mHistoryVector[i].CheckHistoryFieldVersion(messageVersion)) { return &member.mHistoryVector[i]; } diff --git a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc index 402a103910..98c51d4aab 100644 --- a/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc +++ b/src/components/transport_manager/src/cloud/cloud_websocket_transport_adapter.cc @@ -105,7 +105,7 @@ void CloudWebsocketTransportAdapter::CreateDevice(const std::string& uid) { SDL_LOG_DEBUG("#Results: " << results.size()); std::string results_str; - for (size_t i = 0; i < results.size(); i++) { + for (size_t i = 0; i < results.size(); ++i) { results_str += " R[" + std::to_string(i) + "]:"; results_str += (results[i].length() != 0) ? results[i] : std::string(""); diff --git a/src/components/utils/src/lock_boost.cc b/src/components/utils/src/lock_boost.cc index 735b31d882..53b8dc3ace 100644 --- a/src/components/utils/src/lock_boost.cc +++ b/src/components/utils/src/lock_boost.cc @@ -72,7 +72,7 @@ void Lock::AssertFreeAndMarkTaken() { SDL_LOG_FATAL("Locking already taken not recursive mutex"); NOTREACHED(); } - lock_taken_++; + ++lock_taken_; } void Lock::AssertTakenAndMarkFree() { @@ -80,7 +80,7 @@ void Lock::AssertTakenAndMarkFree() { SDL_LOG_FATAL("Unlocking a mutex that is not taken"); NOTREACHED(); } - lock_taken_--; + --lock_taken_; } // Recursive lock looks the same on the surface, some code duplication is @@ -112,7 +112,7 @@ bool RecursiveLock::Try() { } void RecursiveLock::AssertFreeAndMarkTaken() { - lock_taken_++; + ++lock_taken_; } void RecursiveLock::AssertTakenAndMarkFree() { @@ -120,7 +120,7 @@ void RecursiveLock::AssertTakenAndMarkFree() { SDL_LOG_FATAL("Unlocking a recursive mutex that is not taken"); NOTREACHED(); } - lock_taken_--; + --lock_taken_; } } // namespace sync_primitives -- cgit v1.2.1 From 05d49242f21327c64f0700339520c5b6e3c3403b Mon Sep 17 00:00:00 2001 From: "Mykola Korniichuk (GitHub)" <42380041+mkorniichuk@users.noreply.github.com> Date: Wed, 21 Apr 2021 21:36:46 +0300 Subject: SDL sends wrong OnHMIStatus for voice app in case of a phone call. (#2582) * SDL sends wrong OnHMIStatus for voice app in case of a phone call. Once SDL received OnEventChanged(Phone_Call, true) from HMI, it should send OnHMIStatusUpdate with new HMILevel. Expected HMILevel for voice communication application is "LIMITED", but it is "FULL". PhoneCallHmiState should take into account voice communication app as an additional check. * Fix for state_controller unit tests. Due to changes in a logic for PhoneCallHmiState, unit tests have to be updated as well. ApplicationType enum is removed since it is not actual anymore. As a result, PrepareHMIStateResults functions are modified according to new application types and updated expected HMI states. Tests for NaviStreaming HMI state are enabled. NaviStreamingHmiState is used for these tests instead of VideoStreamingHmiState. New tests for different application types are added. * fix styling issues for state_controller_test * Fix hmi state merge conflicts * Revert test code * Fix unit test * Style Co-authored-by: JackLivio --- src/components/application_manager/src/hmi_state.cc | 2 +- .../application_manager/test/state_controller/state_controller_test.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index 3487116baf..cebcdfd203 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -260,7 +260,7 @@ mobile_apis::HMILevel::eType PhoneCallHmiState::max_hmi_level() const { auto expected = HMILevel::HMI_FULL; if (is_navi_app() || is_mobile_projection_app()) { expected = HMILevel::HMI_LIMITED; - } else if (is_media_app()) { + } else if (is_media_app() || is_voice_communication_app()) { expected = HMILevel::HMI_BACKGROUND; } diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc index 16e8bff8b8..90b53dc6f9 100644 --- a/src/components/application_manager/test/state_controller/state_controller_test.cc +++ b/src/components/application_manager/test/state_controller/state_controller_test.cc @@ -604,7 +604,8 @@ class StateControllerImplTest : public ::testing::Test { return APP_TYPE_NAVI; } - if (app->is_media_application()) { + if (app->is_media_application() || + app->is_voice_communication_supported()) { return APP_TYPE_MEDIA; } -- cgit v1.2.1 From 8d795978d636e8c99ca790d6eacd0b5e2b257876 Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Wed, 21 Apr 2021 17:18:26 -0400 Subject: Fix/Return requesType in sample policy manager response (#3690) * Add change to return response with requestType from the sample_policy_manager * Remove unrequired logs --- src/appMain/sample_policy_manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/appMain/sample_policy_manager.py b/src/appMain/sample_policy_manager.py index 542aa5339b..75a04685ed 100644 --- a/src/appMain/sample_policy_manager.py +++ b/src/appMain/sample_policy_manager.py @@ -154,7 +154,11 @@ class WebSocketHandler(tornado.websocket.WebSocketHandler): print('\033[31;1mMissing fileName parameter: %s\033[0m' % str(json_data)) return - self.write_message(self.handle_func(json_data, self.encryption, self.add_http_header)) + msg = { + "requestType": json_data['requestType'], + "data": self.handle_func(json_data, self.encryption, self.add_http_header) + } + self.write_message(msg) def on_close(self): print ("Connection Closed\n") -- cgit v1.2.1 From 32f9550551bcd10e084c051057cf204c80f68cd4 Mon Sep 17 00:00:00 2001 From: "Vadym Luchko (GitHub)" <76956836+VadymLuchko@users.noreply.github.com> Date: Thu, 22 Apr 2021 16:04:21 +0300 Subject: fix respond on SDL.GetListOfPermission request (#3627) * fix respond on SDL.GetListOfPermission request * Error response in case when we could not collect permissions Co-authored-by: Jacob Keeler --- .../include/application_manager/message_helper.h | 8 ++- .../application_manager/policies/policy_handler.h | 16 +++-- .../src/message_helper/message_helper.cc | 12 ++-- .../src/policies/policy_handler.cc | 51 ++++++++------- .../application_manager/mock_message_helper.h | 10 +-- .../test/message_helper/message_helper_test.cc | 6 +- .../test/mock_message_helper.cc | 6 +- .../test/policy_handler_test.cc | 74 ++++++++++++++++++---- .../policy_external/src/policy_manager_impl.cc | 1 - 9 files changed, 127 insertions(+), 57 deletions(-) diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 9797442e34..4aea48c086 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -490,18 +490,22 @@ class MessageHelper { * @param permissions Array of groups permissions * @param external_consent_status External user consent status * @param correlation_id Correlation id of request + * @param app_mngr ApplicationManager instance + * @param success_flag Indication that we were able to collect permissions */ #ifdef EXTERNAL_PROPRIETARY_MODE static void SendGetListOfPermissionsResponse( const std::vector& permissions, const policy::ExternalConsentStatus& external_consent_status, const uint32_t correlation_id, - ApplicationManager& app_mngr); + ApplicationManager& app_mngr, + const bool success_flag = true); #else static void SendGetListOfPermissionsResponse( const std::vector& permissions, const uint32_t correlation_id, - ApplicationManager& app_mngr); + ApplicationManager& app_mngr, + const bool success_flag = true); #endif // EXTERNAL_PROPRIETARY_MODE /** diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 0a815b4c5b..acf4ca7819 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -880,19 +880,21 @@ class PolicyHandler : public PolicyHandlerInterface, /** * @brief Collects permissions for all currently registered applications on * all devices - * @return consolidated permissions list or empty list if no - * applications/devices currently present + * @param out_permissions output ref on list of application permissions + * @return true if app connection information is valid, otherwise - false */ - std::vector CollectRegisteredAppsPermissions(); + bool CollectRegisteredAppsPermissions( + std::vector& out_permissions); /** * @brief Collects permissions for application with certain connection key * @param connection_key Connection key of application to look for - * @return list of application permissions or empty list if no such - * application found + * @param out_permissions output ref on list of application permissions + * @return true if app connection information is valid, otherwise - false */ - std::vector CollectAppPermissions( - const uint32_t connection_key); + bool CollectAppPermissions( + const uint32_t connection_key, + std::vector& out_permissions); private: static const std::string kLibrary; diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 488a5f6eef..c0f8a5dcfb 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -2333,7 +2333,8 @@ void MessageHelper::SendGetListOfPermissionsResponse( const std::vector& permissions, const policy::ExternalConsentStatus& external_consent_status, uint32_t correlation_id, - ApplicationManager& app_mngr) { + ApplicationManager& app_mngr, + const bool success_flag) { using namespace smart_objects; using namespace hmi_apis; @@ -2345,7 +2346,8 @@ void MessageHelper::SendGetListOfPermissionsResponse( params[strings::function_id] = FunctionID::SDL_GetListOfPermissions; params[strings::message_type] = MessageType::kResponse; params[strings::correlation_id] = correlation_id; - params[hmi_response::code] = static_cast(Common_Result::SUCCESS); + params[hmi_response::code] = static_cast( + success_flag ? Common_Result::SUCCESS : Common_Result::GENERIC_ERROR); SmartObject& msg_params = (*message)[strings::msg_params]; @@ -2375,7 +2377,8 @@ void MessageHelper::SendGetListOfPermissionsResponse( void MessageHelper::SendGetListOfPermissionsResponse( const std::vector& permissions, uint32_t correlation_id, - ApplicationManager& app_mngr) { + ApplicationManager& app_mngr, + const bool success_flag) { using namespace smart_objects; using namespace hmi_apis; @@ -2387,7 +2390,8 @@ void MessageHelper::SendGetListOfPermissionsResponse( params[strings::function_id] = FunctionID::SDL_GetListOfPermissions; params[strings::message_type] = MessageType::kResponse; params[strings::correlation_id] = correlation_id; - params[hmi_response::code] = static_cast(Common_Result::SUCCESS); + params[hmi_response::code] = static_cast( + success_flag ? Common_Result::SUCCESS : Common_Result::GENERIC_ERROR); SmartObject& msg_params = (*message)[strings::msg_params]; diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index bacd478138..dd5ec0d52d 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -866,12 +866,11 @@ void PolicyHandler::ExchangePolicyManager( atomic_policy_manager_.swap(policy_manager); } -std::vector -PolicyHandler::CollectRegisteredAppsPermissions() { +bool PolicyHandler::CollectRegisteredAppsPermissions( + std::vector& out_permissions) { SDL_LOG_AUTO_TRACE(); const auto policy_manager = LoadPolicyManager(); - POLICY_LIB_CHECK_OR_RETURN(policy_manager, - std::vector()); + POLICY_LIB_CHECK_OR_RETURN(policy_manager, false); // If no specific app was passed, get permissions for all currently registered // applications sync_primitives::AutoLock lock(app_to_device_link_lock_); @@ -887,14 +886,17 @@ PolicyHandler::CollectRegisteredAppsPermissions() { it->first, it->second, group_permissions); consolidator.Consolidate(group_permissions); } - return consolidator.GetConsolidatedPermissions(); + + out_permissions = consolidator.GetConsolidatedPermissions(); + return true; } -std::vector PolicyHandler::CollectAppPermissions( - const uint32_t connection_key) { +bool PolicyHandler::CollectAppPermissions( + const uint32_t connection_key, + std::vector& out_permissions) { std::vector group_permissions; const auto policy_manager = LoadPolicyManager(); - POLICY_LIB_CHECK_OR_RETURN(policy_manager, group_permissions); + POLICY_LIB_CHECK_OR_RETURN(policy_manager, false); // Single app only ApplicationSharedPtr app = application_manager_.application(connection_key); @@ -905,7 +907,7 @@ std::vector PolicyHandler::CollectAppPermissions( << "' " "not found within registered applications."); - return group_permissions; + return false; } DeviceParams device_params = GetDeviceParams( @@ -914,14 +916,13 @@ std::vector PolicyHandler::CollectAppPermissions( if (device_params.device_mac_address.empty()) { SDL_LOG_WARN("Couldn't find device, which hosts application."); - return group_permissions; + return false; } - policy_manager->GetUserConsentForApp(device_params.device_mac_address, - app->policy_app_id(), - group_permissions); + policy_manager->GetUserConsentForApp( + device_params.device_mac_address, app->policy_app_id(), out_permissions); - return group_permissions; + return true; } void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, @@ -935,15 +936,12 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, const bool is_app_registered = NULL != app.get(); const bool is_connection_key_valid = is_app_registered && connection_key; - const std::vector permissions = - is_connection_key_valid ? CollectAppPermissions(connection_key) - : CollectRegisteredAppsPermissions(); + std::vector permissions; - if (permissions.empty() && is_connection_key_valid) { - SDL_LOG_ERROR("No permissions found for application with connection key:" - << connection_key); - return; - } + const bool collect_result = + is_connection_key_valid + ? CollectAppPermissions(connection_key, permissions) + : CollectRegisteredAppsPermissions(permissions); MessageHelper::SendGetListOfPermissionsResponse( permissions, @@ -951,7 +949,14 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, policy_manager->GetExternalConsentStatus(), #endif // EXTERNAL_PROPRIETARY_MODE correlation_id, - application_manager_); + application_manager_, + collect_result); + + if (!collect_result) { + SDL_LOG_ERROR( + "Permissions collection failed for application with connection key:" + << connection_key); + } } void PolicyHandler::LinkAppsToDevice() { diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index 89b2d125e5..dd84ce4c40 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -139,18 +139,20 @@ class MockMessageHelper { void(const std::string& file_name, ApplicationManager& app_mngr)); #ifdef EXTERNAL_PROPRIETARY_MODE - MOCK_METHOD4( + MOCK_METHOD5( SendGetListOfPermissionsResponse, void(const std::vector& permissions, const policy::ExternalConsentStatus& external_consent_status, uint32_t correlation_id, - ApplicationManager& app_mngr)); + ApplicationManager& app_mngr, + const bool success_flag)); #else - MOCK_METHOD3( + MOCK_METHOD4( SendGetListOfPermissionsResponse, void(const std::vector& permissions, uint32_t correlation_id, - ApplicationManager& app_mngr)); + ApplicationManager& app_mngr, + const bool success_flag)); #endif // #ifdef EXTERNAL_PROPRIETARY_MODE MOCK_METHOD4(SendOnPermissionsChangeNotification, void(uint32_t connection_key, diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc index f6ee2b654a..d2dc8f3528 100644 --- a/src/components/application_manager/test/message_helper/message_helper_test.cc +++ b/src/components/application_manager/test/message_helper/message_helper_test.cc @@ -963,7 +963,8 @@ TEST_F(MessageHelperTest, SendGetListOfPermissionsResponse_SUCCESS) { MessageHelper::SendGetListOfPermissionsResponse(permissions, external_consent_status, correlation_id, - mock_application_manager_); + mock_application_manager_, + true); ASSERT_TRUE(result.get()); @@ -1003,7 +1004,8 @@ TEST_F(MessageHelperTest, MessageHelper::SendGetListOfPermissionsResponse(permissions, external_consent_status, correlation_id, - mock_application_manager_); + mock_application_manager_, + true); ASSERT_TRUE(result.get()); diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 554b99ff72..f96a0eca5c 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -170,14 +170,16 @@ void MessageHelper::SendGetListOfPermissionsResponse( const policy::ExternalConsentStatus& external_consent_status, #endif // EXTERNAL_PROPRIETARY_MODE uint32_t correlation_id, - ApplicationManager& app_mngr) { + ApplicationManager& app_mngr, + const bool success_flag) { MockMessageHelper::message_helper_mock()->SendGetListOfPermissionsResponse( permissions, #ifdef EXTERNAL_PROPRIETARY_MODE external_consent_status, #endif // EXTERNAL_PROPRIETARY_MODE correlation_id, - app_mngr); + app_mngr, + success_flag); } void MessageHelper::SendOnPermissionsChangeNotification( diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index 1d764526b9..1836e2e87f 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -292,6 +292,10 @@ class PolicyHandlerTest : public ::testing::Test { } }; +ACTION_P(SetDeviceParamsMacAdress, mac_adress) { + *arg3 = mac_adress; +} + TEST_F(PolicyHandlerTest, LoadPolicyLibrary_Method_ExpectLibraryLoaded) { // Check before policy enabled from ini file EXPECT_CALL(policy_settings_, enable_policy()).WillRepeatedly(Return(false)); @@ -1583,6 +1587,56 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions) { GetDataOnDeviceID( testing::An(), _, _, _, _)); +#ifdef EXTERNAL_PROPRIETARY_MODE + policy::ExternalConsentStatus external_consent_status = + policy::ExternalConsentStatus(); + EXPECT_CALL(mock_message_helper_, + SendGetListOfPermissionsResponse( + _, external_consent_status, corr_id, _, true)); + EXPECT_CALL(*mock_policy_manager_, GetExternalConsentStatus()) + .WillOnce(Return(external_consent_status)); +#else + EXPECT_CALL(mock_message_helper_, + SendGetListOfPermissionsResponse(_, corr_id, _, true)); +#endif // #ifdef EXTERNAL_PROPRIETARY_MODE + + policy_handler_.OnGetListOfPermissions(app_id, corr_id); +} + +TEST_F(PolicyHandlerTest, OnGetListOfPermissions_CollectResult_false) { + // Arrange + EnablePolicyAndPolicyManagerMock(); + + const uint32_t app_id = 10u; + const uint32_t corr_id = 1u; + test_app.insert(mock_app_); + + EXPECT_CALL(app_manager_, application(app_id)) + .WillRepeatedly(Return(mock_app_)); + EXPECT_CALL(conn_handler, get_session_observer()) + .WillOnce(ReturnRef(mock_session_observer)); + EXPECT_CALL(*mock_app_, device()).WillOnce(Return(0)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An(), _, _, _, _)) + .WillRepeatedly( + DoAll(SetDeviceParamsMacAdress(std::string()), (Return(1u)))); + +#ifdef EXTERNAL_PROPRIETARY_MODE + policy::ExternalConsentStatus external_consent_status = + policy::ExternalConsentStatus(); + EXPECT_CALL(mock_message_helper_, + SendGetListOfPermissionsResponse( + _, external_consent_status, corr_id, _, false)) + .WillOnce(Return()); + EXPECT_CALL(*mock_policy_manager_, GetExternalConsentStatus()) + .WillOnce(Return(external_consent_status)); +#else + EXPECT_CALL(mock_message_helper_, + SendGetListOfPermissionsResponse(_, corr_id, _, false)) + .WillOnce(Return()); +#endif // #ifdef EXTERNAL_PROPRIETARY_MODE + policy_handler_.OnGetListOfPermissions(app_id, corr_id); } @@ -1614,14 +1668,14 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_WithoutConnectionKey) { #ifdef EXTERNAL_PROPRIETARY_MODE policy::ExternalConsentStatus external_consent_status = policy::ExternalConsentStatus(); - EXPECT_CALL( - mock_message_helper_, - SendGetListOfPermissionsResponse(_, external_consent_status, corr_id, _)); + EXPECT_CALL(mock_message_helper_, + SendGetListOfPermissionsResponse( + _, external_consent_status, corr_id, _, true)); EXPECT_CALL(*mock_policy_manager_, GetExternalConsentStatus()) .WillOnce(Return(external_consent_status)); #else EXPECT_CALL(mock_message_helper_, - SendGetListOfPermissionsResponse(_, corr_id, _)); + SendGetListOfPermissionsResponse(_, corr_id, _, true)); #endif // #ifdef EXTERNAL_PROPRIETARY_MODE policy_handler_.OnGetListOfPermissions(app_id, corr_id); @@ -1690,14 +1744,14 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_GroupPermissions_SUCCESS) { #ifdef EXTERNAL_PROPRIETARY_MODE policy::ExternalConsentStatus external_consent_status = policy::ExternalConsentStatus(); - EXPECT_CALL( - mock_message_helper_, - SendGetListOfPermissionsResponse(_, external_consent_status, corr_id, _)); + EXPECT_CALL(mock_message_helper_, + SendGetListOfPermissionsResponse( + _, external_consent_status, corr_id, _, true)); EXPECT_CALL(*mock_policy_manager_, GetExternalConsentStatus()) .WillOnce(Return(external_consent_status)); #else EXPECT_CALL(mock_message_helper_, - SendGetListOfPermissionsResponse(_, corr_id, _)); + SendGetListOfPermissionsResponse(_, corr_id, _, true)); #endif // #ifdef EXTERNAL_PROPRIETARY_MODE policy_handler_.OnGetListOfPermissions(app_id, corr_id); @@ -2318,10 +2372,6 @@ TEST_F(PolicyHandlerTest, EXPECT_FALSE(waiter->WaitFor(kCallsCount_, kTimeout_)); } -ACTION_P(SetDeviceParamsMacAdress, mac_adress) { - *arg3 = mac_adress; -} - TEST_F(PolicyHandlerTest, OnAppPermissionConsentInternal_ExistAppsPreviouslyStored_SUCCESS) { EnablePolicyAndPolicyManagerMock(); diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index d6aa007ac1..b1e1c85490 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -1596,7 +1596,6 @@ void PolicyManagerImpl::GetPermissionsForApp( FillFunctionalGroupPermissions( all_disallowed, group_names, kGroupDisallowed, permissions); } - return; } std::string& PolicyManagerImpl::GetCurrentDeviceId( -- cgit v1.2.1 From cd037d934d44c23e1d77b47b10e319b063f8150a Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Thu, 22 Apr 2021 12:55:40 -0400 Subject: Store resumption data in storage folder (#3686) * fix: store app info JSON file in AppStorageFolder * Update test cases to store app info JSON file in AppStorageFolder Co-authored-by: Sho Amano --- src/appMain/smartDeviceLink.ini | 2 +- .../src/application_manager_impl.cc | 9 +++++--- .../test/app_launch/app_launch_data_json_test.cc | 14 ++++++++----- src/components/resumption/src/last_state_impl.cc | 24 +++++++++++++++++----- src/components/resumption/test/last_state_test.cc | 7 +++++-- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index da85809197..d19f7ef7a1 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -158,7 +158,7 @@ ListFilesRequest = 5 HelpCommand = Help [AppInfo] -; The path for applications info storage. +; The file name for applications info storage. AppInfoStorage = app_info.dat [Security Manager] diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index c7bb4b3210..7a12db09ff 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -3041,11 +3041,14 @@ void ApplicationManagerImpl::HeadUnitReset( void ApplicationManagerImpl::ClearAppsPersistentData() { SDL_LOG_AUTO_TRACE(); typedef std::vector FilesList; - const std::string apps_info_storage_file = get_settings().app_info_storage(); - file_system::DeleteFile(apps_info_storage_file); - const std::string storage_folder = get_settings().app_storage_folder(); + const std::string apps_info_storage_file = + !storage_folder.empty() + ? storage_folder + "/" + get_settings().app_info_storage() + : get_settings().app_info_storage(); + file_system::DeleteFile(apps_info_storage_file); + FilesList files = file_system::ListFiles(storage_folder); FilesList::iterator element_to_skip = std::find(files.begin(), files.end(), "policy.sqlite"); diff --git a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc index f7bd636a66..240b5f7d01 100644 --- a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc +++ b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc @@ -60,17 +60,17 @@ using namespace file_system; using namespace app_launch; const std::string kAppStorageFolder = "app_storage_folder"; -const std::string kAppStorageFile = "./app_info.dat"; const std::string kAppInfoStorage = "app_info_storage"; class AppLaunchDataJsonTest : public ::testing::Test { private: virtual void SetUp() { - ::file_system::DeleteFile(kAppStorageFile); + const std::string storage_file = kAppStorageFolder + "/" + kAppInfoStorage; + ::file_system::DeleteFile(storage_file); last_state_wrapper_ = std::make_shared( std::make_shared(kAppStorageFolder, kAppInfoStorage)); - ASSERT_TRUE(::file_system::CreateFile(kAppStorageFile)); + ASSERT_TRUE(::file_system::CreateFile(storage_file)); NiceMock mock_app_launch_settings_; ON_CALL(mock_app_launch_settings_, max_number_of_ios_device()) @@ -85,10 +85,14 @@ class AppLaunchDataJsonTest : public ::testing::Test { res_json_.get()->Clear(); } - static void SetUpTestCase() {} + static void SetUpTestCase() { + ::file_system::RemoveDirectory(kAppStorageFolder); + ::file_system::CreateDirectoryRecursively(kAppStorageFolder); + } static void TearDownTestCase() { - ::file_system::DeleteFile(kAppStorageFile); + const std::string storage_file = kAppStorageFolder + "/" + kAppInfoStorage; + ::file_system::DeleteFile(storage_file); ::file_system::RemoveDirectory(kAppStorageFolder); } diff --git a/src/components/resumption/src/last_state_impl.cc b/src/components/resumption/src/last_state_impl.cc index 185535c50d..2083369a8e 100644 --- a/src/components/resumption/src/last_state_impl.cc +++ b/src/components/resumption/src/last_state_impl.cc @@ -61,12 +61,17 @@ void LastStateImpl::SaveStateToFileSystem() { styled_string = dictionary_.toStyledString(); } + const std::string full_path = + !app_storage_folder_.empty() + ? app_storage_folder_ + "/" + app_info_storage_ + : app_info_storage_; + const std::vector char_vector_pdata(styled_string.begin(), styled_string.end()); DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_)); SDL_LOG_INFO("LastState::SaveStateToFileSystem[DEPRECATED] " - << app_info_storage_ << styled_string); - DCHECK(file_system::Write(app_info_storage_, char_vector_pdata)); + << full_path << styled_string); + DCHECK(file_system::Write(full_path, char_vector_pdata)); } void LastStateImpl::SaveToFileSystem() { @@ -78,17 +83,26 @@ void LastStateImpl::SaveToFileSystem() { styled_string = dictionary_.toStyledString(); } + const std::string full_path = + !app_storage_folder_.empty() + ? app_storage_folder_ + "/" + app_info_storage_ + : app_info_storage_; + const std::vector char_vector_pdata(styled_string.begin(), styled_string.end()); DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_)); SDL_LOG_INFO("LastState::SaveToFileSystem " << app_info_storage_ - << styled_string); - DCHECK(file_system::Write(app_info_storage_, char_vector_pdata)); + << full_path); + DCHECK(file_system::Write(full_path, char_vector_pdata)); } void LastStateImpl::LoadFromFileSystem() { + const std::string full_path = + !app_storage_folder_.empty() + ? app_storage_folder_ + "/" + app_info_storage_ + : app_info_storage_; std::string buffer; - const bool result = file_system::ReadFile(app_info_storage_, buffer); + const bool result = file_system::ReadFile(full_path, buffer); utils::JsonReader reader; if (result && reader.parse(buffer, &dictionary_)) { diff --git a/src/components/resumption/test/last_state_test.cc b/src/components/resumption/test/last_state_test.cc index 61c227bbf3..c242f18099 100644 --- a/src/components/resumption/test/last_state_test.cc +++ b/src/components/resumption/test/last_state_test.cc @@ -50,12 +50,15 @@ class LastStateTest : public ::testing::Test { protected: LastStateTest() : empty_dictionary_("null\n") - , app_info_dat_file_("app_info.dat") + , app_info_dat_file_(kAppStorageFolder + "/" + kAppInfoStorageFile) , last_state_(kAppStorageFolder, kAppInfoStorageFile) {} static void SetUpTestCase() { - file_system::DeleteFile(kAppInfoStorageFile); + const std::string storage_file = + kAppStorageFolder + "/" + kAppInfoStorageFile; + file_system::DeleteFile(storage_file); file_system::RemoveDirectory(kAppStorageFolder); + file_system::CreateDirectoryRecursively(kAppStorageFolder); } void SetUp() OVERRIDE { -- cgit v1.2.1 From b8bb4ae8947c74bde887b1148aa116ac19b8020b Mon Sep 17 00:00:00 2001 From: Yurii Postolov <32772773+Ypostolov@users.noreply.github.com> Date: Mon, 26 Apr 2021 21:44:44 +0300 Subject: fix crash in libusb callback handling (#2505) * fix crash in libusb callback handling * Answer review; removing redundant logger * Respond review comment, fixed logger. * Removed usb_connection.cc.orig * Update src/components/transport_manager/src/usb/libusb/usb_connection.cc Co-authored-by: Collin * Update src/components/transport_manager/src/usb/libusb/usb_connection.cc Co-authored-by: Collin Co-authored-by: yurii Co-authored-by: Collin --- .../transport_manager/src/usb/libusb/usb_connection.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc index 278a1b1f05..44e037e2b5 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc @@ -128,6 +128,13 @@ std::string hex_data(const unsigned char* const buffer, } void UsbConnection::OnInTransfer(libusb_transfer* transfer) { + SDL_LOG_AUTO_TRACE(); + if (transfer->status == LIBUSB_TRANSFER_CANCELLED) { + SDL_LOG_DEBUG("Free already canceled transfer."); + libusb_free_transfer(transfer); + return; + } + SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer); if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { SDL_LOG_DEBUG("USB incoming transfer, size:" @@ -200,6 +207,13 @@ TransportAdapter::Error UsbConnection::PostOutTransfer() { } void UsbConnection::OnOutTransfer(libusb_transfer* transfer) { + SDL_LOG_AUTO_TRACE(); + if (transfer->status == LIBUSB_TRANSFER_CANCELLED) { + SDL_LOG_DEBUG("Free already canceled transfer."); + libusb_free_transfer(transfer); + return; + } + SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer); auto error_code = TransportAdapter::OK; { -- cgit v1.2.1 From 74ea4bb79b6adf00702e68cf5d502bc3def0f285 Mon Sep 17 00:00:00 2001 From: Collin Date: Mon, 26 Apr 2021 15:16:13 -0400 Subject: Open INI file less (#3688) * parse all values from one ini file open * wrap ini_read_value to open file for ini_file_test.cc * update profile tests, fix handle leak * refactor ini_parse_line * Apply suggestions from code review Co-authored-by: Jacob Keeler * parse ini file in to smart object * remove ini_file changes * fix style * small optimization, parse key first * restore open/close config functions * deprecate ini_file * Revert "restore open/close config functions" This reverts commit a03c69403fe14790e6b6738a65820c1ae69e95c5. * move ini parsing to Profile::ParseConfiguration * add DEPREACTED to ini_file * don't print deprecated warnings from test file that is dedicated to deprecated methods * add macros to ini_file.cc * check style Co-authored-by: Jacob Keeler --- src/components/config_profile/CMakeLists.txt | 2 + .../include/config_profile/ini_file.h | 39 ++-- .../include/config_profile/profile.h | 14 ++ src/components/config_profile/src/ini_file.cc | 6 + src/components/config_profile/src/profile.cc | 220 +++++++++++++++------ src/components/config_profile/test/CMakeLists.txt | 2 + .../config_profile/test/ini_file_test.cc | 5 + src/components/config_profile/test/profile_test.cc | 1 + src/components/transport_manager/CMakeLists.txt | 1 + 9 files changed, 221 insertions(+), 69 deletions(-) diff --git a/src/components/config_profile/CMakeLists.txt b/src/components/config_profile/CMakeLists.txt index 4b545c65ae..8863c098ea 100644 --- a/src/components/config_profile/CMakeLists.txt +++ b/src/components/config_profile/CMakeLists.txt @@ -33,6 +33,7 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) include_directories ( ${COMPONENTS_DIR}/config_profile/include ${COMPONENTS_DIR}/utils/include/ + ${COMPONENTS_DIR}/smart_objects/include ${POLICY_GLOBAL_INCLUDE_PATH}/ ${LOG4CXX_INCLUDE_DIRECTORY} ${BOOST_INCLUDE_DIR} @@ -44,6 +45,7 @@ set(PATHS ) set(LIBRARIES + SmartObjects Utils ) diff --git a/src/components/config_profile/include/config_profile/ini_file.h b/src/components/config_profile/include/config_profile/ini_file.h index 204fb6c7bf..f489872533 100644 --- a/src/components/config_profile/include/config_profile/ini_file.h +++ b/src/components/config_profile/include/config_profile/ini_file.h @@ -34,6 +34,7 @@ #define SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_INI_FILE_H_ #include +#include "utils/macro.h" namespace profile { @@ -88,40 +89,52 @@ extern "C" { * @brief Write usage instructions to the end of the file * @param * + * \deprecated This method will be removed in the next major release + * See Profile::ParseConfiguration for the new ini parsing code + * * @return NULL if file or desired entry not found, otherwise pointer to fname */ -extern char* ini_write_inst(const char* fname, uint8_t flag); +DEPRECATED extern char* ini_write_inst(const char* fname, uint8_t flag); /* * @brief Read a certain item of the specified chapter of a ini-file * + * \deprecated This method will be removed in the next major release + * See Profile::ParseConfiguration for the new ini parsing code + * * @return NULL if file or desired entry not found, otherwise pointer to value */ -extern char* ini_read_value(const char* fname, - const char* chapter, - const char* item, - char* value); +DEPRECATED extern char* ini_read_value(const char* fname, + const char* chapter, + const char* item, + char* value); /* * @brief Write a certain item of the specified chapter of a ini-file * + * \deprecated This method will be removed in the next major release + * See Profile::ParseConfiguration for the new ini parsing code + * * @return NULL if file not found, otherwise pointer to value */ -extern char ini_write_value(const char* fname, - const char* chapter, - const char* item, - const char* value, - uint8_t flag); +DEPRECATED extern char ini_write_value(const char* fname, + const char* chapter, + const char* item, + const char* value, + uint8_t flag); /* * @brief Parse the given line for the item and returns the value if * there is one otherwise NULL * + * \deprecated This method will be removed in the next major release + * See Profile::ParseConfiguration for the new ini parsing code + * * @return NULL if desired entry not found, otherwise pointer to value */ -extern Ini_search_id ini_parse_line(const char* line, - const char* tag, - char* value); +DEPRECATED extern Ini_search_id ini_parse_line(const char* line, + const char* tag, + char* value); #ifdef __cplusplus } diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index dffa2d1571..48ffd30ff3 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -44,6 +44,7 @@ #include "media_manager/media_manager_settings.h" #include "policy/policy_settings.h" #include "protocol_handler/protocol_handler_settings.h" +#include "smart_objects/smart_object.h" #include "transport_manager/transport_manager_settings.h" #include "utils/macro.h" @@ -824,6 +825,11 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, */ uint32_t app_transport_change_timer_addition() const OVERRIDE; + /** + * @brief Parses values in config_file_name_ to config_obj_ smart object + */ + void ParseConfiguration(); + /** * @brief Updates all related values from ini file */ @@ -989,6 +995,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, size_t maximum_audio_payload_size_; size_t maximum_video_payload_size_; std::string config_file_name_; + smart_objects::SmartObject config_obj_; std::string server_address_; uint16_t server_port_; uint16_t video_streaming_port_; @@ -1114,6 +1121,13 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, int iap2_hub_connect_attempts_; int iap_hub_connection_wait_timeout_; uint16_t tts_global_properties_timeout_; + size_t maximum_payload_size_; + size_t message_frequency_count_; + size_t message_frequency_time_; + bool malformed_message_filtering_; + size_t malformed_frequency_count_; + size_t malformed_frequency_time_; + uint32_t multiframe_waiting_timeout_; uint16_t attempts_to_open_policy_db_; uint16_t open_attempt_timeout_ms_; uint32_t resumption_delay_before_ign_; diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc index f5817896bf..615100d9a7 100644 --- a/src/components/config_profile/src/ini_file.cc +++ b/src/components/config_profile/src/ini_file.cc @@ -55,6 +55,9 @@ namespace profile { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + SDL_CREATE_LOG_VARIABLE("Profile") char* ini_write_inst(const char* fname, uint8_t flag) { @@ -415,4 +418,7 @@ Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { return INI_NOTHING; } + +#pragma GCC diagnostic pop + } // namespace profile diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 7836e0c755..c12deb44c8 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -41,7 +41,6 @@ #include -#include "config_profile/ini_file.h" #include "utils/file_system.h" #include "utils/logger.h" #include "utils/threads/thread.h" @@ -64,6 +63,8 @@ namespace { << "'."); \ } +#define INI_LINE_LEN 1024 + const char* kDefaultConfigFileName = "smartDeviceLink.ini"; const char* kMainSection = "MAIN"; @@ -532,6 +533,13 @@ Profile::Profile() , iap2_hub_connect_attempts_(kDefaultIAP2HubConnectAttempts) , iap_hub_connection_wait_timeout_(kDefaultIAPHubConnectionWaitTimeout) , tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout) + , maximum_payload_size_(kDefaultMaximumPayloadSize) + , message_frequency_count_(kDefaultFrequencyCount) + , message_frequency_time_(kDefaultFrequencyTime) + , malformed_message_filtering_(kDefaulMalformedMessageFiltering) + , malformed_frequency_count_(kDefaultMalformedFrequencyCount) + , malformed_frequency_time_(kDefaultMalformedFrequencyTime) + , multiframe_waiting_timeout_(kDefaultExpectedConsecutiveFramesTimeout) , attempts_to_open_policy_db_(kDefaultAttemptsToOpenPolicyDB) , open_attempt_timeout_ms_(kDefaultAttemptsToOpenPolicyDB) , resumption_delay_before_ign_(kDefaultResumptionDelayBeforeIgn) @@ -564,9 +572,6 @@ Profile::Profile() , ignition_off_signal_offset_(kDefaultIgnitionOffSignalOffset) , rpc_pass_through_timeout_(kDefaultRpcPassThroughTimeout) , period_for_consent_expiration_(kDefaultPeriodForConsentExpiration) { - // SDL version - ReadStringValue( - &sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey); } Profile::~Profile() {} @@ -993,65 +998,30 @@ uint32_t Profile::iap_hub_connection_wait_timeout() const { } size_t Profile::maximum_payload_size() const { - size_t maximum_payload_size = 0; - ReadUIntValue(&maximum_payload_size, - kDefaultMaximumPayloadSize, - kProtocolHandlerSection, - kMaximumPayloadSizeKey); - return maximum_payload_size; + return maximum_payload_size_; } size_t Profile::message_frequency_count() const { - size_t message_frequency_count = 0; - ReadUIntValue(&message_frequency_count, - kDefaultFrequencyCount, - kProtocolHandlerSection, - kFrequencyCount); - return message_frequency_count; + return message_frequency_count_; } size_t Profile::message_frequency_time() const { - size_t message_frequency_time = 0; - ReadUIntValue(&message_frequency_time, - kDefaultFrequencyTime, - kProtocolHandlerSection, - kFrequencyTime); - return message_frequency_time; + return message_frequency_time_; } bool Profile::malformed_message_filtering() const { - bool malformed_message_filtering = 0; - ReadBoolValue(&malformed_message_filtering, - kDefaulMalformedMessageFiltering, - kProtocolHandlerSection, - kMalformedMessageFiltering); - return malformed_message_filtering; + return malformed_message_filtering_; } size_t Profile::malformed_frequency_count() const { - size_t malformed_frequency_count = 0; - ReadUIntValue(&malformed_frequency_count, - kDefaultMalformedFrequencyCount, - kProtocolHandlerSection, - kMalformedFrequencyCount); - return malformed_frequency_count; + return malformed_frequency_count_; } size_t Profile::malformed_frequency_time() const { - size_t malformed_frequency_time = 0; - ReadUIntValue(&malformed_frequency_time, - kDefaultMalformedFrequencyTime, - kProtocolHandlerSection, - kMalformedFrequencyTime); - return malformed_frequency_time; + return malformed_frequency_time_; } uint32_t Profile::multiframe_waiting_timeout() const { - uint32_t multiframe_waiting_timeout = 0; - ReadUIntValue(&multiframe_waiting_timeout, - kDefaultExpectedConsecutiveFramesTimeout, - kProtocolHandlerSection, - kExpectedConsecutiveFramesTimeout); - return multiframe_waiting_timeout; + return multiframe_waiting_timeout_; } uint16_t Profile::attempts_to_open_policy_db() const { @@ -1250,9 +1220,81 @@ const std::string Profile::hmi_origin_id() const { return hmi_origin_id_; } +void Profile::ParseConfiguration() { + FILE* config_file_ = fopen(config_file_name_.c_str(), "r"); + config_obj_ = smart_objects::SmartObject(smart_objects::SmartType_Map); + + if (nullptr != config_file_) { + char line[INI_LINE_LEN] = "\0"; + std::string chapter; + + while (nullptr != fgets(line, INI_LINE_LEN, config_file_)) { + std::string line_str(line); + auto whitespace_len = line_str.find_first_not_of(" \t\r\n"); + if (std::string::npos == whitespace_len) { + continue; + } + line_str.erase(0, whitespace_len); + + if (';' == line_str[0] || '*' == line_str[0]) { + continue; + } + + if ('[' == line_str[0] && std::string::npos != line_str.find(']')) { + line_str.erase(0, line_str.find_first_not_of("[ \t\r\n")); + line_str.erase(line_str.find_last_not_of(" \t\r\n]") + 1); + + if (false == line_str.empty()) { + chapter = line_str; + config_obj_[chapter] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + } + + continue; + } + + size_t equals_idx = line_str.find('='); + if (std::string::npos == equals_idx) { + continue; + } + + std::string key(line_str.data(), equals_idx); + std::string value(line_str.data() + equals_idx + 1); + + auto key_whitespace_len = key.find_first_not_of(" \t\r\n"); + if (std::string::npos == key_whitespace_len) { + continue; + } + key.erase(0, key_whitespace_len); + key.erase(key.find_last_not_of(" \t\r\n") + 1); + + if (true == config_obj_[chapter].keyExists(key)) { + continue; + } + + auto val_whitespace_len = value.find_first_not_of(" \t\r\n"); + if (std::string::npos == val_whitespace_len) { + value = ""; + } else { + value.erase(0, value.find_first_not_of(" \t\r\n")); + value.erase(value.find_last_not_of(" \t\r\n") + 1); + } + + config_obj_[chapter][key] = value; + } + } + + if (nullptr != config_file_) { + fclose(config_file_); + config_file_ = nullptr; + } +} + void Profile::UpdateValues() { SDL_LOG_AUTO_TRACE(); + ParseConfiguration(); + // SDL version ReadStringValue( &sdl_version_, kDefaultSDLVersion, kMainSection, kSDLVersionKey); @@ -2134,6 +2176,73 @@ void Profile::UpdateValues() { error_description_ = "PathToSnapshot has forbidden(non-portable) symbols"; } + // Packet with payload bigger than this value will be marked as malformed + ReadUIntValue(&maximum_payload_size_, + kDefaultMaximumPayloadSize, + kProtocolHandlerSection, + kMaximumPayloadSizeKey); + + LOG_UPDATED_VALUE( + maximum_payload_size_, kMaximumPayloadSizeKey, kProtocolHandlerSection); + + // Check for apps sending too many messages + ReadUIntValue(&message_frequency_count_, + kDefaultFrequencyCount, + kProtocolHandlerSection, + kFrequencyCount); + + LOG_UPDATED_VALUE( + message_frequency_count_, kFrequencyCount, kProtocolHandlerSection); + + // Check for apps sending too many messages + ReadUIntValue(&message_frequency_time_, + kDefaultFrequencyTime, + kProtocolHandlerSection, + kFrequencyTime); + + LOG_UPDATED_VALUE( + message_frequency_time_, kFrequencyTime, kProtocolHandlerSection); + + // Enable filter malformed messages + ReadBoolValue(&malformed_message_filtering_, + kDefaulMalformedMessageFiltering, + kProtocolHandlerSection, + kMalformedMessageFiltering); + + LOG_UPDATED_BOOL_VALUE(malformed_message_filtering_, + kMalformedMessageFiltering, + kProtocolHandlerSection); + + // Count for malformed message detection + ReadUIntValue(&malformed_frequency_count_, + kDefaultMalformedFrequencyCount, + kProtocolHandlerSection, + kMalformedFrequencyCount); + + LOG_UPDATED_VALUE(malformed_frequency_count_, + kMalformedFrequencyCount, + kProtocolHandlerSection); + + // Time for malformed message detection + ReadUIntValue(&malformed_frequency_time_, + kDefaultMalformedFrequencyTime, + kProtocolHandlerSection, + kMalformedFrequencyTime); + + LOG_UPDATED_VALUE(malformed_frequency_time_, + kMalformedFrequencyTime, + kProtocolHandlerSection); + + // Timeout for waiting CONSECUTIVE frames of multiframe + ReadUIntValue(&multiframe_waiting_timeout_, + kDefaultExpectedConsecutiveFramesTimeout, + kProtocolHandlerSection, + kExpectedConsecutiveFramesTimeout); + + LOG_UPDATED_VALUE(multiframe_waiting_timeout_, + kExpectedConsecutiveFramesTimeout, + kProtocolHandlerSection); + // Attempts number for opening policy DB ReadUIntValue(&attempts_to_open_policy_db_, kDefaultAttemptsToOpenPolicyDB, @@ -2610,18 +2719,18 @@ bool Profile::ReadValue(bool* value, DCHECK(value); bool ret = false; - char buf[INI_LINE_LEN + 1]; - *buf = '\0'; - if ((0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf)) && - ('\0' != *buf)) { - const int32_t tmpVal = atoi(buf); - if ((0 == strcmp("true", buf)) || (0 != tmpVal)) { + if (config_obj_.keyExists(pSection) && + config_obj_[pSection].keyExists(pKey)) { + auto val_str = config_obj_[pSection][pKey].asString(); + const int32_t tmpVal = atoi(val_str.data()); + if ((0 == strcmp("true", val_str.data())) || (0 != tmpVal)) { *value = true; } else { *value = false; } ret = true; } + return ret; } @@ -2638,10 +2747,9 @@ bool Profile::ReadValueEmpty(std::string* value, DCHECK(value); bool ret = false; - char buf[INI_LINE_LEN + 1]; - *buf = '\0'; - if (0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf)) { - *value = buf; + if (config_obj_.keyExists(pSection) && + config_obj_[pSection].keyExists(pKey)) { + *value = config_obj_[pSection][pKey].asString(); ret = true; } diff --git a/src/components/config_profile/test/CMakeLists.txt b/src/components/config_profile/test/CMakeLists.txt index 597be8fe00..d586485f64 100644 --- a/src/components/config_profile/test/CMakeLists.txt +++ b/src/components/config_profile/test/CMakeLists.txt @@ -33,11 +33,13 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) include_directories ( ${GMOCK_INCLUDE_DIRECTORY} ${COMPONENTS_DIR}/config_profile/include + ${COMPONENTS_DIR}/smart_objects/include ) set(LIBRARIES gmock ConfigProfile + SmartObjects ) collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/src/components/config_profile/test/ini_file_test.cc b/src/components/config_profile/test/ini_file_test.cc index ca4f2fc849..c1a2b83120 100644 --- a/src/components/config_profile/test/ini_file_test.cc +++ b/src/components/config_profile/test/ini_file_test.cc @@ -40,6 +40,9 @@ namespace profile_test { using namespace ::profile; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + TEST(IniFileTest, WriteItemReadItem) { // Write line in chapter const char* fname = "./test_ini_file.ini"; @@ -325,6 +328,8 @@ TEST(IniFileTest, ParseLineWithComment) { EXPECT_STREQ(line, res); } +#pragma GCC diagnostic pop + } // namespace profile_test } // namespace components } // namespace test diff --git a/src/components/config_profile/test/profile_test.cc b/src/components/config_profile/test/profile_test.cc index f0f01d978d..900bbd1f93 100644 --- a/src/components/config_profile/test/profile_test.cc +++ b/src/components/config_profile/test/profile_test.cc @@ -679,6 +679,7 @@ TEST_F(ProfileTest, CheckVectorContainer) { std::vector diagmodes_list = profile_.ReadIntContainer("MAIN", "SupportedDiagModes", &isread); EXPECT_TRUE(isread); + // Compare with result of ReadIntContainer ASSERT_EQ(diag_modes.size(), diagmodes_list.size()); bool isEqual = true; diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt index 82cc00baf2..2086b37b52 100644 --- a/src/components/transport_manager/CMakeLists.txt +++ b/src/components/transport_manager/CMakeLists.txt @@ -38,6 +38,7 @@ include_directories ( ${COMPONENTS_DIR}/connection_handler/include ${COMPONENTS_DIR}/config_profile/include ${COMPONENTS_DIR}/resumption/include + ${COMPONENTS_DIR}/smart_objects/include ${POLICY_GLOBAL_INCLUDE_PATH}/ ${JSONCPP_INCLUDE_DIRECTORY} ${LOG4CXX_INCLUDE_DIRECTORY} -- cgit v1.2.1 From 4dc2bd9a278628c8b952fc1f480eaa550f9cdcae Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Fri, 30 Apr 2021 13:52:07 -0400 Subject: Feature/Boost Logger Implementation (#3571) * Implement 3rd-party Boost logger * Add boost log config file * Implement log filtering and formatting for the different sinks * Fix Timestamp calculation * Fix function trace string * Implement setting to disable particular sinks * Add append option to file sinks * Telnet logger configuration * Add cmake flag to switch beetween loggers * Remove log4cxx appender include * Style fix * Modify BoostLogConfig file for tests to match the log4cxx properties file * Exclude log4cxx related libraries * Address review comments * Add changes to only install boost log if the correct LOGGER_NAME is set * Fix implementation for removing disabled sinks * Add note for isEnabledFor function * Address review comment * Fix smartobject linking error * Address review comments --- CMakeLists.txt | 23 ++- src/3rd_party/CMakeLists.txt | 20 +- src/appMain/CMakeLists.txt | 11 +- src/appMain/boostlogconfig.ini | 51 +++++ src/appMain/main.cc | 23 ++- src/appMain/test/CMakeLists.txt | 1 + src/components/application_manager/CMakeLists.txt | 2 +- .../app_service_rpc_plugin/CMakeLists.txt | 2 +- .../rpc_plugins/rc_rpc_plugin/CMakeLists.txt | 2 +- .../rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt | 2 +- .../resource_allocation_manager/CMakeLists.txt | 2 +- .../rpc_plugins/sdl_rpc_plugin/CMakeLists.txt | 2 +- .../rpc_plugins/vehicle_info_plugin/CMakeLists.txt | 2 +- .../application_manager/test/CMakeLists.txt | 2 +- .../test/app_launch/CMakeLists.txt | 2 +- src/components/hmi_message_handler/CMakeLists.txt | 2 +- src/components/media_manager/CMakeLists.txt | 2 +- src/components/media_manager/test/CMakeLists.txt | 2 +- .../policy/policy_external/CMakeLists.txt | 2 +- .../policy/policy_external/test/boostlogconfig.ini | 46 +++++ .../policy/policy_regular/CMakeLists.txt | 2 +- .../policy/policy_regular/test/boostlogconfig.ini | 51 +++++ src/components/smart_objects/CMakeLists.txt | 2 +- .../telemetry_monitor/test/CMakeLists.txt | 8 +- .../telemetry_monitor/test/boostlogconfig.ini | 22 +++ src/components/test_main.cc | 3 - src/components/transport_manager/CMakeLists.txt | 2 +- src/components/utils/CMakeLists.txt | 31 ++- .../utils/include/utils/logger/boostlogger.h | 59 ++++++ src/components/utils/src/logger/boostlogger.cc | 208 +++++++++++++++++++++ src/components/utils/test/CMakeLists.txt | 7 +- src/components/utils/test/boostlogconfig.ini | 51 +++++ src/plugins/CMakeLists.txt | 2 +- src/plugins/appenders/CMakeLists.txt | 4 + tools/policy_table_validator/main.cpp | 15 +- 35 files changed, 623 insertions(+), 45 deletions(-) create mode 100644 src/appMain/boostlogconfig.ini create mode 100644 src/components/policy/policy_external/test/boostlogconfig.ini create mode 100644 src/components/policy/policy_regular/test/boostlogconfig.ini create mode 100644 src/components/telemetry_monitor/test/boostlogconfig.ini create mode 100644 src/components/utils/include/utils/logger/boostlogger.h create mode 100644 src/components/utils/src/logger/boostlogger.cc create mode 100644 src/components/utils/test/boostlogconfig.ini diff --git a/CMakeLists.txt b/CMakeLists.txt index 764a050b91..844319ed62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,12 @@ option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON) option(USE_CCACHE "Turn on ccache usage" ON) option(USE_DISTCC "Turn on distributed build_usage" OFF) +set(LOGGER_NAME "LOG4CXX" CACHE STRING "Logging library to use (BOOST, LOG4CXX)") +set_property(CACHE LOGGER_NAME PROPERTY STRINGS BOOST LOG4CXX) +if(LOGGER_NAME STREQUAL "") + set(LOGGER_NAME "LOG4CXX") +endif() + set (EXTENDED_POLICY "PROPRIETARY" CACHE STRING "Policy mode (PROPRIETARY, HTTP or EXTERNAL_PROPRIETARY)") set_property(CACHE EXTENDED_POLICY PROPERTY STRINGS PROPRIETARY HTTP EXTERNAL_PROPRIETARY) if(EXTENDED_POLICY STREQUAL "") @@ -186,6 +192,12 @@ get_property(cValue CACHE ENABLE_SECURITY PROPERTY VALUE) file(APPEND "${build_config_path}" "//${cHelpString}\n") file(APPEND "${build_config_path}" "ENABLE_SECURITY:${cType}=${cValue}\n\n") +get_property(cHelpString CACHE LOGGER_NAME PROPERTY HELPSTRING) +get_property(cType CACHE LOGGER_NAME PROPERTY TYPE) +get_property(cValue CACHE LOGGER_NAME PROPERTY VALUE) +file(APPEND "${build_config_path}" "//${cHelpString}\n") +file(APPEND "${build_config_path}" "LOGGER_NAME:${cType}=${cValue}\n\n") + get_property(cHelpString CACHE EXTENDED_MEDIA_MODE PROPERTY HELPSTRING) get_property(cType CACHE EXTENDED_MEDIA_MODE PROPERTY TYPE) get_property(cValue CACHE EXTENDED_MEDIA_MODE PROPERTY VALUE) @@ -376,6 +388,14 @@ else() set(POLICY_MOCK_INCLUDE_PATH ${COMPONENTS_DIR}/include/test/policy/policy_regular/) endif() +if(${LOGGER_NAME} STREQUAL "LOG4CXX") + add_definitions(-DLOG4CXX_LOGGER) + message(STATUS "Selected the apache log4cxx logging library") +else() + add_definitions(-DBOOST_LOGGER) + message(STATUS "Selected the boost logging library") +endif() + # TODO(AK): check current OS here add_definitions(-DOS_POSIX) @@ -419,7 +439,8 @@ include_directories( add_subdirectory(./src/3rd_party EXCLUDE_FROM_ALL) find_package(OpenSSL REQUIRED) -if(ENABLE_LOG) +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") + message(STATUS "Including log4cxx") include_directories ( ${LOG4CXX_INCLUDE_DIRECTORY} ) endif() diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt index 26baeca3eb..10320e5afb 100644 --- a/src/3rd_party/CMakeLists.txt +++ b/src/3rd_party/CMakeLists.txt @@ -47,7 +47,7 @@ if(FORCE_3RD_PARTY) endif() endif() -if(ENABLE_LOG) +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") # --- libexpat add_subdirectory(expat-2.1.0) set(EXPAT_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib PARENT_SCOPE) @@ -222,7 +222,11 @@ endif() set(BOOST_ROOT ${3RD_PARTY_INSTALL_PREFIX}) set(Boost_NO_BOOST_CMAKE ON) -find_package(Boost 1.72.0 COMPONENTS system thread date_time filesystem regex) +set(BOOST_COMPONENTS system thread date_time filesystem regex) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "BOOST") + list(APPEND BOOST_COMPONENTS log log_setup) +endif() +find_package(Boost 1.72.0 COMPONENTS ${BOOST_COMPONENTS}) if (NOT ${Boost_FOUND}) set(BOOST_LIB_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/boost_src) set(BOOST_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib) @@ -234,15 +238,23 @@ if (NOT ${Boost_FOUND}) set(BOOST_INSTALL_COMMAND sudo ./b2 install) endif() include(ExternalProject) + + set(boost_component_install_flags --with-system --with-thread --with-date_time --with-filesystem --with-regex) + set(boost_component_libraries system thread date_time filesystem regex) + if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "BOOST") + list(APPEND boost_component_install_flags --with-log) + list(APPEND boost_component_libraries log) + endif() + string (REPLACE ";" "," boost_component_libraries_str "${boost_component_libraries}") ExternalProject_Add( Boost URL https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz URL_HASH SHA256=c66e88d5786f2ca4dbebb14e06b566fb642a1a6947ad8cc9091f9f445134143f DOWNLOAD_DIR ${BOOST_LIB_SOURCE_DIRECTORY} SOURCE_DIR ${BOOST_LIB_SOURCE_DIRECTORY} - CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=system,thread,date_time,filesystem,regex --prefix=${3RD_PARTY_INSTALL_PREFIX} + CONFIGURE_COMMAND ./bootstrap.sh --with-libraries=${boost_component_libraries_str} --prefix=${3RD_PARTY_INSTALL_PREFIX} BUILD_COMMAND ./b2 - INSTALL_COMMAND ${BOOST_INSTALL_COMMAND} --clean --prefix=${3RD_PARTY_INSTALL_PREFIX} && ${BOOST_INSTALL_COMMAND} --with-system --with-thread --with-date_time --with-filesystem --with-regex --prefix=${3RD_PARTY_INSTALL_PREFIX} > boost_install.log + INSTALL_COMMAND ${BOOST_INSTALL_COMMAND} --clean --prefix=${3RD_PARTY_INSTALL_PREFIX} && ${BOOST_INSTALL_COMMAND} ${boost_component_install_flags} --prefix=${3RD_PARTY_INSTALL_PREFIX} > boost_install.log INSTALL_DIR ${3RD_PARTY_INSTALL_PREFIX} BUILD_IN_SOURCE true ) diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt index c2b7255ecc..cdd3760fa0 100644 --- a/src/appMain/CMakeLists.txt +++ b/src/appMain/CMakeLists.txt @@ -138,7 +138,7 @@ if (BUILD_USB_SUPPORT) endif() endif() -if(ENABLE_LOG) +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) @@ -160,7 +160,12 @@ target_link_libraries(${PROJECT} ${LIBRARIES}) add_dependencies(${PROJECT} Policy) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/build_config.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +if (${LOGGER_NAME} STREQUAL "LOG4CXX") + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +else() + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/boostlogconfig.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +endif() + file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/audio.8bit.wav DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/smartDeviceLink.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) @@ -217,7 +222,7 @@ endif () # Install rules install(TARGETS ${PROJECT} DESTINATION bin) install( - FILES build_config.txt log4cxx.properties audio.8bit.wav test.txt + FILES build_config.txt log4cxx.properties boostlogconfig.ini audio.8bit.wav test.txt ${CMAKE_CURRENT_BINARY_DIR}/smartDeviceLink.ini hmi_capabilities.json sdl_preloaded_pt.json sample_policy_manager.py ${CMAKE_SOURCE_DIR}/mycert.pem ${CMAKE_SOURCE_DIR}/mykey.pem diff --git a/src/appMain/boostlogconfig.ini b/src/appMain/boostlogconfig.ini new file mode 100644 index 0000000000..a5d43a5bf0 --- /dev/null +++ b/src/appMain/boostlogconfig.ini @@ -0,0 +1,51 @@ +# Core settings +[Core] +DisableLogging=false + +# Console Logging +[Sinks.Console] +DisableLogging=true +Destination=Console +Filter="%Severity% >= debug" +Format="%Severity% [%TimeStamp%][%Component%] %Message%" +AutoFlush=true +Asynchronous=true + +# SDL log file +[Sinks.AllMessages] +DisableLogging=false +Destination=TextFile +FileName=SmartDeviceLinkCore.log +Append=true +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +# Log file for all TransportManager messages +[Sinks.TransportManager] +DisableLogging=false +Destination=TextFile +FileName=TransportManager.log +Append=false +Filter="%Component% = TransportManager" +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +# Log file for handling Ford protocol info (include ProtocolHandler, ConnectionHandler, SecurityManager) +[Sinks.ProtocolFordHandling] +DisableLogging=false +Destination=TextFile +FileName=ProtocolFordHandling.log +Append=false +Filter="%Component% = ConnectionHandler or %Component% = HeartBeatMonitor or %Component% = ProtocolHandler or %Component% = SecurityManager" +Format="%Severity% [%TimeStamp%][%Component%] %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +[Sinks.Telnet] +DisableLogging=true +Destination=Syslog +Asynchronous=true +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +LocalAddress="http://127.0.0.1:6676/" \ No newline at end of file diff --git a/src/appMain/main.cc b/src/appMain/main.cc index 34c5b4dbfa..cedaf50497 100644 --- a/src/appMain/main.cc +++ b/src/appMain/main.cc @@ -43,7 +43,15 @@ // ---------------------------------------------------------------------------- #ifdef ENABLE_LOG + +#ifdef LOG4CXX_LOGGER +#include "utils/appenders_loader.h" #include "utils/logger/log4cxxlogger.h" + +#else // LOG4CXX_LOGGER +#include "utils/logger/boostlogger.h" +#endif // LOG4CXX_LOGGER + #include "utils/logger/logger_impl.h" #endif // ENABLE_LOG @@ -53,7 +61,6 @@ #include "signal_handlers.h" #include "config_profile/profile.h" -#include "utils/appenders_loader.h" #include "utils/signals.h" #include "utils/system.h" @@ -142,18 +149,24 @@ int32_t main(int32_t argc, char** argv) { if (profile_instance.logs_enabled()) { // Logger initialization // Redefine for each paticular logger implementation +#ifdef LOG4CXX_LOGGER auto logger = std::unique_ptr( new logger::Log4CXXLogger("log4cxx.properties")); + + if (!utils::appenders_loader.Loaded()) { + SDL_LOG_ERROR("Appenders plugin not loaded, file logging disabled"); + } +#else // LOG4CXX_LOGGER + auto logger = std::unique_ptr( + new logger::BoostLogger("boostlogconfig.ini")); +#endif // LOG4CXX_LOGGER + logger_impl->Init(std::move(logger)); } #endif threads::Thread::SetNameForId(threads::Thread::CurrentId(), "SDLCore"); - if (!utils::appenders_loader.Loaded()) { - SDL_LOG_ERROR("Appenders plugin not loaded, file logging disabled"); - } - SDL_LOG_INFO("Application started!"); SDL_LOG_INFO("SDL version: " << profile_instance.sdl_version()); diff --git a/src/appMain/test/CMakeLists.txt b/src/appMain/test/CMakeLists.txt index 057e1e9869..c700c5dc57 100644 --- a/src/appMain/test/CMakeLists.txt +++ b/src/appMain/test/CMakeLists.txt @@ -41,6 +41,7 @@ set(testSources set(LIBRARIES gmock + SmartObjects ) create_test(low_voltage_signals_handler_test "${testSources}" "${LIBRARIES}") diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt index c7f2aede9a..6dde632a39 100644 --- a/src/components/application_manager/CMakeLists.txt +++ b/src/components/application_manager/CMakeLists.txt @@ -175,7 +175,7 @@ list(APPEND LIBRARIES AMPolicyLibrary ) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt index ef215cdd5a..98de75d6d2 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt @@ -62,7 +62,7 @@ set(LIBRARIES sdl_rpc_plugin_static ) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt index 8129e1240d..f1cdab02c4 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt @@ -59,7 +59,7 @@ set(LIBRARIES Utils ) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt index 16e95bf599..b438943eca 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt @@ -63,7 +63,7 @@ set(LIBRARIES gmock_main ) -if(ENABLE_LOG) +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt index a22543ba09..adc0cec1b3 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/CMakeLists.txt @@ -71,7 +71,7 @@ set(LIBRARIES dl ) -if(ENABLE_LOG) +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt index 67a178893c..073359ce80 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt @@ -65,7 +65,7 @@ set(LIBRARIES jsoncpp ) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt index 8c29cccfff..a741c32129 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt @@ -54,7 +54,7 @@ set(LIBRARIES connectionHandler ) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt index 7b1a262f1b..cdaa770155 100755 --- a/src/components/application_manager/test/CMakeLists.txt +++ b/src/components/application_manager/test/CMakeLists.txt @@ -123,7 +123,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "QNX") list(REMOVE_ITEM LIBRARIES dl) endif() -if (ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) diff --git a/src/components/application_manager/test/app_launch/CMakeLists.txt b/src/components/application_manager/test/app_launch/CMakeLists.txt index 1c038020b9..89e1eef2b4 100644 --- a/src/components/application_manager/test/app_launch/CMakeLists.txt +++ b/src/components/application_manager/test/app_launch/CMakeLists.txt @@ -46,7 +46,7 @@ set(LIBRARIES ApplicationManager ) - if (ENABLE_LOG) + if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY}) list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY}) diff --git a/src/components/hmi_message_handler/CMakeLists.txt b/src/components/hmi_message_handler/CMakeLists.txt index 8fafee1ac5..f66b19696d 100644 --- a/src/components/hmi_message_handler/CMakeLists.txt +++ b/src/components/hmi_message_handler/CMakeLists.txt @@ -74,7 +74,7 @@ endif() target_link_libraries("HMIMessageHandler" ${LIBRARIES}) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") target_link_libraries("HMIMessageHandler" log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/media_manager/CMakeLists.txt b/src/components/media_manager/CMakeLists.txt index 50c9fce20a..f4da8ded48 100644 --- a/src/components/media_manager/CMakeLists.txt +++ b/src/components/media_manager/CMakeLists.txt @@ -102,7 +102,7 @@ collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}") add_library("MediaManager" ${SOURCES}) target_link_libraries("MediaManager" ${LIBRARIES}) -if(ENABLE_LOG) +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") target_link_libraries("MediaManager" log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/media_manager/test/CMakeLists.txt b/src/components/media_manager/test/CMakeLists.txt index 265a62a0d8..1b74554fb1 100644 --- a/src/components/media_manager/test/CMakeLists.txt +++ b/src/components/media_manager/test/CMakeLists.txt @@ -69,6 +69,6 @@ endif() create_test("media_manager_test" "${SOURCES}" "${LIBRARIES}") -if(ENABLE_LOG) +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") target_link_libraries("media_manager_test" log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/policy/policy_external/CMakeLists.txt b/src/components/policy/policy_external/CMakeLists.txt index 361c48a598..72f7dd7bdb 100644 --- a/src/components/policy/policy_external/CMakeLists.txt +++ b/src/components/policy/policy_external/CMakeLists.txt @@ -128,7 +128,7 @@ target_link_libraries(PolicyStatic ${LIBRARIES}) add_library(Policy SHARED "src/policy_manager_impl.cc") target_link_libraries(Policy PolicyStatic) -if (ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") target_link_libraries(Policy log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/policy/policy_external/test/boostlogconfig.ini b/src/components/policy/policy_external/test/boostlogconfig.ini new file mode 100644 index 0000000000..5cf35d0e7a --- /dev/null +++ b/src/components/policy/policy_external/test/boostlogconfig.ini @@ -0,0 +1,46 @@ +# Core settings +[Core] +DisableLogging=false + +# Console Logging (Only ERROR and FATAL messages are logged to console) +[Sinks.Console] +DisableLogging=false +Destination=Console +Filter="%Severity% >= error" +Format="%Severity% [%TimeStamp%][%Component%] %Message%" +AutoFlush=true +Asynchronous=true + +# SDL log file +[Sinks.AllMessages] +DisableLogging=false +Destination=TextFile +FileName=SmartDeviceLinkCore.log +Append=true +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +# Log file for all SQLPTRepresentation messages +[Sinks.SQLPTRepresentation] +DisableLogging=false +Destination=TextFile +FileName="SQLRepresentation_%Y-%m-%d.log" +RotationTimePoint="00:00:00" +Append=false +Filter="%Trace% contains SQLPTRepresentation" +Format="%Severity% [%TimeStamp%] :%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +# Log file for all PolicyManagerImpl messages +[Sinks.PolicyManagerImpl] +DisableLogging=false +Destination=TextFile +FileName="PolicyManagerImpl_%Y-%m-%d.log" +RotationTimePoint="00:00:00" +Append=false +Filter="%Trace% contains PolicyManagerImpl" +Format="%Severity% [%TimeStamp%] :%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true diff --git a/src/components/policy/policy_regular/CMakeLists.txt b/src/components/policy/policy_regular/CMakeLists.txt index e14057ec89..85ba86cfba 100644 --- a/src/components/policy/policy_regular/CMakeLists.txt +++ b/src/components/policy/policy_regular/CMakeLists.txt @@ -150,7 +150,7 @@ target_link_libraries(PolicyStatic ${LIBRARIES}) add_library(Policy SHARED "src/policy_manager_impl.cc") target_link_libraries(Policy PolicyStatic) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") target_link_libraries(Policy log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/policy/policy_regular/test/boostlogconfig.ini b/src/components/policy/policy_regular/test/boostlogconfig.ini new file mode 100644 index 0000000000..f33da81c93 --- /dev/null +++ b/src/components/policy/policy_regular/test/boostlogconfig.ini @@ -0,0 +1,51 @@ +# Core settings +[Core] +DisableLogging=false + +# Console Logging +[Sinks.Console] +DisableLogging=true +Destination=Console +Filter="%Severity% > trace" +Format="%Severity% [%TimeStamp%][%Component%] %Message%" +AutoFlush=true +Asynchronous=true + +# SDL log file +[Sinks.AllMessages] +DisableLogging=false +Destination=TextFile +FileName=SmartDeviceLinkCore.log +Append=true +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +# Log file for all TransportManager messages +[Sinks.TransportManager] +DisableLogging=false +Destination=TextFile +FileName=TransportManager.log +Append=false +Filter="%Component% = TransportManager" +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +# Log file for handling Ford protocol info (include ProtocolHandler, ConnectionHandler, SecurityManager) +[Sinks.ProtocolFordHandling] +DisableLogging=false +Destination=TextFile +FileName=ProtocolFordHandling.log +Append=false +Filter="%Component% = ConnectionHandler or %Component% = HeartBeatMonitor or %Component% = ProtocolHandler or %Component% = SecurityManager" +Format="%Severity% [%TimeStamp%][%Component%] %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +[Sinks.Telnet] +DisableLogging=true +Destination=Syslog +Asynchronous=true +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +LocalAddress="http://127.0.0.1:6676/" \ No newline at end of file diff --git a/src/components/smart_objects/CMakeLists.txt b/src/components/smart_objects/CMakeLists.txt index 6bc70f8226..bb8bb1cf07 100644 --- a/src/components/smart_objects/CMakeLists.txt +++ b/src/components/smart_objects/CMakeLists.txt @@ -48,7 +48,7 @@ add_library("SmartObjects" ${SOURCES}) target_link_libraries("SmartObjects" Utils) add_dependencies("SmartObjects" MOBILE_API) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") target_link_libraries("SmartObjects" log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/telemetry_monitor/test/CMakeLists.txt b/src/components/telemetry_monitor/test/CMakeLists.txt index 960985e45c..a66d3bdddc 100644 --- a/src/components/telemetry_monitor/test/CMakeLists.txt +++ b/src/components/telemetry_monitor/test/CMakeLists.txt @@ -74,4 +74,10 @@ endif() create_test("telemetry_monitor_test" "${SOURCES}" "${LIBRARIES}") -file(COPY ${COMPONENTS_DIR}/telemetry_monitor/test/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +if (${LOGGER_NAME} STREQUAL "LOG4CXX") + file(COPY ${COMPONENTS_DIR}/telemetry_monitor/test/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +endif() + +if (${LOGGER_NAME} STREQUAL "BOOST") + file(COPY ${COMPONENTS_DIR}/telemetry_monitor/test/boostlogconfig.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +endif() diff --git a/src/components/telemetry_monitor/test/boostlogconfig.ini b/src/components/telemetry_monitor/test/boostlogconfig.ini new file mode 100644 index 0000000000..4ab6b6e473 --- /dev/null +++ b/src/components/telemetry_monitor/test/boostlogconfig.ini @@ -0,0 +1,22 @@ +# Core settings +[Core] +DisableLogging=false + +# Console Logging (Only ERROR and FATAL messages are logged to console) +[Sinks.Console] +DisableLogging=false +Destination=Console +Filter="%Severity% >= error" +Format="%Severity% [%TimeStamp%][%Component%] %Message%" +AutoFlush=true +Asynchronous=true + +# SDL log file +[Sinks.AllMessages] +DisableLogging=false +Destination=TextFile +FileName=SmartDeviceLinkCore.log +Append=true +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true diff --git a/src/components/test_main.cc b/src/components/test_main.cc index 62442cb64f..55b1f96aeb 100644 --- a/src/components/test_main.cc +++ b/src/components/test_main.cc @@ -3,7 +3,6 @@ #include "utils/custom_string.h" #ifdef ENABLE_LOG -#include "utils/logger/log4cxxlogger.h" #include "utils/logger/logger_impl.h" #endif // ENABLE_LOG @@ -15,8 +14,6 @@ int main(int argc, char** argv) { // -------------------------------------------------------------------------- // Logger initialization // Redefine for each paticular logger implementation - auto logger = std::unique_ptr( - new logger::Log4CXXLogger("log4cxx.properties")); auto logger_impl = std::unique_ptr(new logger::LoggerImpl(false)); logger::Logger::instance(logger_impl.get()); diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt index 2086b37b52..eea719088f 100644 --- a/src/components/transport_manager/CMakeLists.txt +++ b/src/components/transport_manager/CMakeLists.txt @@ -146,7 +146,7 @@ list(APPEND SOURCES ${PLATFORM_DEPENDENT_SOURCES}) add_library("TransportManager" ${SOURCES}) target_link_libraries("TransportManager" ${LIBRARIES}) -if(ENABLE_LOG) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") target_link_libraries("TransportManager" log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt index b65b19253a..414500382c 100644 --- a/src/components/utils/CMakeLists.txt +++ b/src/components/utils/CMakeLists.txt @@ -69,13 +69,19 @@ if(NOT BUILD_BACKTRACE_SUPPORT) ) endif() -if(ENABLE_LOG) - list(APPEND LIBRARIES - log4cxx -L${LOG4CXX_LIBS_DIRECTORY} - apr-1 -L${APR_LIBS_DIRECTORY} - aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY} - ConfigProfile - ) +if (ENABLE_LOG) + if (${LOGGER_NAME} STREQUAL "LOG4CXX") + list(APPEND LIBRARIES + log4cxx -L${LOG4CXX_LIBS_DIRECTORY} + apr-1 -L${APR_LIBS_DIRECTORY} + aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY} + ConfigProfile + ) + else() + list(APPEND EXCLUDE_PATHS + logger/log4cxxlogger.cc + ) + endif() else() list(APPEND EXCLUDE_PATHS auto_trace.cc @@ -121,12 +127,21 @@ list(APPEND LIBRARIES boost_system -L${BOOST_LIBS_DIRECTORY}) list(APPEND LIBRARIES boost_thread -L${BOOST_LIBS_DIRECTORY}) list(APPEND LIBRARIES boost_date_time -L${BOOST_LIBS_DIRECTORY}) list(APPEND LIBRARIES boost_filesystem -L${BOOST_LIBS_DIRECTORY}) +if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "BOOST") + list(APPEND LIBRARIES boost_log_setup -L${BOOST_LIBS_DIRECTORY}) + list(APPEND LIBRARIES boost_log -L${BOOST_LIBS_DIRECTORY}) +endif () +list(APPEND LIBRARIES boost_regex -L${BOOST_LIBS_DIRECTORY}) target_link_libraries("Utils" ${LIBRARIES}) add_dependencies("Utils" Boost) if(ENABLE_LOG) - add_dependencies("Utils" install-3rd_party_logger Boost) + if (${LOGGER_NAME} STREQUAL "LOG4CXX") + add_dependencies("Utils" install-3rd_party_logger Boost) + else() + add_dependencies("Utils" Boost) + endif() endif() if(BUILD_TESTS) diff --git a/src/components/utils/include/utils/logger/boostlogger.h b/src/components/utils/include/utils/logger/boostlogger.h new file mode 100644 index 0000000000..b7eeb7ab61 --- /dev/null +++ b/src/components/utils/include/utils/logger/boostlogger.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020, Livio + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#pragma once + +#define BOOST_LOG_DYN_LINK 1 +#include +#include "utils/ilogger.h" + +namespace logger { + +class BoostLogger : public ThirdPartyLoggerInterface { + public: + BoostLogger(const std::string& filename); + void Init() override; + void DeInit() override; + bool IsEnabledFor(const std::string& component, + LogLevel log_level) const override; + void PushLog(const LogMessage& log_message) override; + + private: + boost::posix_time::ptime GetLocalPosixTime( + const logger::TimePoint& timestamp); + + std::string GetFilteredFunctionTrace( + const std::string& full_function_signature); + + std::string filename_; +}; + +} // namespace logger diff --git a/src/components/utils/src/logger/boostlogger.cc b/src/components/utils/src/logger/boostlogger.cc new file mode 100644 index 0000000000..c8429e03c6 --- /dev/null +++ b/src/components/utils/src/logger/boostlogger.cc @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2020, Livio + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "utils/logger/boostlogger.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +namespace logger { + +namespace logging = boost::log; +namespace src = boost::log::sources; +namespace sinks = boost::log::sinks; +namespace keywords = boost::log::keywords; +namespace expr = boost::log::expressions; +namespace attrs = boost::log::attributes; + +BoostLogger::BoostLogger(const std::string& filename) : filename_(filename) {} + +void BoostLogger::Init() { + // Add formatting parameters to INI file + // Allows %Severity% to be used in ini config file for property Format. + boost::log::register_simple_formatter_factory< + boost::log::trivial::severity_level, + char>("Severity"); + boost::log::register_simple_formatter_factory("Component"); + boost::log::register_simple_formatter_factory( + "TimeStamp"); + boost::log::register_simple_formatter_factory( + "ThreadId"); + boost::log::register_simple_formatter_factory("FileName"); + boost::log::register_simple_formatter_factory("LineNum"); + boost::log::register_simple_formatter_factory("Trace"); + + // Add filter parameters to INI file + // Allows %Severity% to be used in ini config file for property Filter. + boost::log:: + register_simple_filter_factory( + "Severity"); + boost::log::register_simple_filter_factory("Component"); + boost::log::register_simple_filter_factory("Trace"); + + std::ifstream file(filename_); + boost::log::settings settings = boost::log::parse_settings(file); + + // Custom Settings + + if (settings.has_section("Sinks")) { + auto& sinks = settings.property_tree().get_child("Sinks"); + + for (auto it = sinks.begin(); it != sinks.end();) { + bool to_be_removed = false; + std::string sink_name = "Sinks." + it->first; + + // Disable logging for particular sinks + if (boost::optional param = + settings[sink_name]["DisableLogging"]) { + to_be_removed = (param.get() == "true"); + } + + if (to_be_removed) { + it = sinks.erase(it); + } else { + it++; + } + } + } + + logging::init_from_settings(settings); +} + +void BoostLogger::DeInit() { + logging::core::get()->remove_all_sinks(); +} + +logging::trivial::severity_level getBoostLogLevel(LogLevel log_level) { + switch (log_level) { + case LogLevel::TRACE_LEVEL: + return logging::trivial::severity_level::trace; + case LogLevel::DEBUG_LEVEL: + return logging::trivial::severity_level::debug; + case LogLevel::INFO_LEVEL: + return logging::trivial::severity_level::info; + case LogLevel::WARNING_LEVEL: + return logging::trivial::severity_level::warning; + case LogLevel::ERROR_LEVEL: + return logging::trivial::severity_level::error; + case LogLevel::FATAL_LEVEL: + return logging::trivial::severity_level::fatal; + default: + assert(false); + } +} + +boost::posix_time::ptime BoostLogger::GetLocalPosixTime( + const logger::TimePoint& timestamp) { + auto time = std::chrono::duration_cast( + timestamp.time_since_epoch()) + .count(); + + boost::posix_time::ptime time_epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::ptime utc_time = + time_epoch + boost::posix_time::microseconds(time); + + typedef boost::date_time::c_local_adjustor + local_adj; + auto local_time = local_adj::utc_to_local(utc_time); + + return local_time; +} + +std::string BoostLogger::GetFilteredFunctionTrace( + const std::string& full_function_signature) { + boost::regex function_pattern("([^\\s]*)\\((.*)\\)"); + boost::smatch results; + + if (!boost::regex_search( + full_function_signature, results, function_pattern)) { + // Invalid pattern + return std::string(full_function_signature); + } + + // Get the function name(including namespaces) from the function signature + return std::string(results[1]); +} + +bool BoostLogger::IsEnabledFor(const std::string& component, + LogLevel log_level) const { + // Basic filtering based on component name and log level is currently handled + // using the Filter attribute. This function should be implemented if we add + // custom attributes for filtering or additional logic for filtering based on + // component name and log level. + return true; +} + +void BoostLogger::PushLog(const LogMessage& log_message) { + auto local_time = GetLocalPosixTime(log_message.timestamp_); + std::string func_name = + GetFilteredFunctionTrace(log_message.location_.function_name); + + src::severity_logger slg; + slg.add_attribute("TimeStamp", + attrs::constant(local_time)); + slg.add_attribute("ThreadId", + attrs::constant(log_message.thread_id_)); + slg.add_attribute("Component", + attrs::constant(log_message.component_)); + slg.add_attribute( + "FileName", + attrs::constant(log_message.location_.file_name)); + slg.add_attribute("LineNum", + attrs::constant(log_message.location_.line_number)); + slg.add_attribute("Trace", attrs::constant(func_name)); + + BOOST_LOG_SEV(slg, getBoostLogLevel(log_message.log_level_)) + << log_message.log_event_; +} + +} // namespace logger diff --git a/src/components/utils/test/CMakeLists.txt b/src/components/utils/test/CMakeLists.txt index 2db7d72d84..c09d2d7ce6 100644 --- a/src/components/utils/test/CMakeLists.txt +++ b/src/components/utils/test/CMakeLists.txt @@ -93,7 +93,12 @@ set(LIBRARIES create_test(utils_test "${SOURCES}" "${LIBRARIES}") file(COPY testscript.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +if (${LOGGER_NAME} STREQUAL "LOG4CXX") + file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +else() + file(COPY boostlogconfig.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) +endif() + file(COPY smartDeviceLink.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) add_subdirectory(test_generator) diff --git a/src/components/utils/test/boostlogconfig.ini b/src/components/utils/test/boostlogconfig.ini new file mode 100644 index 0000000000..f33da81c93 --- /dev/null +++ b/src/components/utils/test/boostlogconfig.ini @@ -0,0 +1,51 @@ +# Core settings +[Core] +DisableLogging=false + +# Console Logging +[Sinks.Console] +DisableLogging=true +Destination=Console +Filter="%Severity% > trace" +Format="%Severity% [%TimeStamp%][%Component%] %Message%" +AutoFlush=true +Asynchronous=true + +# SDL log file +[Sinks.AllMessages] +DisableLogging=false +Destination=TextFile +FileName=SmartDeviceLinkCore.log +Append=true +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +# Log file for all TransportManager messages +[Sinks.TransportManager] +DisableLogging=false +Destination=TextFile +FileName=TransportManager.log +Append=false +Filter="%Component% = TransportManager" +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +# Log file for handling Ford protocol info (include ProtocolHandler, ConnectionHandler, SecurityManager) +[Sinks.ProtocolFordHandling] +DisableLogging=false +Destination=TextFile +FileName=ProtocolFordHandling.log +Append=false +Filter="%Component% = ConnectionHandler or %Component% = HeartBeatMonitor or %Component% = ProtocolHandler or %Component% = SecurityManager" +Format="%Severity% [%TimeStamp%][%Component%] %Trace%: %Message%" +AutoFlush=true +Asynchronous=true + +[Sinks.Telnet] +DisableLogging=true +Destination=Syslog +Asynchronous=true +Format="%Severity% [%TimeStamp%][%ThreadId%][%Component%] %FileName%:%LineNum% %Trace%: %Message%" +LocalAddress="http://127.0.0.1:6676/" \ No newline at end of file diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 4b6f6d8dfa..4b6bf18046 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -28,6 +28,6 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -if(ENABLE_LOG) +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") add_subdirectory(appenders) endif() diff --git a/src/plugins/appenders/CMakeLists.txt b/src/plugins/appenders/CMakeLists.txt index 3d18e62503..7ec235bece 100644 --- a/src/plugins/appenders/CMakeLists.txt +++ b/src/plugins/appenders/CMakeLists.txt @@ -30,15 +30,19 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) +if (${LOGGER_NAME} STREQUAL "LOG4CXX") include_directories( ${LOG4CXX_INCLUDE_DIRECTORY} ) +endif() collect_sources(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}") +if (${LOGGER_NAME} STREQUAL "LOG4CXX") set(LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY} ) +endif() add_library(appenders SHARED ${SOURCES}) target_link_libraries(appenders ${LIBRARIES}) diff --git a/tools/policy_table_validator/main.cpp b/tools/policy_table_validator/main.cpp index 7e099c7ae1..cc1318d215 100644 --- a/tools/policy_table_validator/main.cpp +++ b/tools/policy_table_validator/main.cpp @@ -6,8 +6,13 @@ #include "utils/file_system.h" #ifdef ENABLE_LOG -#include "utils/logger/logger_impl.h" +#ifdef LOG4CXX_LOGGER #include "utils/logger/log4cxxlogger.h" +#else // LOG4CXX_LOGGER +#include "utils/logger/boostlogger.h" +#endif // LOG4CXX_LOGGER + +#include "utils/logger/logger_impl.h" #endif // ENABLE_LOG #include "utils/logger.h" @@ -55,7 +60,13 @@ int main(int argc, char** argv) { // -------------------------------------------------------------------------- // Logger initialization // Redefine for each paticular logger implementation - auto logger = std::unique_ptr(new logger::Log4CXXLogger("log4cxx.properties")); +#ifdef LOG4CXX_LOGGER + auto logger = std::unique_ptr( + new logger::Log4CXXLogger("log4cxx.properties")); +#else // LOG4CXX_LOGGER + auto logger = std::unique_ptr( + new logger::BoostLogger("boostlogconfig.ini")); +#endif // LOG4CXX_LOGGER auto logger_impl = std::unique_ptr(new logger::LoggerImpl()); logger::Logger::instance(logger_impl.get()); logger_impl->Init(std::move(logger)); -- cgit v1.2.1 From c15ef6c045540bbfcb43dba8533b70c21616c740 Mon Sep 17 00:00:00 2001 From: "Igor Gapchuk (GitHub)" <41586842+IGapchuk@users.noreply.github.com> Date: Tue, 4 May 2021 21:37:33 +0300 Subject: Fix core prematurely sends success for delete interaction choice set (#2601) * Fix core prematurely sends success for DeleteInteractionChoiceSet. DeleteInteractionChoiceSetRequest was contain implementation, according to that, SDL never not waits for HMI response and sends to Mobile response (success = true, resultCode = "SUCCESS"). This PR provides changes, that remove that implementation. Also, according to requirements, when at-least on of HMI VR_DeleteCommand response will contains any ERROR result code, except WARNINGS, SDL has to send response with that error code and success_result as false. And if on of HMI VR_DeleteCommand response will contains at-least one WARNINGS resulst_code, SDL has to send to Mobile response with WARNINGS and success_result as true. * Address review comments * fixup! Address review comments * Update src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc Co-authored-by: Collin Co-authored-by: Andrii Kalinich Co-authored-by: Collin --- .../mobile/delete_interaction_choice_set_request.h | 37 +++++++++ .../delete_interaction_choice_set_request.cc | 95 +++++++++++++++++++--- .../mobile/delete_interaction_choice_set_test.cc | 29 +++++-- 3 files changed, 140 insertions(+), 21 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h index c1d8759962..d5fa89c8be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h @@ -34,6 +34,9 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_INTERACTION_CHOICE_SET_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_INTERACTION_CHOICE_SET_REQUEST_H_ +#include +#include + #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" #include "utils/macro.h" @@ -43,6 +46,8 @@ namespace app_mngr = application_manager; namespace commands { +typedef std::set SentRequestsSet; + /** * @brief DeleteInteractionChoiceSetRequest command class **/ @@ -76,6 +81,20 @@ class DeleteInteractionChoiceSetRequest */ bool Init() FINAL; + /** + * @brief Interface method that is called whenever new event received + * Need to observe VR_DeleteCommand event, to send + * DeleteInteractionChoiceSetResponse when VR command was delete from HMI. + * @param event The received event. + */ + void on_event(const app_mngr::event_engine::Event& event) FINAL; + + /** + * @brief Function is called by RequestController when request execution time + * has exceed it's limit + */ + void onTimeOut() FINAL; + private: /* * @brief Check if requested choice set ID in use by perform interaction @@ -86,6 +105,24 @@ class DeleteInteractionChoiceSetRequest void SendVrDeleteCommand(app_mngr::ApplicationSharedPtr app); + void SendDeleteInteractionChoiceSetResponse(); + + /** + * @brief Final result_code for sending to Mobile. + */ + std::vector response_result_codes_; + + sync_primitives::Lock requests_lock_; + + /** + * @brief Collection that contains sent request to HMI. + * When HMI response will start come, that collection will helps to control, + * when SDL should sends DeleteInteractionChoiceSetResponse to Mobile. + * Because, for send DeleteInteractionChoiceSetResponse SDL should will be saw + * all response results from HMI. + */ + SentRequestsSet sent_requests_; + DISALLOW_COPY_AND_ASSIGN(DeleteInteractionChoiceSetRequest); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc index 3ff95a6f41..05347435d7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -55,7 +55,8 @@ DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , response_result_codes_() {} DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {} @@ -89,23 +90,49 @@ void DeleteInteractionChoiceSetRequest::Run() { return; } SendVrDeleteCommand(app); +} - smart_objects::SmartObject msg_params = - smart_objects::SmartObject(smart_objects::SmartType_Map); +bool DeleteInteractionChoiceSetRequest::Init() { + hash_update_mode_ = HashUpdateMode::kDoHashUpdate; + return true; +} - msg_params[strings::interaction_choice_set_id] = choice_set_id; - msg_params[strings::app_id] = app->app_id(); +void DeleteInteractionChoiceSetRequest::on_event( + const event_engine::Event& event) { + using namespace helpers; + SDL_LOG_AUTO_TRACE(); + + if (event.id() == hmi_apis::FunctionID::VR_DeleteCommand) { + const smart_objects::SmartObject& message = event.smart_object(); + const auto result_code = static_cast( + message[strings::params][hmi_response::code].asInt()); + response_result_codes_.push_back(result_code); + const std::uint32_t correlation_id = static_cast( + message[strings::params][strings::correlation_id].asUInt()); + + bool should_send_response = false; + { + sync_primitives::AutoLock auto_lock(requests_lock_); + auto found_request = sent_requests_.find(correlation_id); + if (sent_requests_.end() == found_request) { + SDL_LOG_WARN("Request with " << correlation_id + << " correlation_id is not found."); + return; + } - app->RemoveChoiceSet(choice_set_id); + sent_requests_.erase(found_request); + should_send_response = sent_requests_.empty(); + } - // Checking of HMI responses will be implemented with APPLINK-14600 - const bool result = true; - SendResponse(result, mobile_apis::Result::SUCCESS); + if (should_send_response) { + SendDeleteInteractionChoiceSetResponse(); + } + } } -bool DeleteInteractionChoiceSetRequest::Init() { - hash_update_mode_ = HashUpdateMode::kDoHashUpdate; - return true; +void DeleteInteractionChoiceSetRequest::onTimeOut() { + SDL_LOG_AUTO_TRACE(); + SendResponse(false, mobile_apis::Result::GENERIC_ERROR); } bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( @@ -157,12 +184,54 @@ void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand( msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice; msg_params[strings::grammar_id] = choice_set[strings::grammar_id]; choice_set = choice_set[strings::choice_set]; + + sync_primitives::AutoLock auto_lock(requests_lock_); for (uint32_t i = 0; i < choice_set.length(); ++i) { msg_params[strings::cmd_id] = choice_set[i][strings::choice_id]; - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); + const uint32_t delte_cmd_hmi_corr_id = SendHMIRequest( + hmi_apis::FunctionID::VR_DeleteCommand, &msg_params, true); + sent_requests_.insert(delte_cmd_hmi_corr_id); } } +void DeleteInteractionChoiceSetRequest:: + SendDeleteInteractionChoiceSetResponse() { + hmi_apis::Common_Result::eType result_code = + hmi_apis::Common_Result::INVALID_ENUM; + for (const auto& code : response_result_codes_) { + if (result_code == hmi_apis::Common_Result::INVALID_ENUM) { + result_code = code; + continue; + } + + if (!IsHMIResultSuccess(code)) { + result_code = code; + } + } + + const bool response_result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::InterfaceID::HMI_INTERFACE_VR); + + if (response_result) { + ApplicationSharedPtr app = + application_manager_.application(connection_key()); + if (!app) { + SDL_LOG_ERROR("Application with connection key " << connection_key() + << " did not find."); + return; + } + const uint32_t choice_set_id = + (*message_)[strings::msg_params][strings::interaction_choice_set_id] + .asUInt(); + app->RemoveChoiceSet(choice_set_id); + } + + SDL_LOG_DEBUG("Response sent. Result code: " << result_code + << " sussess: " << std::boolalpha + << result_code); + SendResponse(response_result, MessageHelper::HMIToMobileResult(result_code)); +} + } // namespace commands } // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc index dd4c6fd526..bd4c5c1ec6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc @@ -209,9 +209,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(invalid_choice_set_id)); - EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); - EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId)); - EXPECT_CALL(*app_, UpdateHash()); + EXPECT_CALL(*app_, app_id()).Times(0); } DeleteInteractionChoiceSetRequestPtr command = @@ -222,8 +220,13 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, } TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) { + using namespace application_manager; + using namespace event_engine; + (*message_)[am::strings::params][am::strings::connection_key] = kConnectionKey; + (*message_)[strings::params][hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] = kChoiceSetId; (*message_)[am::strings::msg_params][am::strings::grammar_id] = kGrammarId; @@ -232,6 +235,10 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) { smart_objects::SmartObject choice_set_id = (*message_)[am::strings::msg_params]; + application_manager::event_engine::Event event( + hmi_apis::FunctionID::VR_DeleteCommand); + event.set_smart_object(*message_); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillRepeatedly(Return(app_)); @@ -246,21 +253,27 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) { EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId)) .WillOnce(Return(choice_set_id)); - EXPECT_CALL(*app_, app_id()) - .WillOnce(Return(kConnectionKey)) - .WillOnce(Return(kConnectionKey)); + EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); + } + + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + + { + InSequence seq; EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId)); EXPECT_CALL(*app_, UpdateHash()); } - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(Return(true)); DeleteInteractionChoiceSetRequestPtr command = CreateCommand(message_); command->Init(); command->Run(); + + command->on_event(event); } TEST_F(DeleteInteractionChoiceSetResponseTest, Run_SuccessFalse_UNSUCCESS) { -- cgit v1.2.1 From d9fd9fb66ecd854207d8bbd5efb1728f1f6c1b5b Mon Sep 17 00:00:00 2001 From: Collin Date: Thu, 6 May 2021 13:10:07 -0400 Subject: reorder shutdown calls to prevent deadlock (#3691) --- src/appMain/life_cycle_impl.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/appMain/life_cycle_impl.cc b/src/appMain/life_cycle_impl.cc index a14ca1240c..8b67877ac8 100644 --- a/src/appMain/life_cycle_impl.cc +++ b/src/appMain/life_cycle_impl.cc @@ -264,15 +264,15 @@ void LifeCycleImpl::StopComponents() { DCHECK_OR_RETURN_VOID(hmi_handler_); hmi_handler_->set_message_observer(NULL); - DCHECK_OR_RETURN_VOID(connection_handler_); - connection_handler_->set_connection_handler_observer(NULL); - DCHECK_OR_RETURN_VOID(protocol_handler_); protocol_handler_->RemoveProtocolObserver(&(app_manager_->GetRPCHandler())); DCHECK_OR_RETURN_VOID(app_manager_); app_manager_->Stop(); + DCHECK_OR_RETURN_VOID(connection_handler_); + connection_handler_->set_connection_handler_observer(NULL); + SDL_LOG_INFO("Stopping Protocol Handler"); DCHECK_OR_RETURN_VOID(protocol_handler_); protocol_handler_->RemoveProtocolObserver(media_manager_); -- cgit v1.2.1 From 0cb74bf5a867a71ac760a8bd5c9c2b2af7faccf2 Mon Sep 17 00:00:00 2001 From: "Pavel Zhdanov (GitHub)" <39907184+ZhdanovP@users.noreply.github.com> Date: Fri, 7 May 2021 19:15:57 +0300 Subject: Add mobile response with disallowed by user params (#2499) * Add mobile responce with disallowed by user params * Answer PR comments * Answer PR comments * Update fix according to new hierarchy * fixup! Update fix according to new hierarchy * fixup! Update fix according to new hierarchy Co-authored-by: Andrii Kalinich Co-authored-by: Dmitriy Boltovskiy --- .../application_manager/commands/command_impl.h | 46 ++++++ .../commands/command_request_impl.h | 23 --- .../src/commands/command_impl.cc | 181 +++++++++++++++++++++ .../src/commands/command_request_impl.cc | 91 +---------- .../test/commands/command_request_impl_test.cc | 4 +- 5 files changed, 231 insertions(+), 114 deletions(-) diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index e3e30a9eff..1b4db7e888 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -40,6 +40,8 @@ #include "policy/policy_types.h" #include "utils/logger.h" +#include + namespace application_manager { /** @@ -50,6 +52,20 @@ struct CommandParametersPermissions { RPCParams allowed_params; RPCParams disallowed_params; RPCParams undefined_params; + + bool AreDisallowedParamsIncluded(const RPCParams& parameters) { + return std::includes(disallowed_params.begin(), + disallowed_params.end(), + parameters.begin(), + parameters.end()); + } + + bool AreUndefinedParamsIncluded(const RPCParams& parameters) { + return std::includes(undefined_params.begin(), + undefined_params.end(), + parameters.begin(), + parameters.end()); + } }; namespace commands { @@ -182,6 +198,29 @@ class CommandImpl : public Command { */ bool CheckAllowedParameters(const Command::CommandSource source); + /** + * @brief Adds disallowed parameters back to response with appropriate + * reasons + * @param response Response message, which should be extended with blocked + * parameters reasons + */ + void AddDisallowedParameters(smart_objects::SmartObject& response); + + /** + * @brief Adds disallowed parameters to response info + * @param response Response message, which info should be extended + */ + void AddDisallowedParametersToInfo( + smart_objects::SmartObject& response) const; + + /** + * @brief Adds param to disallowed parameters enumeration + * @param info string with disallowed params enumeration + * @param param disallowed param + */ + void AddDisallowedParameterToInfoString(std::string& info, + const std::string& param) const; + /** * @brief Remove from current message parameters disallowed by policy table */ @@ -201,6 +240,13 @@ class CommandImpl : public Command { */ bool ReplaceHMIWithMobileAppId(smart_objects::SmartObject& message); + /** + * @brief Adds disallowed parameters to info string, sets result codes if + * necessary + * @param response Command smart object + */ + void FormatResponse(smart_objects::SmartObject& response); + MessageSharedPtr message_; uint32_t default_timeout_; bool allowed_to_terminate_; diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index 87c19ca1d1..5723de3b08 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -242,14 +242,6 @@ class CommandRequestImpl : public CommandImpl, */ bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const; - /** - * @brief Adds disallowed parameters back to response with appropriate - * reasons - * @param response Response message, which should be extended with blocked - * parameters reasons - */ - void AddDisallowedParameters(smart_objects::SmartObject& response); - /** * @brief Checks if any request param was marked as disallowed by policy * @return true if any param was marked as disallowed @@ -375,21 +367,6 @@ class CommandRequestImpl : public CommandImpl, private: DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl); - /** - * @brief Adds param to disallowed parameters enumeration - * @param info string with disallowed params enumeration - * @param param disallowed param - */ - void AddDisallowedParameterToInfoString(std::string& info, - const std::string& param) const; - - /** - * @brief Adds disallowed parameters to response info - * @param response Response message, which info should be extended - */ - void AddDisallowedParametersToInfo( - smart_objects::SmartObject& response) const; - bool ProcessHMIInterfacesAvailability( const uint32_t hmi_correlation_id, const hmi_apis::FunctionID::eType& function_id); diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 47659e52ca..9efcaa451a 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -45,6 +45,26 @@ struct AppExtensionPredicate { return app ? (app->QueryInterface(uid).use_count() != 0) : false; } }; + +/** + * @brief Functor for build info string + */ +struct InfoAppender { + explicit InfoAppender(std::string& info) : info_(info) {} + + void operator()(const RPCParams::value_type& parameter) { + if (info_.empty()) { + info_ = "\'" + parameter + "\'"; + return; + } + + info_ = info_ + ", \'" + parameter + "\'"; + } + + private: + std::string& info_; +}; + } // namespace namespace commands { @@ -179,6 +199,25 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) { check_result, correlation_id(), app->app_id()); + + if (!params.empty()) { + if (parameters_permissions_.AreDisallowedParamsIncluded(params)) { + const std::string info = "RPC is disallowed by the user"; + SDL_LOG_DEBUG(info); + (*response)[strings::msg_params][strings::info] = info; + AddDisallowedParameters(*response); + } else if (parameters_permissions_.AreUndefinedParamsIncluded(params)) { + const std::string info = + "Requested parameters are disallowed by Policies"; + + SDL_LOG_DEBUG(info); + (*response)[strings::msg_params][strings::info] = info; + AddDisallowedParameters(*response); + } else { + FormatResponse(*response); + } + } + rpc_service_.SendMessageToMobile(response); } @@ -198,6 +237,143 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) { return true; } +struct DisallowedParamsInserter { + DisallowedParamsInserter(smart_objects::SmartObject& response, + mobile_apis::VehicleDataResultCode::eType code) + : response_(response), code_(code) {} + + bool operator()(const std::string& param) { + smart_objects::SmartObjectSPtr disallowed_param = + std::make_shared( + smart_objects::SmartType_Map); + + auto rpc_spec_vehicle_data = MessageHelper::vehicle_data(); + auto vehicle_data = rpc_spec_vehicle_data.find(param); + auto vehicle_data_type = + vehicle_data == rpc_spec_vehicle_data.end() + ? mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA + : vehicle_data->second; + + (*disallowed_param)[strings::data_type] = vehicle_data_type; + (*disallowed_param)[strings::result_code] = code_; + response_[strings::msg_params][param.c_str()] = *disallowed_param; + return true; + } + + private: + smart_objects::SmartObject& response_; + mobile_apis::VehicleDataResultCode::eType code_; +}; + +void CommandImpl::AddDisallowedParameters( + smart_objects::SmartObject& response) { + const mobile_apis::FunctionID::eType id = + static_cast(function_id()); + + if (!helpers:: + Compare( + id, + mobile_apis::FunctionID::SubscribeVehicleDataID, + mobile_apis::FunctionID::UnsubscribeVehicleDataID)) { + SDL_LOG_INFO("The function id: " << id << " is not supported."); + return; + } + + DisallowedParamsInserter disallowed_inserter( + response, mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED); + std::for_each(removed_parameters_permissions_.disallowed_params.begin(), + removed_parameters_permissions_.disallowed_params.end(), + disallowed_inserter); + + DisallowedParamsInserter undefined_inserter( + response, mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED); + std::for_each(removed_parameters_permissions_.undefined_params.begin(), + removed_parameters_permissions_.undefined_params.end(), + undefined_inserter); +} + +void CommandImpl::AddDisallowedParameterToInfoString( + std::string& info, const std::string& param) const { + // prepare disallowed params enumeration for response info string + if (info.empty()) { + info = "\'" + param + "\'"; + } else { + info = info + "," + " " + "\'" + param + "\'"; + } +} + +void CommandImpl::AddDisallowedParametersToInfo( + smart_objects::SmartObject& response) const { + SDL_LOG_AUTO_TRACE(); + const mobile_apis::FunctionID::eType id = + static_cast(function_id()); + + if (!helpers:: + Compare( + id, + mobile_apis::FunctionID::SubscribeVehicleDataID, + mobile_apis::FunctionID::UnsubscribeVehicleDataID, + mobile_apis::FunctionID::GetVehicleDataID, + mobile_apis::FunctionID::SendLocationID)) { + SDL_LOG_INFO("The function id: " << id << " is not supported."); + return; + } + + std::string disallowed_by_user_info; + InfoAppender user_info_appender(disallowed_by_user_info); + + std::for_each(removed_parameters_permissions_.disallowed_params.begin(), + removed_parameters_permissions_.disallowed_params.end(), + user_info_appender); + + const size_t min_number_of_disallowed_params = 1; + if (!disallowed_by_user_info.empty()) { + disallowed_by_user_info += + min_number_of_disallowed_params < + removed_parameters_permissions_.disallowed_params.size() + ? " are" + : " is"; + disallowed_by_user_info += " disallowed by user"; + } + + std::string disallowed_by_policy_info; + InfoAppender policy_info_appender(disallowed_by_policy_info); + + std::for_each(removed_parameters_permissions_.undefined_params.begin(), + removed_parameters_permissions_.undefined_params.end(), + policy_info_appender); + + const size_t min_number_of_undefined_params = 1; + if (!disallowed_by_policy_info.empty()) { + disallowed_by_policy_info += + min_number_of_undefined_params < + removed_parameters_permissions_.undefined_params.size() + ? " are" + : " is"; + disallowed_by_policy_info += " disallowed by policies"; + } + + if (disallowed_by_user_info.empty() && disallowed_by_policy_info.empty()) { + SDL_LOG_INFO("There are not disallowed by user or by policy parameters."); + return; + } + + smart_objects::SmartObject& info = + response[strings::msg_params][strings::info]; + + std::string summary; + if (!disallowed_by_policy_info.empty()) { + summary += disallowed_by_policy_info; + } + + if (!disallowed_by_user_info.empty()) { + summary = summary.empty() ? disallowed_by_user_info + : summary + ", " + disallowed_by_user_info; + } + + info = info.asString().empty() ? summary : info.asString() + " " + summary; +} + void CommandImpl::RemoveDisallowedParameters() { SDL_LOG_AUTO_TRACE(); @@ -275,6 +451,11 @@ bool CommandImpl::ReplaceMobileWithHMIAppId( return true; } +void CommandImpl::FormatResponse(smart_objects::SmartObject& response) { + AddDisallowedParametersToInfo(response); + AddDisallowedParameters(response); +} + bool CommandImpl::ReplaceHMIWithMobileAppId( ns_smart_device_link::ns_smart_objects::SmartObject& message) { if (message.keyExists(strings::app_id)) { diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 08bf25de54..bc4b514be4 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -138,34 +138,6 @@ bool IsResultCodeWarning(const ResponseInfo& first, return first_is_ok_second_is_warn || both_warnings; } -struct DisallowedParamsInserter { - DisallowedParamsInserter(smart_objects::SmartObject& response, - mobile_apis::VehicleDataResultCode::eType code) - : response_(response), code_(code) {} - - bool operator()(const std::string& param) { - smart_objects::SmartObjectSPtr disallowed_param = - std::make_shared( - smart_objects::SmartType_Map); - - auto rpc_spec_vehicle_data = MessageHelper::vehicle_data(); - auto vehicle_data = rpc_spec_vehicle_data.find(param); - auto vehicle_data_type = - vehicle_data == rpc_spec_vehicle_data.end() - ? mobile_apis::VehicleDataType::VEHICLEDATA_OEM_CUSTOM_DATA - : vehicle_data->second; - - (*disallowed_param)[strings::data_type] = vehicle_data_type; - (*disallowed_param)[strings::result_code] = code_; - response_[strings::msg_params][param.c_str()] = *disallowed_param; - return true; - } - - private: - smart_objects::SmartObject& response_; - mobile_apis::VehicleDataResultCode::eType code_; -}; - ResponseInfo::ResponseInfo() : result_code(hmi_apis::Common_Result::INVALID_ENUM) , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM) @@ -305,15 +277,7 @@ void CommandRequestImpl::SendResponse( // appropriate reasons (VehicleData result codes) if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED && result_code != mobile_apis::Result::INVALID_DATA) { - const mobile_apis::FunctionID::eType& id = - static_cast(function_id()); - if ((id == mobile_apis::FunctionID::SubscribeVehicleDataID) || - (id == mobile_apis::FunctionID::UnsubscribeVehicleDataID)) { - AddDisallowedParameters(response); - AddDisallowedParametersToInfo(response); - } else if (id == mobile_apis::FunctionID::GetVehicleDataID) { - AddDisallowedParametersToInfo(response); - } + FormatResponse(response); } response[strings::msg_params][strings::success] = success; @@ -721,59 +685,6 @@ bool CommandRequestImpl::CheckHMICapabilities( return false; } -void CommandRequestImpl::AddDisallowedParameterToInfoString( - std::string& info, const std::string& param) const { - // prepare disallowed params enumeration for response info string - if (info.empty()) { - info = "\'" + param + "\'"; - } else { - info = info + "," + " " + "\'" + param + "\'"; - } -} - -void CommandRequestImpl::AddDisallowedParametersToInfo( - smart_objects::SmartObject& response) const { - std::string info; - - RPCParams::const_iterator it = - removed_parameters_permissions_.disallowed_params.begin(); - for (; it != removed_parameters_permissions_.disallowed_params.end(); ++it) { - AddDisallowedParameterToInfoString(info, (*it)); - } - - it = removed_parameters_permissions_.undefined_params.begin(); - for (; it != removed_parameters_permissions_.undefined_params.end(); ++it) { - AddDisallowedParameterToInfoString(info, (*it)); - } - - if (!info.empty()) { - info += " disallowed by policies."; - - if (!response[strings::msg_params][strings::info].asString().empty()) { - // If we already have info add info about disallowed params to it - response[strings::msg_params][strings::info] = - response[strings::msg_params][strings::info].asString() + " " + info; - } else { - response[strings::msg_params][strings::info] = info; - } - } -} - -void CommandRequestImpl::AddDisallowedParameters( - smart_objects::SmartObject& response) { - DisallowedParamsInserter disallowed_inserter( - response, mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED); - std::for_each(removed_parameters_permissions_.disallowed_params.begin(), - removed_parameters_permissions_.disallowed_params.end(), - disallowed_inserter); - - DisallowedParamsInserter undefined_inserter( - response, mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED); - std::for_each(removed_parameters_permissions_.undefined_params.begin(), - removed_parameters_permissions_.undefined_params.end(), - undefined_inserter); -} - bool CommandRequestImpl::HasDisallowedParams() const { return ((!removed_parameters_permissions_.disallowed_params.empty()) || (!removed_parameters_permissions_.undefined_params.empty())); diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc index 9034bf442f..6470988680 100644 --- a/src/components/application_manager/test/commands/command_request_impl_test.cc +++ b/src/components/application_manager/test/commands/command_request_impl_test.cc @@ -454,7 +454,9 @@ TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) { vehicle_data.insert(am::VehicleData::value_type( kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); - MessageSharedPtr msg; + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::params][strings::function_id] = + mobile_apis::FunctionID::SubscribeVehicleDataID; CommandPtr command = CreateCommand(msg); -- cgit v1.2.1 From 353357f5d5c58fa2805bd44f598eb825275740d9 Mon Sep 17 00:00:00 2001 From: "Stanislav Kobziev (GitHub)" <43001407+SKobziev@users.noreply.github.com> Date: Tue, 11 May 2021 16:43:55 +0300 Subject: Remove some unused methods from MediaManager (#2774) * Deprecated redundant code * Remove unit tests for deprecated methods Co-authored-by: Andrii Kalinich --- src/components/include/media_manager/media_manager.h | 4 ++-- .../include/media_manager/media_manager_impl.h | 4 ++-- .../media_manager/test/media_manager_impl_test.cc | 15 --------------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/components/include/media_manager/media_manager.h b/src/components/include/media_manager/media_manager.h index 2d2201a949..1ecdb12257 100644 --- a/src/components/include/media_manager/media_manager.h +++ b/src/components/include/media_manager/media_manager.h @@ -42,8 +42,8 @@ namespace media_manager { class MediaManager { public: - virtual void PlayA2DPSource(int32_t application_key) = 0; - virtual void StopA2DPSource(int32_t application_key) = 0; + DEPRECATED virtual void PlayA2DPSource(int32_t application_key) = 0; + DEPRECATED virtual void StopA2DPSource(int32_t application_key) = 0; DEPRECATED virtual void StartMicrophoneRecording( int32_t application_key, diff --git a/src/components/media_manager/include/media_manager/media_manager_impl.h b/src/components/media_manager/include/media_manager/media_manager_impl.h index 3e24212ed5..f8e94cbbb2 100644 --- a/src/components/media_manager/include/media_manager/media_manager_impl.h +++ b/src/components/media_manager/include/media_manager/media_manager_impl.h @@ -60,8 +60,8 @@ class MediaManagerImpl : public MediaManager, const MediaManagerSettings& settings); virtual ~MediaManagerImpl(); - virtual void PlayA2DPSource(int32_t application_key); - virtual void StopA2DPSource(int32_t application_key); + DEPRECATED virtual void PlayA2DPSource(int32_t application_key); + DEPRECATED virtual void StopA2DPSource(int32_t application_key); DEPRECATED virtual void StartMicrophoneRecording( int32_t application_key, diff --git a/src/components/media_manager/test/media_manager_impl_test.cc b/src/components/media_manager/test/media_manager_impl_test.cc index ab0a9cf494..8cca2ad995 100644 --- a/src/components/media_manager/test/media_manager_impl_test.cc +++ b/src/components/media_manager/test/media_manager_impl_test.cc @@ -279,21 +279,6 @@ TEST_F(MediaManagerImplTest, Init_Settings_ExpectFileValue) { InitMediaManagerFileServerType(); } -TEST_F(MediaManagerImplTest, PlayA2DPSource_WithCorrectA2DP_SUCCESS) { - // media_adapter_mock_ will be deleted in media_manager_impl (dtor) - MockMediaAdapter* media_adapter_mock = new MockMediaAdapter(); - media_manager_impl_->set_mock_a2dp_player(media_adapter_mock); - EXPECT_CALL(*media_adapter_mock, StartActivity(kApplicationKey)); - media_manager_impl_->PlayA2DPSource(kApplicationKey); -} - -TEST_F(MediaManagerImplTest, StopA2DPSource_WithCorrectA2DP_SUCCESS) { - MockMediaAdapter* media_adapter_mock = new MockMediaAdapter(); - media_manager_impl_->set_mock_a2dp_player(media_adapter_mock); - EXPECT_CALL(*media_adapter_mock, StopActivity(kApplicationKey)); - media_manager_impl_->StopA2DPSource(kApplicationKey); -} - TEST_F(MediaManagerImplTest, StartMicrophoneRecording_SourceFileIsWritable_ExpectTrue) { StartMicrophoneCheckHelper(); -- cgit v1.2.1 From 8fa7c923fe0470bae8dc7201ea2118434ea12e14 Mon Sep 17 00:00:00 2001 From: Yurii Postolov <32772773+Ypostolov@users.noreply.github.com> Date: Tue, 11 May 2021 20:20:57 +0300 Subject: Fixed vrSynonyms and ttsName content in SystemRequest(QUERY_APPS) (#2705) * Fixed SDL sends appName in vrSynonyms and ttsName in case of lower and upper bound values in json file * Update src/components/application_manager/src/application_manager_impl.cc Co-authored-by: Shobhit Adlakha * Update src/components/application_manager/src/application_manager_impl.cc Co-authored-by: Shobhit Adlakha * ttsName is defined as array Co-authored-by: Dmitriy Boltovskiy Co-authored-by: Shobhit Adlakha Co-authored-by: yurii --- .../application_manager/src/application_manager_impl.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 7a12db09ff..d2104dbf1a 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -2772,8 +2772,16 @@ void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data, if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists( json::ttsName)) { SDL_LOG_DEBUG("Get ttsName from " << cur_vr_lang << " language"); - ttsName = + ttsName = SmartObject(SmartType_Array); + ttsName[0] = app_data[json::languages][specific_idx][cur_vr_lang][json::ttsName]; + + } else if (app_data[json::languages][default_idx][json::default_].keyExists( + json::ttsName)) { + SDL_LOG_DEBUG("Get ttsName from default language"); + ttsName = SmartObject(SmartType_Array); + ttsName[0] = + app_data[json::languages][default_idx][json::default_][json::ttsName]; } else { SDL_LOG_DEBUG("No data for ttsName for " << cur_vr_lang << " language"); } @@ -2783,6 +2791,11 @@ void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data, SDL_LOG_DEBUG("Get vrSynonyms from " << cur_vr_lang << " language"); vrSynonym = app_data[json::languages][specific_idx][cur_vr_lang][json::vrSynonyms]; + } else if (app_data[json::languages][default_idx][json::default_].keyExists( + json::vrSynonyms)) { + SDL_LOG_DEBUG("Get vrSynonyms from default language"); + vrSynonym = app_data[json::languages][default_idx][json::default_] + [json::vrSynonyms]; } else { SDL_LOG_DEBUG("No data for vrSynonyms for " << cur_vr_lang << " language"); } -- cgit v1.2.1 From 13fec751d8216b218f49c0b039b67624c7265b50 Mon Sep 17 00:00:00 2001 From: Collin Date: Thu, 13 May 2021 10:38:56 -0400 Subject: Only call Json::Value::operator[] if PTU value is object type (#3699) * only call Json::Value::operator[] if it is object type * short object check * validate value[data].isArray() --- src/components/policy/policy_regular/src/policy_manager_impl.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index b6101eb960..4f2e5043d2 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -112,7 +112,7 @@ std::shared_ptr PolicyManagerImpl::ParseArray( if (reader.parse(json, &value)) { // For PT Update received from SDL Server. - if (value["data"].size() != 0) { + if (value.isObject() && value["data"].isArray() && !value["data"].empty()) { Json::Value data = value["data"]; return std::make_shared(&data[0]); } else { -- cgit v1.2.1 From bb291d109aca3cc441c9e21c85d111a82bb5ad1b Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 13 May 2021 15:33:05 -0400 Subject: Append LD_LIBRARY_PATH in daemon.sh (#3702) * Append LD_LIBRARY_PATH in daemon.sh * Update src/appMain/daemon.sh Co-authored-by: Jacob Keeler Co-authored-by: Jacob Keeler --- src/appMain/daemon.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/appMain/daemon.sh b/src/appMain/daemon.sh index fbde0d750a..04431de039 100644 --- a/src/appMain/daemon.sh +++ b/src/appMain/daemon.sh @@ -19,7 +19,7 @@ function core_start() { return 2 else echo "Starting SmartDeviceLink Core" - LD_LIBRARY_PATH=$DIR ${DIR}/${CORE_APPLICATION_NAME} & + ${DIR}/${CORE_APPLICATION_NAME} & CORE_PID=$! echo $CORE_PID > $CORE_PID_FILE return 0 -- cgit v1.2.1 From 84b0746527f58ab412cf6ba9205e1467dfcf0c6f Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Fri, 14 May 2021 14:22:19 -0400 Subject: Remove logic sending invalid slider position (#3697) sliderPosition was set to 0 (an invalid value) in the mobile response if an ABORTED result was received from the HMI without this parameter. --- .../sdl_rpc_plugin/src/commands/mobile/slider_request.cc | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc index e46d3fd7f0..22935e2136 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc @@ -153,21 +153,6 @@ void SliderRequest::on_event(const event_engine::Event& event) { SmartObject response_msg_params = message[strings::msg_params]; - const bool is_timeout_aborted = Compare( - response_code, Common_Result::TIMED_OUT, Common_Result::ABORTED); - - if (is_timeout_aborted) { - if (message[strings::params][strings::data].keyExists( - strings::slider_position)) { - // Copy slider_position info to msg_params section - response_msg_params[strings::slider_position] = - message[strings::params][strings::data][strings::slider_position]; - } else { - SDL_LOG_ERROR(strings::slider_position << " field is absent" - " in response."); - response_msg_params[strings::slider_position] = 0; - } - } std::string response_info; GetInfo(message, response_info); const bool is_response_success = PrepareResultForMobileResponse( -- cgit v1.2.1 From 03c951b5f76cbc855e2ebbc412307ce4de446b92 Mon Sep 17 00:00:00 2001 From: Collin Date: Thu, 20 May 2021 14:34:30 -0400 Subject: when non-existent app sends request reply app not registered (#3705) * when non-existant app sends request reply app not registered * fix unit tests --- src/components/application_manager/src/commands/command_impl.cc | 6 ++++++ .../application_manager/test/commands/command_request_impl_test.cc | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 9efcaa451a..25bbffecf6 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -159,6 +159,12 @@ bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) { "There is no registered application with " "connection key '" << connection_key() << "'"); + + rpc_service_.SendMessageToMobile(MessageHelper::CreateNegativeResponse( + connection_key(), + function_id(), + correlation_id(), + mobile_apis::Result::APPLICATION_NOT_REGISTERED)); return false; } diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc index 6470988680..7beda06d8a 100644 --- a/src/components/application_manager/test/commands/command_request_impl_test.cc +++ b/src/components/application_manager/test/commands/command_request_impl_test.cc @@ -363,6 +363,9 @@ TEST_F(CommandRequestImplTest, MessageSharedPtr message = CreateMessage(); CommandPtr command = CreateCommand(message); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr())); + MessageSharedPtr dummy_msg(CreateMessage()); + EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) + .WillOnce(Return(dummy_msg)); EXPECT_FALSE(command->CheckPermissions()); } -- cgit v1.2.1 From b212a12f90934e2c32603c922538acbacbb5bb6d Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Thu, 20 May 2021 17:13:45 -0400 Subject: Fix saving to endpoint properties table (#3704) `EndpointProperty.version` is defined as an optional value, but was being used as a mandatory one. Also makes `service` property unique in `endpoint_properties` to prevent duplicate entries --- src/components/policy/policy_external/src/sql_pt_queries.cc | 4 ++-- .../policy/policy_external/src/sql_pt_representation.cc | 12 +++++++++--- src/components/policy/policy_regular/src/sql_pt_queries.cc | 4 ++-- .../policy/policy_regular/src/sql_pt_representation.cc | 12 +++++++++--- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc index 519e51dde5..c5fc3a9e92 100644 --- a/src/components/policy/policy_external/src/sql_pt_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_queries.cc @@ -400,8 +400,8 @@ const std::string kCreateSchema = " ON `endpoint`(`application_id` COLLATE NOCASE); " /*endpoint properties*/ "CREATE TABLE IF NOT EXISTS `endpoint_properties`( " - " `service` VARCHAR(100) NOT NULL, " - " `version` VARCHAR(100) NOT NULL " + " `service` VARCHAR(100) PRIMARY KEY NOT NULL, " + " `version` VARCHAR(100) " ");" "CREATE TABLE IF NOT EXISTS `message`( " " `id` INTEGER PRIMARY KEY NOT NULL, " diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index d4458ef2a5..3309893db0 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -530,9 +530,13 @@ void SQLPTRepresentation::GatherModuleConfig( } else { while (endpoint_properties.Next()) { const std::string& service = endpoint_properties.GetString(0); - const std::string& version = endpoint_properties.GetString(1); auto& ep_properties = (*config->endpoint_properties); - *ep_properties[service].version = version; + if (!endpoint_properties.IsNull(1)) { + const std::string& version = endpoint_properties.GetString(1); + *ep_properties[service].version = version; + } else { + ep_properties[service].version = rpc::Optional >(); + } } } @@ -1581,7 +1585,9 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( for (auto& endpoint_property : endpoint_properties) { query.Bind(0, endpoint_property.first); - query.Bind(1, endpoint_property.second.version); + endpoint_property.second.version.is_initialized() + ? query.Bind(1, *endpoint_property.second.version) + : query.Bind(1); if (!query.Exec() || !query.Reset()) { SDL_LOG_WARN( diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc index ea0b7fe997..a58867966c 100644 --- a/src/components/policy/policy_regular/src/sql_pt_queries.cc +++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc @@ -371,8 +371,8 @@ const std::string kCreateSchema = /*endpoint properties*/ "CREATE TABLE IF NOT EXISTS `endpoint_properties`( " - " `service` VARCHAR(100) NOT NULL, " - " `version` VARCHAR(100) NOT NULL " + " `service` VARCHAR(100) PRIMARY KEY NOT NULL, " + " `version` VARCHAR(100) " ");" "CREATE TABLE IF NOT EXISTS `message`( " diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index 57781ae16f..1f24ca9472 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -519,9 +519,13 @@ void SQLPTRepresentation::GatherModuleConfig( } else { while (endpoint_properties.Next()) { const std::string& service = endpoint_properties.GetString(0); - const std::string& version = endpoint_properties.GetString(1); auto& ep_properties = (*config->endpoint_properties); - *ep_properties[service].version = version; + if (!endpoint_properties.IsNull(1)) { + const std::string& version = endpoint_properties.GetString(1); + *ep_properties[service].version = version; + } else { + ep_properties[service].version = rpc::Optional >(); + } } } @@ -1546,7 +1550,9 @@ bool SQLPTRepresentation::SaveServiceEndpointProperties( for (auto& endpoint_property : endpoint_properties) { query.Bind(0, endpoint_property.first); - query.Bind(1, endpoint_property.second.version); + endpoint_property.second.version.is_initialized() + ? query.Bind(1, *endpoint_property.second.version) + : query.Bind(1); if (!query.Exec() || !query.Reset()) { SDL_LOG_WARN( -- cgit v1.2.1 From 055bd3c4791ca73f9f6c70970119a92b864684f8 Mon Sep 17 00:00:00 2001 From: Collin Date: Fri, 21 May 2021 10:29:36 -0400 Subject: manage schema objects in each API class to allow for recursive objects in the API without leaking memory (#3703) --- .../src/custom_vehicle_data_manager_impl.cc | 8 ++--- .../include/smart_objects/array_schema_item.h | 15 ++++++++- .../include/smart_objects/object_schema_item.h | 11 ++++++- .../smart_objects/src/array_schema_item.cc | 19 ++++++++++- .../smart_objects/src/object_schema_item.cc | 31 ++++++++++++++---- .../generator/generators/SmartFactoryBase.py | 38 +++++++++------------- 6 files changed, 84 insertions(+), 38 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc index c1cf905e31..39d20cf67d 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/custom_vehicle_data_manager_impl.cc @@ -294,10 +294,8 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() { case SMemberType::SMEMBER_VDR_MOBILE: { // valid since struct_schema_items is not used in // InitStructSchemaItem_VehicleDataResult - mobile_apis::MOBILE_API::TStructsSchemaItems mobile_struct_schema_items; auto member_schema = - mobile_apis::MOBILE_API::InitStructSchemaItem_VehicleDataResult( - mobile_struct_schema_items); + mobile_apis::MOBILE_API::InitStructSchemaItem_VehicleDataResult(); return SMember( member_schema, false, // root level items should not be mandatory @@ -330,10 +328,8 @@ void CustomVehicleDataManagerImpl::UpdateVehicleDataItems() { case SMemberType::SMEMBER_VDR_HMI: { // valid since struct_schema_items is not used in // InitStructSchemaItem_Common_VehicleDataResult - hmi_apis::HMI_API::TStructsSchemaItems hmi_struct_schema_items; auto member_schema = - hmi_apis::HMI_API::InitStructSchemaItem_Common_VehicleDataResult( - hmi_struct_schema_items); + hmi_apis::HMI_API::InitStructSchemaItem_Common_VehicleDataResult(); return SMember( member_schema, false // root level items should not be mandatory ); diff --git a/src/components/smart_objects/include/smart_objects/array_schema_item.h b/src/components/smart_objects/include/smart_objects/array_schema_item.h index 8f9a179fff..43870ddb42 100644 --- a/src/components/smart_objects/include/smart_objects/array_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/array_schema_item.h @@ -63,6 +63,13 @@ class CArraySchemaItem : public ISchemaItem { const TSchemaItemParameter& MaxSize = TSchemaItemParameter()); + static std::shared_ptr create( + ISchemaItem* ElementSchemaItem, + const TSchemaItemParameter& MinSize = + TSchemaItemParameter(), + const TSchemaItemParameter& MaxSize = + TSchemaItemParameter()); + /** * @brief Validate smart object. * @param Object Object to validate. @@ -131,10 +138,16 @@ class CArraySchemaItem : public ISchemaItem { const TSchemaItemParameter& MinSize, const TSchemaItemParameter& MaxSize); + CArraySchemaItem(ISchemaItem* ElementSchemaItem, + const TSchemaItemParameter& MinSize, + const TSchemaItemParameter& MaxSize); + /** * @brief SchemaItem for array elements. **/ - const ISchemaItemPtr mElementSchemaItem; + ISchemaItem* mElementSchemaItem; + const ISchemaItemPtr mElementSchemaItemShared; + /** * @brief Minimum allowed size. **/ diff --git a/src/components/smart_objects/include/smart_objects/object_schema_item.h b/src/components/smart_objects/include/smart_objects/object_schema_item.h index d5c8a7f3e9..0a971d50ee 100644 --- a/src/components/smart_objects/include/smart_objects/object_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/object_schema_item.h @@ -69,6 +69,14 @@ struct SMember { const bool IsRemoved = false, const std::vector& history_vector = {}); + SMember(ISchemaItem* SchemaItem, + const bool IsMandatory = true, + const std::string& Since = "", + const std::string& Until = "", + const bool IsDeprecated = false, + const bool IsRemoved = false, + const std::vector& history_vector = {}); + /** * @brief Checks the version a parameter was removed (until) * If the mobile's msg version is greater than or @@ -79,7 +87,8 @@ struct SMember { /** * @brief Member schema item. **/ - ISchemaItemPtr mSchemaItem; + ISchemaItem* mSchemaItem; + ISchemaItemPtr mSchemaItemShared; /** * @brief true if member is mandatory, false otherwise. **/ diff --git a/src/components/smart_objects/src/array_schema_item.cc b/src/components/smart_objects/src/array_schema_item.cc index fd8f3ce71d..6f1e65d2eb 100644 --- a/src/components/smart_objects/src/array_schema_item.cc +++ b/src/components/smart_objects/src/array_schema_item.cc @@ -44,6 +44,14 @@ std::shared_ptr CArraySchemaItem::create( new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize)); } +std::shared_ptr CArraySchemaItem::create( + ISchemaItem* ElementSchemaItem, + const TSchemaItemParameter& MinSize, + const TSchemaItemParameter& MaxSize) { + return std::shared_ptr( + new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize)); +} + errors::eType CArraySchemaItem::validate( const SmartObject& Object, rpc::ValidationReport* report, @@ -161,10 +169,19 @@ TypeID CArraySchemaItem::GetType() { return TYPE_ARRAY; } -CArraySchemaItem::CArraySchemaItem(const ISchemaItemPtr ElementSchemaItem, +CArraySchemaItem::CArraySchemaItem(ISchemaItem* ElementSchemaItem, const TSchemaItemParameter& MinSize, const TSchemaItemParameter& MaxSize) : mElementSchemaItem(ElementSchemaItem) + , mElementSchemaItemShared(nullptr) + , mMinSize(MinSize) + , mMaxSize(MaxSize) {} + +CArraySchemaItem::CArraySchemaItem(const ISchemaItemPtr ElementSchemaItem, + const TSchemaItemParameter& MinSize, + const TSchemaItemParameter& MaxSize) + : mElementSchemaItem(ElementSchemaItem.get()) + , mElementSchemaItemShared(ElementSchemaItem) , mMinSize(MinSize) , mMaxSize(MaxSize) {} diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc index d22f1692c8..4b14d9e5a1 100644 --- a/src/components/smart_objects/src/object_schema_item.cc +++ b/src/components/smart_objects/src/object_schema_item.cc @@ -51,19 +51,21 @@ namespace ns_smart_device_link { namespace ns_smart_objects { SMember::SMember() - : mSchemaItem(CAlwaysFalseSchemaItem::create()) - , mIsMandatory(true) - , mIsDeprecated(false) - , mIsRemoved(false) {} + : mIsMandatory(true), mIsDeprecated(false), mIsRemoved(false) { + mSchemaItemShared = CAlwaysFalseSchemaItem::create(); + mSchemaItem = mSchemaItemShared.get(); +} -SMember::SMember(const ISchemaItemPtr SchemaItem, +SMember::SMember(ISchemaItem* SchemaItem, const bool IsMandatory, const std::string& Since, const std::string& Until, const bool IsDeprecated, const bool IsRemoved, const std::vector& history_vector) - : mSchemaItem(SchemaItem), mIsMandatory(IsMandatory) { + : mSchemaItem(SchemaItem) + , mSchemaItemShared(nullptr) + , mIsMandatory(IsMandatory) { if (Since.size() > 0) { utils::SemanticVersion since_struct(Since); if (since_struct.isValid()) { @@ -81,6 +83,23 @@ SMember::SMember(const ISchemaItemPtr SchemaItem, mHistoryVector = history_vector; } +SMember::SMember(const ISchemaItemPtr SchemaItem, + const bool IsMandatory, + const std::string& Since, + const std::string& Until, + const bool IsDeprecated, + const bool IsRemoved, + const std::vector& history_vector) + : SMember(SchemaItem.get(), + IsMandatory, + Since, + Until, + IsDeprecated, + IsRemoved, + history_vector) { + mSchemaItemShared = SchemaItem; +} + bool SMember::CheckHistoryFieldVersion( const utils::SemanticVersion& MessageVersion) const { if (MessageVersion.isValid()) { diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py index 736a95f7ac..69e8d71428 100755 --- a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py +++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py @@ -785,6 +785,7 @@ class CodeGenerator(object): result_array.append(self._impl_code_item_decl_template.substitute( comment="", var_name=self._gen_schema_item_var_name(item), + var_type="std::shared_ptr", item_decl=self._impl_function_schema)) result_array.append(self._gen_function_history_vector_item_fill(item, member.name)) count += 1 @@ -811,6 +812,7 @@ class CodeGenerator(object): return self._impl_code_item_decl_template.substitute( comment=self._gen_comment(member, False), var_name=self._gen_schema_item_var_name(member), + var_type="ISchemaItem*" if type(member.param_type) is Struct else "std::shared_ptr", item_decl=self._gen_schema_item_decl_code( member.param_type, member.name, @@ -1724,11 +1726,11 @@ class CodeGenerator(object): u'''\n''' u'''using namespace ns_smart_device_link::ns_smart_objects;\n''' u'''\n''' + u'''$namespace::$class_name::TStructsSchemaItems $namespace::$class_name::struct_schema_items = {};\n\n''' u'''$namespace::$class_name::$class_name()\n''' u''' : ns_smart_device_link::ns_json_handler::CSmartFactory() {\n''' - u''' TStructsSchemaItems struct_schema_items;\n''' - u''' InitStructSchemes(struct_schema_items);\n''' + u''' InitStructSchemes();\n''' u'''\n''' u''' std::set function_id_items;\n''' u'''${function_id_items}''' @@ -1736,7 +1738,7 @@ class CodeGenerator(object): u''' std::set message_type_items;\n''' u'''${message_type_items}''' u'''\n''' - u''' InitFunctionSchemes(struct_schema_items, function_id_items, ''' + u''' InitFunctionSchemes(function_id_items, ''' u'''message_type_items);\n''' u'''}\n''' u'''\n''' @@ -1780,13 +1782,11 @@ class CodeGenerator(object): u''' InitFunctionSchema(function_id, message_type);\n''' u'''}\n''' u'''\n''' - u'''void $namespace::$class_name::InitStructSchemes(\n''' - u''' TStructsSchemaItems &struct_schema_items) {''' + u'''void $namespace::$class_name::InitStructSchemes() {''' u'''$struct_schema_items''' u'''}\n''' u'''\n''' u'''void $namespace::$class_name::InitFunctionSchemes(\n''' - u''' const TStructsSchemaItems &struct_schema_items,\n''' u''' const std::set &function_id_items,\n''' u''' const std::set &message_type_items) {\n''' u'''$pre_function_schemas''' @@ -1797,8 +1797,6 @@ class CodeGenerator(object): u''' const FunctionID::eType &function_id,\n''' u''' const messageType::eType &message_type) {\n''' u'''\n''' - u''' TStructsSchemaItems struct_schema_items;\n''' - u''' InitStructSchemes(struct_schema_items);\n''' u'''\n''' u''' std::set function_id_items { function_id };\n''' u''' std::set message_type_items { message_type };\n''' @@ -1873,13 +1871,13 @@ class CodeGenerator(object): u''' ns_smart_device_link::ns_json_handler::SmartSchemaKey shema_key(function_id, message_type);\n''' u''' functions_schemes_[shema_key] = ''' u'''InitFunction_${function_id}_${message_type}(''' - u'''struct_schema_items, function_id_items, message_type_items);\n''' + u'''function_id_items, message_type_items);\n''' u''' break;\n''' u'''}\n''') _struct_schema_item_template = string.Template( u'''std::shared_ptr struct_schema_item_${name} = ''' - u'''InitStructSchemaItem_${name}(struct_schema_items);\n''' + u'''InitStructSchemaItem_${name}();\n''' u'''structs_schemes_.insert(std::make_pair(''' u'''StructIdentifiers::${name}, CSmartSchema(''' u'''struct_schema_item_${name})));\n''') @@ -1890,12 +1888,11 @@ class CodeGenerator(object): u'''SmartSchemaKey''' u'''(FunctionID::$function_id, messageType::$message_type), ''' u'''InitFunction_${function_id}_${message_type}(''' - u'''struct_schema_items, function_id_items, message_type_items)));''') + u'''function_id_items, message_type_items)));''') _struct_impl_template = string.Template( u'''std::shared_ptr $namespace::$class_name::''' - u'''InitStructSchemaItem_${struct_name}(\n''' - u''' TStructsSchemaItems &struct_schema_items) {\n''' + u'''InitStructSchemaItem_${struct_name}() {\n''' u'''$code''' u'''}\n''') @@ -1932,7 +1929,7 @@ class CodeGenerator(object): _impl_code_item_decl_template = string.Template( u'''${comment}''' - u'''std::shared_ptr ${var_name} = ${item_decl};''') + u'''${var_type} ${var_name} = ${item_decl};''') _impl_code_shared_ptr_vector_template = string.Template( u'''std::vector ${var_name}_history_vector;''') @@ -1954,7 +1951,7 @@ class CodeGenerator(object): _impl_code_struct_item_template = string.Template( u'''ProvideObjectSchemaItemForStruct(struct_schema_items, ''' - u'''StructIdentifiers::${name})''') + u'''StructIdentifiers::${name}).get()''') _impl_code_enum_item_template = string.Template( u'''TEnumSchemaItem<${type}::eType>::create(${params})''') @@ -1988,7 +1985,6 @@ class CodeGenerator(object): _function_impl_template = string.Template( u'''CSmartSchema $namespace::$class_name::''' u'''InitFunction_${function_id}_${message_type}(\n''' - u''' const TStructsSchemaItems &struct_schema_items,\n''' u''' const std::set &function_id_items,\n''' u''' const std::set &message_type_items) {\n''' u'''$code''' @@ -2066,20 +2062,17 @@ class CodeGenerator(object): u''' /**\n''' u''' * @brief Initializes all struct schemes.\n''' u''' */\n''' - u''' void InitStructSchemes(''' - u'''TStructsSchemaItems &struct_schema_items);\n''' + u''' void InitStructSchemes();\n''' u'''\n''' u''' /**\n''' u''' * @brief Initializes all function schemes.\n''' u''' *\n''' - u''' * @param struct_schema_items Struct schema items.\n''' u''' * @param function_id_items Set of all elements ''' u'''of FunctionID enum.\n''' u''' * @param message_type_items Set of all elements ''' u'''of messageType enum.\n''' u''' */\n''' u''' void InitFunctionSchemes(\n''' - u''' const TStructsSchemaItems &struct_schema_items,\n''' u''' const std::set &function_id_items,\n''' u''' const std::set ''' u'''&message_type_items);\n''' @@ -2097,6 +2090,7 @@ class CodeGenerator(object): u'''$init_function_decls''' u'''\n''' u''' public:\n''' + u''' static TStructsSchemaItems struct_schema_items;\n''' u'''$init_struct_decls''' u'''};''') @@ -2107,7 +2101,6 @@ class CodeGenerator(object): u'''$comment\n''' u'''static ns_smart_device_link::ns_smart_objects::CSmartSchema ''' u'''InitFunction_${function_id}_${message_type}(\n''' - u''' const TStructsSchemaItems &struct_schema_items,\n''' u''' const std::set &function_id_items,\n''' u''' const std::set &message_type_items);''') @@ -2115,8 +2108,7 @@ class CodeGenerator(object): u'''$comment\n''' u'''static ''' u'''std::shared_ptr ''' - u'''InitStructSchemaItem_${struct_name}(\n''' - u''' TStructsSchemaItems &struct_schema_items);''') + u'''InitStructSchemaItem_${struct_name}();\n''') _class_comment_template = string.Template( u'''/**\n''' -- cgit v1.2.1 From 9ac9acdec6d82b280fca5286549ea904e7bc8b4c Mon Sep 17 00:00:00 2001 From: JackLivio Date: Fri, 21 May 2021 10:42:33 -0400 Subject: Feature/GitHub actions ci (#3701) * Test github action * Build Core * Fix path * Add submodules * Move path * Debug policy cmake paths * Debug lines * Change build directory * Print sources * Change core path * ls debug * Log cmake version * Try ubuntu 18 * Set Cmake version * Change cmake depdency * Remove version wildcard * Debug collect sources * More debug messages * Check filtered files * Remove bad policy path exclude * Try caching 3rd party * Fix env var * Update 3rd party path * Fix path * Remove env var * Fix space * Update path * Update core path * Fix boost install path * Add 3rd party arch path * Set LD_LIBRARY_PATH * Add check style * Fix cache path * Update README badge status * Move 3rd party build path * Remove Travis * Move cache call earlier * Fix syntax * Conditional mkdir * Add debug line * Add logs * Fix syntax * Fix syntax * Remove log lines * Use boost logger * Update cache * Remove -j * Top level boost include * Adjust boost includes * Remove boost logger * Invalidate cache * Update CMakeLists.txt * Update CMakeLists.txt * Update CMakeLists.txt * Update CMakeLists.txt * Update sdl_core_github_ci.yml * Update CMakeLists.txt * Update CMakeLists.txt * Update CMakeLists.txt * Add pull request action --- .github/workflows/sdl_core_github_ci.yml | 44 ++++++++++++++++++++++ .travis.yml | 32 ---------------- CMakeLists.txt | 5 +++ README.md | 7 ++-- .../policy/policy_regular/CMakeLists.txt | 3 +- 5 files changed, 54 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/sdl_core_github_ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/sdl_core_github_ci.yml b/.github/workflows/sdl_core_github_ci.yml new file mode 100644 index 0000000000..d5700e8331 --- /dev/null +++ b/.github/workflows/sdl_core_github_ci.yml @@ -0,0 +1,44 @@ +name: SDL Core Build +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - name: Init Submodules + run: git -C ${{ github.workspace }} submodule update --init --recursive + # Install Dependencies + - name: Apt Get Dependencies + run: sudo apt-get update && sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools && sudo apt-get install -f clang-format-6.0 + - name: Setup CMAKE + uses: jwlawson/actions-setup-cmake@v1.8 + with: + cmake-version: '3.16.3' + # Check Style + - name: Check Style + run: ${{ github.workspace }}/tools/infrastructure/check_style.sh + # Build Project + - name: Cache 3rd Party + id: core-3rd-party + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/core_3rd_party + key: ${{ runner.os }}-core-3rd-party-v3 + - name: Make 3rd Party Directory + if: steps.core-3rd-party.outputs.cache-hit != 'true' + run: mkdir ${{ github.workspace }}/core_3rd_party + - name: Make Directories + run: cd ${{ github.workspace }} && cd ../ && mkdir build && cd build + - name: Set 3rd Party Path + run: echo "THIRD_PARTY_INSTALL_PREFIX=${{ github.workspace }}/core_3rd_party" >> $GITHUB_ENV + - name: Set 3rd Party ARCH Path + run: echo "THIRD_PARTY_INSTALL_PREFIX_ARCH=${{ github.workspace }}/core_3rd_party" >> $GITHUB_ENV + - name: Configure + run: cmake ../sdl_core -DBUILD_TESTS=ON -DLOGGER_NAME=BOOST + - name: Build + run: make install-3rd_party && make -j `nproc` install + - name: Set Library Path + run: echo "LD_LIBRARY_PATH=$THIRD_PARTY_INSTALL_PREFIX/lib:." >> $GITHUB_ENV + # run tests + - name: Unit Tests + run: make test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d180ba2a85..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: cpp -dist: focal -sudo: required -only: - - master - - develop - - \/feature\/.+ - - \/fix\/.+ - - \/hotfix\/.+ - - \/release\/.+ - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - -before_install: - - sudo apt-get update - - sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools - - sudo apt-get install -f clang-format-6.0 - -script: - - cppcheck --force -isrc/3rd_party -isrc/3rd_party-static --library=googletest --suppress=unknownMacro --suppress=syntaxError:*_test.cc --quiet --error-exitcode=1 src - - ./tools/infrastructure/check_style.sh - - mkdir build && cd build - - cmake ../ -DBUILD_TESTS=ON - - make install-3rd_party && make -j `nproc` install && sudo ldconfig && make test -env: - global: - - LC_CTYPE=en_US.UTF-8 - - CTEST_OUTPUT_ON_FAILURE=TRUE - - LD_LIBRARY_PATH=. diff --git a/CMakeLists.txt b/CMakeLists.txt index 844319ed62..07e5bd5b56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -444,6 +444,11 @@ if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") include_directories ( ${LOG4CXX_INCLUDE_DIRECTORY} ) endif() +if(ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "BOOST") + message(STATUS "Including boost") + include_directories ( ${BOOST_INCLUDE_DIR} ) +endif() + if(ENABLE_SECURITY) add_definitions(-DENABLE_SECURITY) set(SecurityManagerLibrary SecurityManager) diff --git a/README.md b/README.md index 3bc7781268..6f346729b1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ [![Slack Status](http://sdlslack.herokuapp.com/badge.svg)](http://slack.smartdevicelink.com) -[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/badge/icon?subject=UT%20coverage%20build)](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/) -[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/badge/icon?subject=Smoke%20tests)](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/) -[![Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/badge/icon?subject=Coding%20style)](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/) +[![Github Actions Build Status](https://github.com/smartdevicelink/sdl_core/actions/workflows/sdl_core_github_ci.yml/badge.svg)](https://github.com/smartdevicelink/sdl_core/actions/workflows/sdl_core_github_ci.yml) +[![Jenkins Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/badge/icon?subject=UT%20coverage%20build)](https://opensdl-jenkins.prjdmz.luxoft.com/job/develop_weekly_coverage/) +[![Jenkins Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/badge/icon?subject=Smoke%20tests)](https://opensdl-jenkins.prjdmz.luxoft.com/view/Smokes/job/Develop_TCP_ATF_Smoke_P/) +[![Jenkins Build Status](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/badge/icon?subject=Coding%20style)](https://opensdl-jenkins.prjdmz.luxoft.com/job/Develop_SDL_Checkstyle/) # SmartDeviceLink (SDL) diff --git a/src/components/policy/policy_regular/CMakeLists.txt b/src/components/policy/policy_regular/CMakeLists.txt index 85ba86cfba..39c520a0e3 100644 --- a/src/components/policy/policy_regular/CMakeLists.txt +++ b/src/components/policy/policy_regular/CMakeLists.txt @@ -85,7 +85,6 @@ generate_policy_types("${GENERATED_HMI_POLICY_TYPES}" set(POLICY_TABLE_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/include/policy/policy_table ${CMAKE_CURRENT_SOURCE_DIR}/src/policy_table - ${CMAKE_CURRENT_BINARY_DIR}/ ) set(POLICY_TABLE_SOURCES @@ -124,6 +123,7 @@ set(PATHS ${CMAKE_CURRENT_SOURCE_DIR}/src ${COMPONENTS_DIR}/rpc_base/src/rpc_base/rpc_base.cc ) + collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}") set(LIBRARIES @@ -142,7 +142,6 @@ else () list(APPEND LIBRARIES sqlite3) endif () - add_library(PolicyStatic ${SOURCES}) target_link_libraries(PolicyStatic ${LIBRARIES}) -- cgit v1.2.1 From 5227a8451ea69e2680fede0acce2b26f02f258cd Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Tue, 1 Jun 2021 13:02:14 -0700 Subject: Fix thread stop method (#3712) --- .../media_manager/src/audio/from_mic_to_file_recorder_thread.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc index 09ee931f40..310fca7aa3 100644 --- a/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc +++ b/src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc @@ -366,7 +366,7 @@ void FromMicToFileRecorderThread::exitThreadMain() { if (sleepThread_) { SDL_LOG_DEBUG("Stop sleep thread\n"); - sleepThread_->stop(); + sleepThread_->Stop(threads::Thread::kThreadStopDelegate); } SDL_LOG_TRACE("Set should be stopped flag\n"); -- cgit v1.2.1 From 7fe1dc83f97632e4bf9b6d858858ed75cb4f7a26 Mon Sep 17 00:00:00 2001 From: Collin Date: Tue, 8 Jun 2021 09:04:43 -0400 Subject: destroy websocket session on AsyncRead error (#3696) Co-authored-by: JackLivio --- .../transport_manager/src/websocket_server/websocket_session.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/transport_manager/src/websocket_server/websocket_session.cc b/src/components/transport_manager/src/websocket_server/websocket_session.cc index 1def04d700..020da580f9 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_session.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_session.cc @@ -92,6 +92,8 @@ void WebSocketSession::AsyncRead(boost::system::error_code ec) { if (ec) { auto str_err = "ErrorMessage: " + ec.message(); SDL_LOG_ERROR(str_err); + buffer_.consume(buffer_.size()); + on_io_error_(); return; } -- cgit v1.2.1 From 4a1369f23085ea7e2430c624e329dbbb1f19ee34 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Tue, 8 Jun 2021 15:42:27 -0400 Subject: Update bson version in 3rd party CMake (#3714) --- src/3rd_party/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt index 4e4ef57a2d..9626f646ae 100644 --- a/src/3rd_party/CMakeLists.txt +++ b/src/3rd_party/CMakeLists.txt @@ -186,7 +186,7 @@ find_package(PkgConfig) pkg_check_modules(BSON libbson) message (STATUS "bson installed in " ${BSON_LIBDIR} ", " ${BSON_INCLUDEDIR}) -if ((NOT "${BSON_FOUND}") OR ("${BSON_VERSION}" VERSION_LESS "1.2.0")) +if ((NOT "${BSON_FOUND}") OR ("${BSON_VERSION}" VERSION_LESS "1.2.5")) message (STATUS "Building bson required") set(BSON_LIB_SOURCE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bson_c_lib CACHE INTERNAL "Sources of bson library" FORCE) set(BSON_LIBS_DIRECTORY ${3RD_PARTY_INSTALL_PREFIX}/lib CACHE INTERNAL "Installation path of bson libraries" FORCE) -- cgit v1.2.1 From de313af7f8093aa915abb9d8a6f88fb482850522 Mon Sep 17 00:00:00 2001 From: Collin Date: Mon, 14 Jun 2021 09:31:09 -0400 Subject: check for invalid enum result code in CommandRequestImpl::SendResponse (#3718) * check for invalid enum result code in CommandRequestImpl::SendResponse * Update src/components/application_manager/src/commands/command_request_impl.cc Co-authored-by: Jacob Keeler Co-authored-by: Jacob Keeler --- .../test/commands/mobile/alert_maneuver_request_test.cc | 2 +- .../sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc | 2 +- .../test/commands/mobile/update_turn_list_request_test.cc | 2 +- .../application_manager/src/commands/command_request_impl.cc | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc index e726616345..e7a6c43fe4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc @@ -215,7 +215,7 @@ TEST_F(AlertManeuverRequestTest, OnEvent_ReceivedUnknownEvent_UNSUCCESS) { MessageSharedPtr result_msg( CatchMobileCommandResult(CallOnEvent(*command, event))); - EXPECT_EQ(mobile_apis::Result::INVALID_ENUM, + EXPECT_EQ(mobile_apis::Result::GENERIC_ERROR, static_cast( (*result_msg)[am::strings::msg_params][am::strings::result_code] .asInt())); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc index dc7731bfc8..5e1f3e4782 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc @@ -335,7 +335,7 @@ TEST_F(AlertRequestTest, Run_FailToProcessSoftButtons_UNSUCCESS) { CommandPtr command(CreateCommand(msg_)); MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command))); - EXPECT_EQ(result_code, + EXPECT_EQ(mobile_apis::Result::GENERIC_ERROR, static_cast( (*result_msg)[am::strings::msg_params][am::strings::result_code] .asInt())); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc index 44628a8e89..8fbc37e0bd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc @@ -148,7 +148,7 @@ TEST_F(UpdateTurnListRequestTest, EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app)); - const mobile_result::eType kExpectedResult = mobile_result::INVALID_ENUM; + const mobile_result::eType kExpectedResult = mobile_result::GENERIC_ERROR; EXPECT_CALL(mock_message_helper_, ProcessSoftButtons((*command_msg_)[am::strings::msg_params], Eq(mock_app), diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index bc4b514be4..0bf3716aa9 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -289,6 +289,11 @@ void CommandRequestImpl::SendResponse( : warning_info(); response[strings::msg_params][strings::result_code] = mobile_apis::Result::WARNINGS; + } else if (mobile_apis::Result::INVALID_ENUM == result_code) { + response[strings::msg_params][strings::result_code] = + mobile_apis::Result::GENERIC_ERROR; + response[strings::msg_params][strings::info] = + "Invalid result received from vehicle"; } else { response[strings::msg_params][strings::result_code] = result_code; } -- cgit v1.2.1 From b636064c70a3742a792bf0a53f2f179a9f5c1fec Mon Sep 17 00:00:00 2001 From: JackLivio Date: Fri, 18 Jun 2021 11:37:54 -0400 Subject: Fix boost logger on release build (#3724) * Fix boost logger on release build * Exclude boost logger file when logs disabled --- src/components/utils/CMakeLists.txt | 4 ++++ src/components/utils/src/logger/boostlogger.cc | 1 + 2 files changed, 5 insertions(+) diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt index 414500382c..50f75151a4 100644 --- a/src/components/utils/CMakeLists.txt +++ b/src/components/utils/CMakeLists.txt @@ -71,6 +71,9 @@ endif() if (ENABLE_LOG) if (${LOGGER_NAME} STREQUAL "LOG4CXX") + list(APPEND EXCLUDE_PATHS + logger/boostlogger.cc + ) list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY} apr-1 -L${APR_LIBS_DIRECTORY} @@ -86,6 +89,7 @@ else() list(APPEND EXCLUDE_PATHS auto_trace.cc logger/log4cxxlogger.cc + logger/boostlogger.cc ) endif() diff --git a/src/components/utils/src/logger/boostlogger.cc b/src/components/utils/src/logger/boostlogger.cc index c8429e03c6..ea85186aae 100644 --- a/src/components/utils/src/logger/boostlogger.cc +++ b/src/components/utils/src/logger/boostlogger.cc @@ -138,6 +138,7 @@ logging::trivial::severity_level getBoostLogLevel(LogLevel log_level) { return logging::trivial::severity_level::fatal; default: assert(false); + return logging::trivial::severity_level::trace; } } -- cgit v1.2.1 From 60e3354b17bcecd20d7727c71a58b34ba81f4af0 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Wed, 23 Jun 2021 17:24:57 -0400 Subject: Fix crash during resumption callback (#3721) * Fix invalid read in `send_response` callback * Add check in FinalizeResumption that app is still registered --- .../commands/mobile/register_app_interface_request.cc | 3 ++- .../src/resumption/resumption_data_processor_impl.cc | 10 +++++++++- .../test/resumption/resume_ctrl_test.cc | 18 +++++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 920805be7c..5317788746 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -983,12 +983,13 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( file_system::FileExists(application->app_icon_path()); smart_objects::SmartObject msg_params_copy = msg_params; + ApplicationManager& app_manager = application_manager_; const auto result_code = CalculateFinalResultCode(); SendResponse(true, result_code, response_info_.c_str(), &response_params); FinishSendingResponseToMobile( - msg_params_copy, application_manager_, key, status_notifier); + msg_params_copy, app_manager, key, status_notifier); } void RegisterAppInterfaceRequest::SendChangeRegistration( diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc index 5c18ef4b9b..18b1f8a2a3 100644 --- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc +++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc @@ -307,6 +307,14 @@ void ResumptionDataProcessorImpl::ProcessResponseFromHMI( void ResumptionDataProcessorImpl::FinalizeResumption( const ResumeCtrl::ResumptionCallBack& callback, const uint32_t app_id) { + auto app = application_manager_.application(app_id); + if (!app) { + SDL_LOG_ERROR("App " << app_id + << " is not registered, erasing resumption data"); + EraseAppResumptionData(app_id); + return; + } + if (IsResumptionSuccessful(app_id)) { SDL_LOG_DEBUG("Resumption for app " << app_id << " successful"); callback(mobile_apis::Result::SUCCESS, "Data resumption successful"); @@ -314,7 +322,7 @@ void ResumptionDataProcessorImpl::FinalizeResumption( } else { SDL_LOG_ERROR("Resumption for app " << app_id << " failed"); callback(mobile_apis::Result::RESUME_FAILED, "Data resumption failed"); - RevertRestoredData(application_manager_.application(app_id)); + RevertRestoredData(app); application_manager_.state_controller().DropPostponedWindows(app_id); } EraseAppResumptionData(app_id); diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc index a265b2b341..f5ccd99ee0 100644 --- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc +++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc @@ -315,6 +315,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithFiles) { ON_CALL(*mock_storage_, GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); + ON_CALL(mock_app_mngr_, application(kTestAppId_)) + .WillByDefault(Return(mock_app_)); smart_objects::SmartObjectList requests; EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(), @@ -363,6 +365,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubmenues) { ON_CALL(*mock_storage_, GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); + ON_CALL(mock_app_mngr_, application(kTestAppId_)) + .WillByDefault(Return(mock_app_)); EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_)); @@ -412,6 +416,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) { ON_CALL(*mock_storage_, GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); + ON_CALL(mock_app_mngr_, application(kTestAppId_)) + .WillByDefault(Return(mock_app_)); EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_)); ON_CALL(*mock_app_, help_prompt_manager()) .WillByDefault(ReturnRef(*mock_help_prompt_manager_)); @@ -497,6 +503,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithChoiceSet) { ON_CALL(*mock_storage_, GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); + ON_CALL(mock_app_mngr_, application(kTestAppId_)) + .WillByDefault(Return(mock_app_)); EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_)); for (uint32_t i = 0; i < count_of_choice_sets; ++i) { @@ -538,6 +546,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithGlobalProperties) { ON_CALL(*mock_storage_, GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); + ON_CALL(mock_app_mngr_, application(kTestAppId_)) + .WillByDefault(Return(mock_app_)); EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_)); @@ -583,6 +593,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) { ON_CALL(*mock_storage_, GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); + ON_CALL(mock_app_mngr_, application(kTestAppId_)) + .WillByDefault(Return(mock_app_)); std::shared_ptr button_lock_ptr = std::make_shared(); @@ -646,6 +658,8 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) { ON_CALL(*mock_storage_, GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); + ON_CALL(mock_app_mngr_, application(kTestAppId_)) + .WillByDefault(Return(mock_app_)); EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_)); @@ -674,6 +688,8 @@ TEST_F(ResumeCtrlTest, ON_CALL(*mock_storage_, GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); + ON_CALL(mock_app_mngr_, application(kTestAppId_)) + .WillByDefault(Return(mock_app_)); EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_)); smart_objects::SmartObjectSPtr subscribe_waypoints_msg; @@ -1020,7 +1036,7 @@ TEST_F(ResumeCtrlTest, res_ctrl_->SetupDefaultHMILevel(mock_app_); } -TEST_F(ResumeCtrlTest, ApplicationResumptiOnTimer_AppInFull) { +TEST_F(ResumeCtrlTest, ApplicationResumptionTimer_AppInFull) { ON_CALL(mock_app_mngr_, application(kTestAppId_)) .WillByDefault(Return(mock_app_)); -- cgit v1.2.1 From b15ee865d68a0c719df1908321a65569a401e7e0 Mon Sep 17 00:00:00 2001 From: Collin Date: Tue, 29 Jun 2021 14:44:47 -0400 Subject: Fix/remove hmi ptu decryption flag (#3728) * remove references to ENABLE_HMI_PTU_DECRYPTION and USE_HMI_PTU_DECRYPTION * merge policy manager parse and parsearray methods * remove references from CMakeLists.txt --- CMakeLists.txt | 12 ---------- .../include/policy/policy_manager_impl.h | 10 -------- .../policy_regular/src/policy_manager_impl.cc | 28 ---------------------- 3 files changed, 50 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07e5bd5b56..e638310f88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,6 @@ option(ENABLE_LOG "Logging feature" ON) option(ENABLE_GCOV "gcov code coverage feature" OFF) option(ENABLE_SANITIZE "Sanitize tool" OFF) option(ENABLE_SECURITY "Security Ford protocol protection" ON) -option(ENABLE_HMI_PTU_DECRYPTION "Policy table update parsed by hmi" ON) option(ENABLE_IAP2EMULATION "IAP2 emulation via tcp" OFF) option(USE_COTIRE "Use Cotire to speed up build (currently only for commands tests)" ON) option(USE_GOLD_LD "Use gold linker intead of GNU linker" ON) @@ -216,12 +215,6 @@ get_property(cValue CACHE HMI PROPERTY VALUE) file(APPEND "${build_config_path}" "//${cHelpString}\n") file(APPEND "${build_config_path}" "HMI:${cType}=${cValue}\n\n") -get_property(cHelpString CACHE ENABLE_HMI_PTU_DECRYPTION PROPERTY HELPSTRING) -get_property(cType CACHE ENABLE_HMI_PTU_DECRYPTION PROPERTY TYPE) -get_property(cValue CACHE ENABLE_HMI_PTU_DECRYPTION PROPERTY VALUE) -file(APPEND "${build_config_path}" "//${cHelpString}\n") -file(APPEND "${build_config_path}" "ENABLE_HMI_PTU_DECRYPTION:${cType}=${cValue}\n") - get_property(cHelpString CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY HELPSTRING) get_property(cType CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY TYPE) get_property(cValue CACHE BUILD_WEBSOCKET_SERVER_SUPPORT PROPERTY VALUE) @@ -457,11 +450,6 @@ if(ENABLE_SECURITY) message(STATUS "Security enabled") endif() -if(ENABLE_HMI_PTU_DECRYPTION) - add_definitions(-DUSE_HMI_PTU_DECRYPTION) - message(STATUS "HMI PTU decription enabled") -endif() - if(ENABLE_IAP2EMULATION) add_definitions(-DENABLE_IAP2EMULATION) message(STATUS "IAP2 emulation enabled") diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h index 32c546df62..0d1a61ec89 100644 --- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h @@ -873,7 +873,6 @@ class PolicyManagerImpl : public PolicyManager { void ResetTimeout() OVERRIDE; protected: -#if defined USE_HMI_PTU_DECRYPTION && defined PROPRIETARY_MODE /** * @brief Parse policy table content and convert to PT object * @param pt_content binary content of PT @@ -881,15 +880,6 @@ class PolicyManagerImpl : public PolicyManager { */ virtual std::shared_ptr Parse( const BinaryMessage& pt_content); -#else - /** - * @brief Parse policy table content and convert to PT object - * @param pt_content binary content of PT - * @return pointer to converted PT - */ - virtual std::shared_ptr ParseArray( - const BinaryMessage& pt_content); -#endif /** * @brief Getter for policy settings diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index 4f2e5043d2..3a41cfa08b 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -87,29 +87,12 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) { update_status_manager_.set_listener(listener); } -#if defined USE_HMI_PTU_DECRYPTION && defined PROPRIETARY_MODE - std::shared_ptr PolicyManagerImpl::Parse( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); utils::JsonReader reader; Json::Value value; - if (reader.parse(json, &value)) { - return std::make_shared(&value); - } else { - return std::make_shared(); - } -} - -#else - -std::shared_ptr PolicyManagerImpl::ParseArray( - const BinaryMessage& pt_content) { - std::string json(pt_content.begin(), pt_content.end()); - utils::JsonReader reader; - Json::Value value; - if (reader.parse(json, &value)) { // For PT Update received from SDL Server. if (value.isObject() && value["data"].isArray() && !value["data"].empty()) { @@ -123,8 +106,6 @@ std::shared_ptr PolicyManagerImpl::ParseArray( } } -#endif - void PolicyManagerImpl::CheckTriggers() { SDL_LOG_AUTO_TRACE(); const bool exceed_ignition_cycles = ExceededIgnitionCycles(); @@ -330,16 +311,7 @@ PolicyManager::PtProcessingResult PolicyManagerImpl::LoadPT( SDL_LOG_DEBUG( "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); -#if defined USE_HMI_PTU_DECRYPTION && defined PROPRIETARY_MODE - // Assuemes Policy Table was parsed, formatted, and/or decrypted by - // the HMI after system request before calling OnReceivedPolicyUpdate - // Parse message into table struct std::shared_ptr pt_update = Parse(pt_content); -#else - // Message Received from server unecnrypted with PTU in first element - // of 'data' array. No Parsing was done by HMI. - std::shared_ptr pt_update = ParseArray(pt_content); -#endif if (!pt_update) { SDL_LOG_WARN("Parsed table pointer is NULL."); ; -- cgit v1.2.1 From 5ecfd16ff038fc8c964183e4e26231e3803a05ff Mon Sep 17 00:00:00 2001 From: Collin Date: Wed, 30 Jun 2021 13:16:44 -0400 Subject: remove deprecated/unused ini files (#3731) --- .../include/config_profile/ini_file.h | 145 ------- src/components/config_profile/src/ini_file.cc | 424 --------------------- .../config_profile/test/ini_file_test.cc | 335 ---------------- 3 files changed, 904 deletions(-) delete mode 100644 src/components/config_profile/include/config_profile/ini_file.h delete mode 100644 src/components/config_profile/src/ini_file.cc delete mode 100644 src/components/config_profile/test/ini_file_test.cc diff --git a/src/components/config_profile/include/config_profile/ini_file.h b/src/components/config_profile/include/config_profile/ini_file.h deleted file mode 100644 index f489872533..0000000000 --- a/src/components/config_profile/include/config_profile/ini_file.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_INI_FILE_H_ -#define SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_INI_FILE_H_ - -#include -#include "utils/macro.h" - -namespace profile { - -#define INI_FILE_VER 1000 - -#if !defined TRUE -#define TRUE 1 -#endif -#if !defined True -#define True 1 -#endif - -#if !defined FALSE -#define FALSE 0 -#endif -#if !defined False -#define False 0 -#endif - -/* - * @brief Global defines - */ -#define INI_LINE_LEN 1024 -#define INI_FILE_TEMP_NAME "ini.tmp" - -#define INI_FLAG_UPDATE 0x00 -#define INI_FLAG_ITEM_UP_CREA 0x01 -#define INI_FLAG_FILE_UP_CREA 0x10 - -/* - * @brief Global typedefs - */ -typedef enum Ini_search_id_e { - INI_NOTHING, - INI_RIGHT_CHAPTER, - INI_WRONG_CHAPTER, - INI_RIGHT_ITEM, - INI_WRONG_ITEM, - INI_REMARK, - - INI_SEARCH_MAX -} Ini_search_id; - -/* - * @brief Prototypes of functions - */ -#ifdef __cplusplus -extern "C" { -#endif - -/* - * @brief Write usage instructions to the end of the file - * @param - * - * \deprecated This method will be removed in the next major release - * See Profile::ParseConfiguration for the new ini parsing code - * - * @return NULL if file or desired entry not found, otherwise pointer to fname - */ -DEPRECATED extern char* ini_write_inst(const char* fname, uint8_t flag); - -/* - * @brief Read a certain item of the specified chapter of a ini-file - * - * \deprecated This method will be removed in the next major release - * See Profile::ParseConfiguration for the new ini parsing code - * - * @return NULL if file or desired entry not found, otherwise pointer to value - */ -DEPRECATED extern char* ini_read_value(const char* fname, - const char* chapter, - const char* item, - char* value); - -/* - * @brief Write a certain item of the specified chapter of a ini-file - * - * \deprecated This method will be removed in the next major release - * See Profile::ParseConfiguration for the new ini parsing code - * - * @return NULL if file not found, otherwise pointer to value - */ -DEPRECATED extern char ini_write_value(const char* fname, - const char* chapter, - const char* item, - const char* value, - uint8_t flag); - -/* - * @brief Parse the given line for the item and returns the value if - * there is one otherwise NULL - * - * \deprecated This method will be removed in the next major release - * See Profile::ParseConfiguration for the new ini parsing code - * - * @return NULL if desired entry not found, otherwise pointer to value - */ -DEPRECATED extern Ini_search_id ini_parse_line(const char* line, - const char* tag, - char* value); - -#ifdef __cplusplus -} -#endif - -} // namespace profile - -#endif // SRC_COMPONENTS_CONFIG_PROFILE_INCLUDE_CONFIG_PROFILE_INI_FILE_H_ diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc deleted file mode 100644 index 615100d9a7..0000000000 --- a/src/components/config_profile/src/ini_file.cc +++ /dev/null @@ -1,424 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config_profile/ini_file.h" -#include -#include -#include -#include -#include -#include -#include - -#include "utils/logger.h" - -#ifndef _WIN32 -#include -#else -#define PATH_MAX _MAX_PATH -#endif - -#ifdef __linux__ -#define USE_MKSTEMP 1 -#endif - -#include - -namespace profile { - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -SDL_CREATE_LOG_VARIABLE("Profile") - -char* ini_write_inst(const char* fname, uint8_t flag) { - FILE* fp = 0; - - if (NULL == fname) - return NULL; - if ('\0' == *fname) - return NULL; - - if ((fp = fopen(fname, "a")) == 0) - if (flag & INI_FLAG_FILE_UP_CREA) - if ((fp = fopen(fname, "w")) == 0) - return NULL; - if (0 == fp) { - return NULL; - } - fprintf(fp, "\n"); - fprintf(fp, "; The INI-file consists of different chapters.\n"); - fprintf(fp, "; Each chapter begins with the line containing\n"); - fprintf(fp, "; the name in square brackets. Syntax:\n"); - fprintf(fp, "; [chapter]\n"); - fprintf(fp, "; The chapters consists of a set of items with a\n"); - fprintf(fp, "; assinged value. The syntax is:\n"); - fprintf(fp, "; item=value\n"); - fprintf(fp, "; All white spaces an second encounters of chapters\n"); - fprintf(fp, "; or items will be ignored.\n"); - fprintf(fp, "; Remarks start with semicolon or star as first character.\n"); - fprintf(fp, "; It is alowed for names of chapters and items to\n"); - fprintf(fp, "; contain semicolon and star. Possible syntax is:\n"); - fprintf(fp, "; [ chapter ] ;Remark\n"); - fprintf(fp, "; item = value\n"); - fprintf(fp, "\n"); - - fclose(fp); - return const_cast(fname); -} - -char* ini_read_value(const char* fname, - const char* chapter, - const char* item, - char* value) { - FILE* fp = 0; - bool chapter_found = false; - char line[INI_LINE_LEN] = ""; - char val[INI_LINE_LEN] = ""; - char tag[INI_LINE_LEN] = ""; - - Ini_search_id result; - *line = '\0'; - *val = '\0'; - *tag = '\0'; - if ((NULL == fname) || (NULL == chapter) || (NULL == item) || (NULL == value)) - return NULL; - - *value = '\0'; - if (('\0' == *fname) || ('\0' == *chapter) || ('\0' == *item)) - return NULL; - - if ((fp = fopen(fname, "r")) == 0) - return NULL; - - snprintf(tag, INI_LINE_LEN, "%s", chapter); - for (uint32_t i = 0; i < strlen(tag); ++i) { - tag[i] = toupper(tag[i]); - } - - while (NULL != fgets(line, INI_LINE_LEN, fp)) { - // Now start the line parsing - result = ini_parse_line(line, tag, val); - if (!chapter_found) { - if (INI_RIGHT_CHAPTER == result) { - chapter_found = true; - - snprintf(tag, INI_LINE_LEN, "%s", item); - for (uint32_t i = 0; i < strlen(tag); ++i) - tag[i] = toupper(tag[i]); - } - } else { - // FIXME (dchmerev): Unnecessary condition - if ((INI_RIGHT_CHAPTER == result) || (INI_WRONG_CHAPTER == result)) { - fclose(fp); - return NULL; - } - if (INI_RIGHT_ITEM == result) { - fclose(fp); - snprintf(value, INI_LINE_LEN, "%s", val); - return value; - } - } - } - - fclose(fp); - - return NULL; -} - -#ifdef BUILD_TESTS -// cppcheck-suppress unusedFunction //Used in unit tests -char ini_write_value(const char* fname, - const char* chapter, - const char* item, - const char* value, - uint8_t flag) { - FILE *rd_fp, *wr_fp = 0; - uint16_t cr_count; - int32_t wr_result; - bool chapter_found = false; - bool value_written = false; - char line[INI_LINE_LEN] = ""; - char val[INI_LINE_LEN] = ""; - char tag[INI_LINE_LEN] = ""; - char temp_fname[PATH_MAX] = ""; - Ini_search_id result; - *line = '\0'; - *val = '\0'; - *tag = '\0'; - *temp_fname = '\0'; - - if ((NULL == fname) || (NULL == chapter) || (NULL == item) || (NULL == value)) - return FALSE; - if (('\0' == *fname) || ('\0' == *chapter) || ('\0' == *item)) - return FALSE; - - if (0 == (rd_fp = fopen(fname, "r"))) { - ini_write_inst(fname, flag); - if (0 == (rd_fp = fopen(fname, "r"))) - return FALSE; - } - -#if USE_MKSTEMP - { - const char* temp_str = "./"; - if (temp_str) { - snprintf(temp_fname, PATH_MAX, "%s/ini.XXXXXX", temp_str); - int32_t fd = mkstemp(temp_fname); - if (-1 == fd) { - fclose(rd_fp); - return FALSE; - } - wr_fp = fdopen(fd, "w"); - if (NULL == wr_fp) { - unlink(temp_fname); - close(fd); - fclose(rd_fp); - return FALSE; - } - } else { - fclose(rd_fp); - return FALSE; - } - } -#else // #if USE_MKSTEMP - tmpnam(temp_fname); - if (0 == (wr_fp = fopen(temp_fname, "w"))) { - fclose(rd_fp); - return FALSE; - } -#endif // #else #if USE_MKSTEMP - - snprintf(tag, INI_LINE_LEN, "%s", chapter); - for (uint32_t i = 0; i < strlen(tag); ++i) - tag[i] = toupper(tag[i]); - - wr_result = 1; - cr_count = 0; - while ((NULL != fgets(line, INI_LINE_LEN, rd_fp)) && (0 < wr_result)) { - // Now start the line parsing - result = ini_parse_line(line, tag, val); - - if (!value_written) { - if (!chapter_found) { - if (INI_RIGHT_CHAPTER == result) { - chapter_found = true; - // coding style - snprintf(tag, INI_LINE_LEN, "%s", item); - for (uint32_t i = 0; i < strlen(tag); ++i) - tag[i] = toupper(tag[i]); - } - } else { - if ((INI_RIGHT_CHAPTER == result) || (INI_WRONG_CHAPTER == result)) { - /* item not found but new capture */ - if (flag & INI_FLAG_ITEM_UP_CREA) - fprintf(wr_fp, "%s=%s\n", item, value); - /* The item must not update in an other chapter - even it has the right name because only the - first chapter is significant */ - value_written = true; - } else if (result == INI_RIGHT_ITEM) { - for (uint16_t i = 0; i < cr_count; ++i) - fprintf(wr_fp, "\n"); - cr_count = 0; - wr_result = fprintf(wr_fp, "%s=%s\n", item, value); - value_written = true; - continue; - } - } - } /* if (!value_written) */ - - if (0 == strcmp(val, "\n")) { - ++cr_count; - } else { - for (uint32_t i = 0; i < cr_count; ++i) - fprintf(wr_fp, "\n"); - cr_count = 0; - wr_result = fprintf(wr_fp, "%s", line); - } - } - if (0 < (wr_result) && (!value_written)) { - if (flag & INI_FLAG_ITEM_UP_CREA) { - if (!chapter_found) - fprintf(wr_fp, "\n[%s]\n", chapter); - fprintf(wr_fp, "%s=%s\n", item, value); - value_written = true; - } - } - fprintf(wr_fp, "\n"); - - fclose(wr_fp); - fclose(rd_fp); - - if (0 != rename(temp_fname, fname)) { - if (0 != remove(temp_fname)) { - SDL_LOG_WARN_WITH_ERRNO( - "Unable to remove temp file: " << std::string(temp_fname)); - } - return FALSE; - } - - return (value_written); -} -#endif // BUILD_TESTS - -Ini_search_id ini_parse_line(const char* line, const char* tag, char* value) { - const char* line_ptr; - char temp_str[INI_LINE_LEN] = ""; - *temp_str = '\0'; - - snprintf(value, INI_LINE_LEN, "%s", line); - - /* cut leading spaces */ - line_ptr = line; - for (uint32_t i = 0; i < strlen(line); ++i) { - if ((line[i] == ' ') || (line[i] == 9) || // TAB - (line[i] == 10) || // LF - (line[i] == 13)) { // CR - ++line_ptr; - } else { - break; - } - } - if ('\0' == *line_ptr) { - snprintf(value, INI_LINE_LEN, "\n"); - return INI_NOTHING; - } - - if ((*line_ptr == ';') || (*line_ptr == '*')) /* remark */ - return INI_REMARK; - - if (*line_ptr == '[' && strrchr(line_ptr, ']') != NULL) { - ++line_ptr; - - /* cut leading stuff */ - uint16_t len = strlen(line_ptr); - for (int32_t i = 0; i < len; ++i) { - if ((*line_ptr == ' ') || (*line_ptr == 9) || // TAB - (*line_ptr == 10) || // LF - (*line_ptr == 13)) { // CR - ++line_ptr; - } else { - break; - } - } - if (*line_ptr == '\0') - return INI_NOTHING; - - snprintf(temp_str, INI_LINE_LEN, "%s", line_ptr); - char* temp_ptr = strrchr(temp_str, ']'); - if (NULL == temp_ptr) { - return INI_NOTHING; - } else { - *temp_ptr = '\0'; - } - - /* cut trailing stuff */ - for (int32_t i = strlen(temp_str) - 1; i > 0; --i) { - if ((temp_str[i] == ' ') || (temp_str[i] == 9) || // TAB - (temp_str[i] == 10) || // LF - (temp_str[i] == 13)) { // CR - temp_str[i] = '\0'; - } else { - break; - } - } - - snprintf(value, INI_LINE_LEN, "%s", temp_str); - - for (uint32_t i = 0; i < strlen(temp_str); ++i) - temp_str[i] = toupper(temp_str[i]); - if (strcmp(temp_str, tag) == 0) - return INI_RIGHT_CHAPTER; - else - return INI_WRONG_CHAPTER; - } - - if (NULL != strchr(line_ptr, '=')) { - strncpy(temp_str, line_ptr, (strchr(line_ptr, '=') - line_ptr)); - /* cut trailing stuff */ - for (int32_t i = strlen(temp_str) - 1; i > 0; --i) { - if ((temp_str[i] == '=') || (temp_str[i] == ' ') || - (temp_str[i] == 9) || // TAB - (temp_str[i] == 10) || // LF - (temp_str[i] == 13)) { // CR - temp_str[i] = '\0'; - } else { - break; - } - } - - snprintf(value, INI_LINE_LEN, "%s", temp_str); - - for (uint32_t i = 0; i < strlen(temp_str); ++i) - temp_str[i] = toupper(temp_str[i]); - if (strcmp(temp_str, tag) == 0) { - line_ptr = strchr(line_ptr, '=') + 1; - uint16_t len = strlen(line_ptr); - /* cut trailing stuff */ - for (uint32_t i = 0; i < len; ++i) { - if ((*line_ptr == ' ') || (*line_ptr == 9) || // TAB - (*line_ptr == 10) || // LF - (*line_ptr == 13)) { // CR - ++line_ptr; - } else { - break; - } - } - - snprintf(value, INI_LINE_LEN, "%s", line_ptr); - - if (value[0] != '\0') { - /* cut trailing stuff */ - for (int32_t i = strlen(value) - 1; i > 0; --i) { - if ((value[i] == ' ') || (value[i] == ';') || - (value[i] == 9) || // TAB - (value[i] == 10) || // LF - (value[i] == 13)) { // CR - value[i] = '\0'; - } else { - break; - } - } - } - return INI_RIGHT_ITEM; - } else { - return INI_WRONG_ITEM; - } - } - - return INI_NOTHING; -} - -#pragma GCC diagnostic pop - -} // namespace profile diff --git a/src/components/config_profile/test/ini_file_test.cc b/src/components/config_profile/test/ini_file_test.cc deleted file mode 100644 index c1a2b83120..0000000000 --- a/src/components/config_profile/test/ini_file_test.cc +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) 2015, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config_profile/ini_file.h" -#include "gtest/gtest.h" -#include "utils/file_system.h" - -namespace test { -namespace components { -namespace profile_test { - -using namespace ::profile; - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - -TEST(IniFileTest, WriteItemReadItem) { - // Write line in chapter - const char* fname = "./test_ini_file.ini"; - const char* chapter = "Chapter"; - const char* item = "Test_item"; - const char* value = "test_value"; - const bool write_result = - ini_write_value(fname, chapter, item, value, INI_FLAG_ITEM_UP_CREA); - EXPECT_TRUE(write_result); - char search_value[INI_LINE_LEN] = {0}; - const bool read_result = ini_read_value(fname, chapter, item, search_value); - const char* res = search_value; - - EXPECT_TRUE(read_result); - EXPECT_STREQ(res, value); - EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini")); -} - -TEST(IniFileTest, WriteItemWithoutValueReadItem) { - // Write line in chapter - const char* fname = "./test_ini_file.ini"; - const char* chapter = "Chapter"; - const char* test_item = "Test_item"; - const char* value = ""; - const bool write_result = - ini_write_value(fname, chapter, test_item, value, INI_FLAG_ITEM_UP_CREA); - EXPECT_TRUE(write_result); - - // Read value from file - char search_value[INI_LINE_LEN] = {0}; - const bool read_result = - ini_read_value(fname, chapter, test_item, search_value); - const char* res = search_value; - EXPECT_TRUE(read_result); - EXPECT_STREQ(res, value); - - EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini")); -} - -TEST(IniFileTest, WriteSameItemInDifferentChapters) { - // Write line in chapter - const char* fname = "./test_ini_file.ini"; - const char* chapter1 = "Chapter1"; - const char* test_item = "Test_item"; - const char* value = "test_value"; - const bool write_result = - ini_write_value(fname, chapter1, test_item, value, INI_FLAG_ITEM_UP_CREA); - EXPECT_TRUE(write_result); - char search_value[INI_LINE_LEN] = {0}; - const bool read_result = - ini_read_value(fname, chapter1, test_item, search_value); - const char* res = search_value; - EXPECT_TRUE(read_result); - EXPECT_STREQ(res, value); - - // Create new chapter and write the same value - const char* chapter2 = "Chapter2"; - - const bool write_result2 = - ini_write_value(fname, chapter2, test_item, value, INI_FLAG_ITEM_UP_CREA); - - EXPECT_TRUE(write_result2); - - char value2[INI_LINE_LEN] = "test_value"; - const bool read_result2 = ini_read_value(fname, chapter2, test_item, value2); - const char* res2 = value2; - EXPECT_TRUE(read_result2); - EXPECT_STREQ(res2, res); - EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini")); -} - -TEST(IniFileTest, RewriteItem) { - // Write line in chapter - const char* fname = "./test_ini_file.ini"; - const char* chapter = "Chapter"; - const char* item = "Test_item"; - const char* value = "test_value"; - bool write_result = - ini_write_value(fname, chapter, item, value, INI_FLAG_ITEM_UP_CREA); - - EXPECT_TRUE(write_result); - char search_value[INI_LINE_LEN] = {0}; - bool read_result = ini_read_value(fname, chapter, item, search_value); - const char* res = search_value; - EXPECT_TRUE(read_result); - EXPECT_STREQ(res, value); - - // Write item again - const char* newvalue = "new_test_value"; - write_result = - ini_write_value(fname, chapter, item, newvalue, INI_FLAG_ITEM_UP_CREA); - - EXPECT_TRUE(write_result); - char new_search_value[INI_LINE_LEN] = {0}; - read_result = ini_read_value(fname, chapter, item, new_search_value); - const char* new_res = new_search_value; - EXPECT_TRUE(read_result); - EXPECT_STREQ(new_res, newvalue); - EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini")); -} - -TEST(IniFileTest, WriteTwoItemsInOneChapter) { - // Write line in chapter - const char* fname = "./test_ini_file.ini"; - const char* chapter = "Chapter"; - const char* item = "Test_item"; - const char* value1 = "test_value"; - - bool write_result = - ini_write_value(fname, chapter, item, value1, INI_FLAG_ITEM_UP_CREA); - EXPECT_TRUE(write_result); - - // Write another line in the same chapter - const char* item2 = "Test_item2"; - const char* value2 = "test_value2"; - - write_result = - ini_write_value(fname, chapter, item2, value2, INI_FLAG_ITEM_UP_CREA); - EXPECT_TRUE(write_result); - - // Search both values - char search_value[INI_LINE_LEN] = {0}; - bool read_result = ini_read_value(fname, chapter, item, search_value); - const char* res = search_value; - EXPECT_TRUE(read_result); - EXPECT_STREQ(res, value1); - - char search_value2[INI_LINE_LEN] = {0}; - read_result = ini_read_value(fname, chapter, item2, search_value2); - const char* res2 = search_value2; - EXPECT_TRUE(read_result); - EXPECT_STREQ(res2, value2); - EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini")); -} - -TEST(IniFileTest, WriteEmptyItemWithValueReadItem) { - const char* fname = "./test_ini_file.ini"; - const char* chapter = "Chapter"; - const char* test_item = ""; - const char* value = "test_value"; - bool result = - ini_write_value(fname, chapter, test_item, value, INI_FLAG_ITEM_UP_CREA); - EXPECT_FALSE(result); -} - -TEST(IniFileTest, WriteEmptyItemWithEmptyValue_ExpectFalse) { - // Write empty line in chapter - const char* fname = "./test_ini_file.ini"; - const char* chapter = "Chapter"; - const char* test_item = ""; - const char* value = ""; - bool result = - ini_write_value(fname, chapter, test_item, value, INI_FLAG_ITEM_UP_CREA); - EXPECT_FALSE(result); -} - -TEST(IniFileTest, WriteItemInEmptyChapter_ExpectFalse) { - // Write line in empty chapter - const char* fname = "./test_ini_file.ini"; - const char* chapter = ""; - const char* test_item = "Test_item"; - const char* value = "test_value"; - bool result = - ini_write_value(fname, chapter, test_item, value, INI_FLAG_ITEM_UP_CREA); - EXPECT_FALSE(result); -} - -TEST(IniFileTest, ParseEmptyLine) { - char line[INI_LINE_LEN] = {0}; - char val[INI_LINE_LEN] = {0}; - const char* tag = "HMI"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_NOTHING, result); -} - -TEST(IniFileTest, ParseChapter) { - const char* line = "[HMI]"; - char val[INI_LINE_LEN] = {0}; - const char* tag = "HMI"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_RIGHT_CHAPTER, result); -} - -TEST(IniFileTest, ParseChapterTagEmpty) { - const char* line = "[HMI]"; - char val[INI_LINE_LEN] = {0}; - char tag[INI_LINE_LEN] = {0}; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_WRONG_CHAPTER, result); -} - -TEST(IniFileTest, ParseChapterWithUppercaseTag) { - const char* line = "[Security Manager]"; - char val[INI_LINE_LEN] = {0}; - const char* tag = "SECURITY MANAGER"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_RIGHT_CHAPTER, result); -} - -TEST(IniFileTest, ParseChapterWithLowcaseTag) { - const char* line = "[Security Manager]"; - char val[INI_LINE_LEN] = {0}; - const char* tag = "Security Manager"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_WRONG_CHAPTER, result); -} - -TEST(IniFileTest, ParseWithWrongChapter) { - const char* line = "[HMI]"; - char val[INI_LINE_LEN] = {0}; - const char* tag = "MAIN"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_WRONG_CHAPTER, result); -} - -TEST(IniFileTest, ParseLineWithItem) { - char line[INI_LINE_LEN] = "LaunchHMI = true"; - char val[INI_LINE_LEN] = ""; - char tag[INI_LINE_LEN] = "LAUNCHHMI"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_RIGHT_ITEM, result); - - char check_val[INI_LINE_LEN] = "true"; - EXPECT_EQ(*check_val, *val); -} - -TEST(IniFileTest, ParseLineWithoutItem) { - const char* line = "LaunchHMI = "; - char val[INI_LINE_LEN] = {0}; - const char* tag = "LAUNCHHMI"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - const char* res = val; - const char* check_val = ""; - EXPECT_EQ(INI_RIGHT_ITEM, result); - EXPECT_STREQ(check_val, res); -} - -TEST(IniFileTest, ParseLineWithEmptytag) { - const char* line = "LaunchHMI = true"; - char val[INI_LINE_LEN] = {0}; - char tag[INI_LINE_LEN] = {0}; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_WRONG_ITEM, result); -} - -TEST(IniFileTest, ParseLineWithLowcaseTag) { - const char* line = "LaunchHMI = true"; - char val[INI_LINE_LEN] = {0}; - const char* tag = "LaunchHmi"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - EXPECT_EQ(INI_WRONG_ITEM, result); -} - -TEST(IniFileTest, ParseLineWithComment) { - const char* line = "; [HMI]"; - char val[INI_LINE_LEN] = {0}; - const char* tag = "HMI"; - - Ini_search_id result; - result = ini_parse_line(line, tag, val); - const char* res = val; - EXPECT_EQ(INI_REMARK, result); - EXPECT_STREQ(line, res); -} - -#pragma GCC diagnostic pop - -} // namespace profile_test -} // namespace components -} // namespace test -- cgit v1.2.1 From 10c6562dbe4e4d6d88090f9a41f7433b2c760d3a Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Fri, 2 Jul 2021 10:00:40 -0700 Subject: Feature/Add Unit test cases for GetSystemCapability (#3729) * Add additional test cases * Add additional test cases and fix style * Address review comments --- .../mobile/get_system_capability_request_test.cc | 194 +++++++++++++++++++++ 1 file changed, 194 insertions(+) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc index 74c61410e8..3574385274 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc @@ -33,8 +33,11 @@ #include "mobile/get_system_capability_request.h" #include "application_manager/commands/command_request_test.h" +#include "application_manager/message_helper.h" #include "gtest/gtest.h" #include "interfaces/MOBILE_API.h" +#include "resumption/last_state_impl.h" +#include "resumption/last_state_wrapper_impl.h" #include "smart_objects/smart_object.h" namespace test { @@ -44,8 +47,11 @@ namespace mobile_commands_test { namespace get_system_capability_request_test { using sdl_rpc_plugin::commands::GetSystemCapabilityRequest; +using ::test::components::application_manager_test::MockAppServiceManager; using ::testing::_; using ::testing::Return; +using ::testing::ReturnPointee; + typedef std::shared_ptr GetSystemCapabilityRequestPtr; @@ -64,6 +70,12 @@ class GetSystemCapabilityRequestTest command_ = CreateCommand(message_); mock_app_ = CreateMockApp(); + last_state_ = std::make_shared( + std::make_shared("app_storage_folder", + "app_info_storage")); + mock_app_service_mngr_ = + std::make_shared(app_mngr_, last_state_); + ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); } @@ -71,6 +83,8 @@ class GetSystemCapabilityRequestTest GetSystemCapabilityRequestPtr command_; MessageSharedPtr message_; MockAppPtr mock_app_; + std::shared_ptr mock_app_service_mngr_; + resumption::LastStateWrapperPtr last_state_; }; TEST_F( @@ -117,6 +131,186 @@ TEST_F( command_->Run(); } +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_AppNotRegistered) { + EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr)); + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand( + MobileResultCodeIs(mobile_apis::Result::APPLICATION_NOT_REGISTERED), + Command::CommandSource::SOURCE_SDL)); + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_NAVIGATION_SUCCESSResultCode) { + (*message_)[strings::msg_params][strings::system_capability_type] = + mobile_apis::SystemCapabilityType::NAVIGATION; + + smart_objects::SmartObjectSPtr system_navigation_capabilities( + std::make_shared()); + EXPECT_CALL(mock_hmi_capabilities_, navigation_capability()) + .Times(2) + .WillRepeatedly(Return(system_navigation_capabilities)); + + ON_CALL(app_mngr_, GetAppServiceManager()) + .WillByDefault(ReturnPointee(mock_app_service_mngr_)); + + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + Command::CommandSource::SOURCE_SDL)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_PHONECALL_SUCCESSResultCode) { + (*message_)[strings::msg_params][strings::system_capability_type] = + mobile_apis::SystemCapabilityType::PHONE_CALL; + + smart_objects::SmartObjectSPtr system_phonecall_capabilities( + std::make_shared()); + EXPECT_CALL(mock_hmi_capabilities_, phone_capability()) + .Times(2) + .WillRepeatedly(Return(system_phonecall_capabilities)); + + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + Command::CommandSource::SOURCE_SDL)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_VIDEOSTREAMING_SUCCESSResultCode) { + (*message_)[strings::msg_params][strings::system_capability_type] = + mobile_apis::SystemCapabilityType::VIDEO_STREAMING; + + smart_objects::SmartObjectSPtr system_videostreaming_capabilities( + std::make_shared()); + EXPECT_CALL(mock_hmi_capabilities_, video_streaming_capability()) + .Times(2) + .WillRepeatedly(Return(system_videostreaming_capabilities)); + + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + Command::CommandSource::SOURCE_SDL)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_REMOTECONTROL_SUCCESSResultCode) { + (*message_)[strings::msg_params][strings::system_capability_type] = + mobile_apis::SystemCapabilityType::REMOTE_CONTROL; + + EXPECT_CALL(*mock_app_, is_remote_control_supported()).WillOnce(Return(true)); + EXPECT_CALL(mock_hmi_capabilities_, is_rc_cooperating()) + .WillOnce(Return(true)); + + smart_objects::SmartObjectSPtr system_remotecontrol_capabilities( + std::make_shared()); + EXPECT_CALL(mock_hmi_capabilities_, rc_capability()) + .Times(2) + .WillRepeatedly(Return(system_remotecontrol_capabilities)); + + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + Command::CommandSource::SOURCE_SDL)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_REMOTECONTROL_DISALLOWEDResultCode) { + (*message_)[strings::msg_params][strings::system_capability_type] = + mobile_apis::SystemCapabilityType::REMOTE_CONTROL; + + EXPECT_CALL(*mock_app_, is_remote_control_supported()) + .WillOnce(Return(false)); + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::DISALLOWED), + Command::CommandSource::SOURCE_SDL)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_APPSERVICES_SUCCESSResultCode) { + (*message_)[strings::msg_params][strings::system_capability_type] = + mobile_apis::SystemCapabilityType::APP_SERVICES; + + ON_CALL(app_mngr_, GetAppServiceManager()) + .WillByDefault(ReturnPointee(mock_app_service_mngr_)); + + std::vector app_services; + EXPECT_CALL(*mock_app_service_mngr_, GetAllServiceRecords()) + .WillOnce(Return(app_services)); + + ON_CALL(*application_manager::MockMessageHelper::message_helper_mock(), + CreateAppServiceCapabilities(app_services)) + .WillByDefault(Return(smart_objects::SmartObject())); + + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + Command::CommandSource::SOURCE_SDL)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_SEATLOCATION_SUCCESSResultCode) { + (*message_)[strings::msg_params][strings::system_capability_type] = + mobile_apis::SystemCapabilityType::SEAT_LOCATION; + + smart_objects::SmartObjectSPtr system_seatlocation_capabilities( + std::make_shared()); + EXPECT_CALL(mock_hmi_capabilities_, seat_location_capability()) + .Times(2) + .WillRepeatedly(Return(system_seatlocation_capabilities)); + + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + Command::CommandSource::SOURCE_SDL)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(GetSystemCapabilityRequestTest, + Run_GetSystemDisplayCapabilities_DRIVERDISTRACTION_SUCCESSResultCode) { + (*message_)[strings::msg_params][strings::system_capability_type] = + mobile_apis::SystemCapabilityType::DRIVER_DISTRACTION; + + smart_objects::SmartObjectSPtr system_driverdistraction_capabilities( + std::make_shared()); + EXPECT_CALL(mock_hmi_capabilities_, driver_distraction_capability()) + .Times(2) + .WillRepeatedly(Return(system_driverdistraction_capabilities)); + + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + Command::CommandSource::SOURCE_SDL)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + } // namespace get_system_capability_request_test } // namespace mobile_commands_test } // namespace commands_test -- cgit v1.2.1 From 36cdbde565c039c87aee1441d455c2bff96bba36 Mon Sep 17 00:00:00 2001 From: Collin Date: Tue, 6 Jul 2021 17:02:19 -0400 Subject: enable MessageHelper::SendGetUserFriendlyMessageResponse for all policy modes (#3723) --- .../application_manager/src/message_helper/message_helper.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index c0f8a5dcfb..67606052ec 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -2290,13 +2290,11 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( smart_objects::SmartObject& user_friendly_messages = (*message)[strings::msg_params][messages]; -#ifdef EXTERNAL_PROPRIETARY_MODE const std::string tts = "ttsString"; const std::string label = "label"; const std::string line1 = "line1"; const std::string line2 = "line2"; const std::string textBody = "textBody"; -#endif // EXTERNAL_PROPRIETARY_MODE const std::string message_code = "messageCode"; std::vector::const_iterator it = msg.begin(); std::vector::const_iterator it_end = msg.end(); @@ -2306,7 +2304,6 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( smart_objects::SmartObject& obj = user_friendly_messages[index]; obj[message_code] = it->message_code; -#ifdef EXTERNAL_PROPRIETARY_MODE if (!it->tts.empty()) { obj[tts] = it->tts; } @@ -2322,7 +2319,6 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( if (!it->text_body.empty()) { obj[textBody] = it->text_body; } -#endif // EXTERNAL_PROPRIETARY_MODE } app_mngr.GetRPCService().ManageHMICommand(message); -- cgit v1.2.1 From 5a6ef2cf7260e1190bf3c23da8026f7e8c7eab8d Mon Sep 17 00:00:00 2001 From: Sergii Levchenko Date: Fri, 9 Jul 2021 00:08:57 +0300 Subject: Add missing fields to PT Snapshot (#1537) --- .../policy_external/src/policy_table/types.cc | 2 +- .../policy_regular/src/policy_table/types.cc | 36 +++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc index 47c4202de0..68133f7227 100644 --- a/src/components/policy/policy_external/src/policy_table/types.cc +++ b/src/components/policy/policy_external/src/policy_table/types.cc @@ -1641,7 +1641,7 @@ AppLevel::AppLevel(const Json::Value* value__) impl::ValueMember(value__, "count_of_rpcs_sent_in_hmi_none")) , count_of_removals_for_bad_behavior( impl::ValueMember(value__, "count_of_removals_for_bad_behavior")) - , count_of_tls_errors(impl::ValueMember(value__, "count_of_tls_errors")) + , count_of_tls_errors(impl::ValueMember(value__, "count_of_TLS_errors")) , count_of_run_attempts_while_revoked( impl::ValueMember(value__, "count_of_run_attempts_while_revoked")) {} diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc index d2a70baafe..4c122c8839 100644 --- a/src/components/policy/policy_regular/src/policy_table/types.cc +++ b/src/components/policy/policy_regular/src/policy_table/types.cc @@ -1457,13 +1457,47 @@ AppLevel::AppLevel(const Json::Value* value__) impl::ValueMember(value__, "count_of_rpcs_sent_in_hmi_none")) , count_of_removals_for_bad_behavior( impl::ValueMember(value__, "count_of_removals_for_bad_behavior")) - , count_of_tls_errors(impl::ValueMember(value__, "count_of_tls_errors")) + , count_of_tls_errors(impl::ValueMember(value__, "count_of_TLS_errors")) , count_of_run_attempts_while_revoked( impl::ValueMember(value__, "count_of_run_attempts_while_revoked")) {} Json::Value AppLevel::ToJsonValue() const { Json::Value result__(Json::objectValue); + impl::WriteJsonField("minutes_in_hmi_full", minutes_in_hmi_full, &result__); + impl::WriteJsonField("app_registration_language_gui", + app_registration_language_gui, + &result__); + impl::WriteJsonField("app_registration_language_vui", + app_registration_language_vui, + &result__); + impl::WriteJsonField( + "minutes_in_hmi_limited", minutes_in_hmi_limited, &result__); + impl::WriteJsonField( + "minutes_in_hmi_background", minutes_in_hmi_background, &result__); + impl::WriteJsonField("minutes_in_hmi_none", minutes_in_hmi_none, &result__); + impl::WriteJsonField( + "count_of_user_selections", count_of_user_selections, &result__); + impl::WriteJsonField("count_of_rejections_sync_out_of_memory", + count_of_rejections_sync_out_of_memory, + &result__); + impl::WriteJsonField("count_of_rejections_nickname_mismatch", + count_of_rejections_nickname_mismatch, + &result__); + impl::WriteJsonField("count_of_rejections_duplicate_name", + count_of_rejections_duplicate_name, + &result__); + impl::WriteJsonField( + "count_of_rejected_rpc_calls", count_of_rejected_rpc_calls, &result__); + impl::WriteJsonField("count_of_rpcs_sent_in_hmi_none", + count_of_rpcs_sent_in_hmi_none, + &result__); + impl::WriteJsonField("count_of_removals_for_bad_behavior", + count_of_removals_for_bad_behavior, + &result__); impl::WriteJsonField("count_of_TLS_errors", count_of_tls_errors, &result__); + impl::WriteJsonField("count_of_run_attempts_while_revoked", + count_of_run_attempts_while_revoked, + &result__); return result__; } -- cgit v1.2.1 From eaec9b47a5e9b31c282cd0ef0dcdd0d8ed8e1a52 Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Fri, 9 Jul 2021 16:42:43 -0400 Subject: Feature/Update Minimum Supported Version to Ubuntu 18 (#3727) * Remove references to ubuntu 16 in documentation * Remove older ssl ciphers from crypto manager * Fix style * Change logs for unsupported protocols * Update clang-format version to 8 and re-run style script * Apply suggestions from code review Co-authored-by: Collin * Drop support for openssl 1.0 * Remove some references to OPENSSL_1_1_VERSION Co-authored-by: Collin --- .github/CONTRIBUTING.md | 1 - .github/workflows/sdl_core_github_ci.yml | 2 +- README.md | 1 - .../rc_rpc_plugin/src/rc_command_factory.cc | 13 ++++-- .../src/resource_allocation_manager_impl.cc | 4 +- ...tem_capability_updated_notification_from_hmi.cc | 4 +- .../on_system_capability_updated_notification.cc | 4 +- .../mobile/register_app_interface_request.cc | 3 +- .../sdl_rpc_plugin/src/hmi_command_factory.cc | 4 +- .../sdl_rpc_plugin/src/mobile_command_factory.cc | 12 ++++-- .../src/vehicle_info_mobile_command_factory.cc | 9 ++-- .../src/commands/command_impl.cc | 8 +++- .../src/help_prompt_manager_impl.cc | 4 +- .../src/message_helper/message_helper.cc | 4 +- .../src/policies/policy_event_observer.cc | 4 +- .../src/policies/policy_handler.cc | 8 +++- .../test/state_controller/state_controller_test.cc | 16 +++++-- .../policy_external/src/policy_table/types.cc | 4 +- .../policy_regular/src/policy_table/types.cc | 4 +- .../src/service_status_update_handler.cc | 4 +- .../test/service_status_update_handler_test.cc | 4 +- .../security_manager/src/crypto_manager_impl.cc | 50 +++------------------- .../test/crypto_manager_impl_test.cc | 8 ---- .../test/ssl_certificate_handshake_test.cc | 14 +++--- src/components/utils/src/timer.cc | 4 +- tools/infrastructure/check_style.sh | 2 +- tools/infrastructure/git-hooks/pre-commit | 6 +-- 27 files changed, 101 insertions(+), 100 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index bc90d907c1..c24cd68807 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -4,7 +4,6 @@ Third party contributions are essential for making SDL great. However, we do hav ## Environment Currently supported: -* Ubuntu Linux 16.04 with GCC 5.4.x * Ubuntu Linux 18.04 with GCC 7.3.x * Ubuntu Linux 20.04 with GCC 9.3.x * [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132) diff --git a/.github/workflows/sdl_core_github_ci.yml b/.github/workflows/sdl_core_github_ci.yml index d5700e8331..14ff51c2fe 100644 --- a/.github/workflows/sdl_core_github_ci.yml +++ b/.github/workflows/sdl_core_github_ci.yml @@ -9,7 +9,7 @@ jobs: run: git -C ${{ github.workspace }} submodule update --init --recursive # Install Dependencies - name: Apt Get Dependencies - run: sudo apt-get update && sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools && sudo apt-get install -f clang-format-6.0 + run: sudo apt-get update && sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools && sudo apt-get install -f clang-format-8 - name: Setup CMAKE uses: jwlawson/actions-setup-cmake@v1.8 with: diff --git a/README.md b/README.md index 6f346729b1..c933b81162 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Pull Requests Welcome! ## Environment Currently supported: -* Ubuntu Linux 16.04 with GCC 5.4.x * Ubuntu Linux 18.04 with GCC 7.5.x * Ubuntu Linux 20.04 with GCC 9.3.x * [C++11 standard](https://github.com/smartdevicelink/sdl_evolution/issues/132) diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc index c1743c8540..6e5d1b6e5c 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_command_factory.cc @@ -217,7 +217,8 @@ CommandCreator& RCCommandFactory::get_mobile_command_creator( : rc_factory.GetCreator< commands::GetInteriorVehicleDataConsentResponse>(); } - default: {} + default: { + } } return rc_factory.GetCreator(); } @@ -230,7 +231,8 @@ CommandCreator& RCCommandFactory::get_mobile_notification_creator( return rc_factory .GetCreator(); } - default: {} + default: { + } } return rc_factory.GetCreator(); } @@ -259,7 +261,8 @@ CommandCreator& RCCommandFactory::get_mobile_creator_factory( } break; } - default: {} + default: { + } } return rc_factory.GetCreator(); } @@ -314,7 +317,9 @@ CommandCreator& RCCommandFactory::get_hmi_creator_factory( : rc_factory .GetCreator(); } - default: { return rc_factory.GetCreator(); } + default: { + return rc_factory.GetCreator(); + } } } } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc index fe9bb5eec3..a26cf71448 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc @@ -140,7 +140,9 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource( << module_type << " " << module_id); return AcquireResult::ALLOWED; } - default: { DCHECK_OR_RETURN(false, AcquireResult::IN_USE); } + default: { + DCHECK_OR_RETURN(false, AcquireResult::IN_USE); + } } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc index 56ff20ecc5..77544fc132 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc @@ -191,7 +191,9 @@ void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() { RemoveAppIdFromNotification(); break; } - default: { SDL_LOG_ERROR("Unknown system capability type received"); } + default: { + SDL_LOG_ERROR("Unknown system capability type received"); + } } SendNotificationToMobile(message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc index 92b381456f..4a28d262dc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc @@ -239,7 +239,9 @@ void OnSystemCapabilityUpdatedNotification::Run() { msg_params[strings::system_capability][strings::display_capabilities] = *capabilities; } break; - default: { SDL_LOG_ERROR("Unknown system capability type"); } + default: { + SDL_LOG_ERROR("Unknown system capability type"); + } } SDL_LOG_INFO("Sending OnSystemCapabilityUpdated " << capability_type_string diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 5317788746..c095081f2a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -224,7 +224,8 @@ void RegisterAppInterfaceRequest::FillApplicationParams( application->set_webengine_projection_enabled(true); break; } - default: {} + default: { + } } } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index 2727c89673..642bdc7b11 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -947,7 +947,9 @@ CommandCreator& HMICommandFactory::get_creator_factory( return factory .GetCreator(); } - default: { return factory.GetCreator(); } + default: { + return factory.GetCreator(); + } } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc index 0a8c342448..c70962dc4a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc @@ -408,7 +408,8 @@ CommandCreator& MobileCommandFactory::get_command_creator( using app_mngr::commands::Command; return factory.GetCreator(); } - default: {} + default: { + } } return factory.GetCreator(); } @@ -480,7 +481,8 @@ CommandCreator& MobileCommandFactory::get_notification_creator( case mobile_apis::FunctionID::OnSubtleAlertPressedID: { return factory.GetCreator(); } - default: {} + default: { + } } return factory.GetCreator(); } @@ -501,7 +503,8 @@ CommandCreator& MobileCommandFactory::get_notification_from_mobile_creator( return factory .GetCreator(); } - default: {} + default: { + } } return factory.GetCreator(); } @@ -532,7 +535,8 @@ CommandCreator& MobileCommandFactory::get_creator_factory( } break; } - default: {} + default: { + } } CommandCreatorFactory factory( application_manager_, rpc_service_, hmi_capabilities_, policy_handler_); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc index 77cb5e71d7..7511cb7364 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_mobile_command_factory.cc @@ -208,7 +208,8 @@ app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::get_command_creator( ? factory.GetCreator() : factory.GetCreator(); } - default: {} + default: { + } } return factory.GetCreator(); } @@ -226,7 +227,8 @@ VehicleInfoMobileCommandFactory::get_notification_creator( case mobile_apis::FunctionID::OnVehicleDataID: { return factory.GetCreator(); } - default: {} + default: { + } } return factory.GetCreator(); } @@ -254,7 +256,8 @@ app_mngr::CommandCreator& VehicleInfoMobileCommandFactory::get_creator_factory( } break; } - default: {} + default: { + } } VehicleInfoCommandParams params = {application_manager_, rpc_service_, diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 25bbffecf6..c7b01efb7f 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -450,7 +450,9 @@ bool CommandImpl::ReplaceMobileWithHMIAppId( } break; } - default: { break; } + default: { + break; + } } } @@ -499,7 +501,9 @@ bool CommandImpl::ReplaceHMIWithMobileAppId( } break; } - default: { break; } + default: { + break; + } } } diff --git a/src/components/application_manager/src/help_prompt_manager_impl.cc b/src/components/application_manager/src/help_prompt_manager_impl.cc index 8d43ff2d9f..30a1139deb 100644 --- a/src/components/application_manager/src/help_prompt_manager_impl.cc +++ b/src/components/application_manager/src/help_prompt_manager_impl.cc @@ -369,7 +369,9 @@ void HelpPromptManagerImpl::SetSendingType( } break; } - default: { break; } + default: { + break; + } } SDL_LOG_DEBUG( "Sending type set to:" << static_cast(sending_type_)); diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 67606052ec..301c26a750 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -3408,7 +3408,9 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons( } break; } - default: { continue; } + default: { + continue; + } } soft_buttons[j++] = request_soft_buttons[i]; diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc index af44fd033f..75fa48b049 100644 --- a/src/components/application_manager/src/policies/policy_event_observer.cc +++ b/src/components/application_manager/src/policies/policy_event_observer.cc @@ -70,7 +70,9 @@ void PolicyEventObserver::on_event(const event_engine::Event& event) { unsubscribe_from_event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData); break; } - default: { break; } + default: { + break; + } } } diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index dd5ec0d52d..c0d61bdd4e 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -2014,7 +2014,9 @@ void PolicyHandler::AddStatisticsInfo(int type) { ++count_of_iap_buffer_full; break; } - default: { SDL_LOG_WARN("Type of statistics is unknown"); } + default: { + SDL_LOG_WARN("Type of statistics is unknown"); + } } } @@ -2033,7 +2035,9 @@ void PolicyHandler::OnSystemError(int code) { ++count_sync_out_of_memory; break; } - default: { SDL_LOG_WARN("System error is unknown"); } + default: { + SDL_LOG_WARN("System error is unknown"); + } } } diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc index 90b53dc6f9..2730489d17 100644 --- a/src/components/application_manager/test/state_controller/state_controller_test.cc +++ b/src/components/application_manager/test/state_controller/state_controller_test.cc @@ -437,7 +437,9 @@ class StateControllerImplTest : public ::testing::Test { SystemContext::SYSCTXT_MAIN)); break; } - default: { break; } + default: { + break; + } } } @@ -491,7 +493,9 @@ class StateControllerImplTest : public ::testing::Test { PrepareStateResultsForAttenuated(result_hmi_state); break; } - default: { break; } + default: { + break; + } } } @@ -548,7 +552,9 @@ class StateControllerImplTest : public ::testing::Test { PrepareStateResultsForAttenuated(result_hmi_state); break; } - default: { break; } + default: { + break; + } } } @@ -579,7 +585,9 @@ class StateControllerImplTest : public ::testing::Test { PrepareStateResultsForAttenuated(result_hmi_state); break; } - default: { break; } + default: { + break; + } } } diff --git a/src/components/policy/policy_external/src/policy_table/types.cc b/src/components/policy/policy_external/src/policy_table/types.cc index 68133f7227..9e056752a8 100644 --- a/src/components/policy/policy_external/src/policy_table/types.cc +++ b/src/components/policy/policy_external/src/policy_table/types.cc @@ -19,7 +19,9 @@ std::string PolicyTableTypeToString(const PolicyTableType pt_type) { case PT_SNAPSHOT: { return "PT_SNAPSHOT"; } - default: { return "INVALID_PT_TYPE"; } + default: { + return "INVALID_PT_TYPE"; + } } } diff --git a/src/components/policy/policy_regular/src/policy_table/types.cc b/src/components/policy/policy_regular/src/policy_table/types.cc index 4c122c8839..8b937f3142 100644 --- a/src/components/policy/policy_regular/src/policy_table/types.cc +++ b/src/components/policy/policy_regular/src/policy_table/types.cc @@ -19,7 +19,9 @@ std::string PolicyTableTypeToString(const PolicyTableType pt_type) { case PT_SNAPSHOT: { return "PT_SNAPSHOT"; } - default: { return "INVALID_PT_TYPE"; } + default: { + return "INVALID_PT_TYPE"; + } } } diff --git a/src/components/protocol_handler/src/service_status_update_handler.cc b/src/components/protocol_handler/src/service_status_update_handler.cc index 71d11bcf5b..05f493c74b 100644 --- a/src/components/protocol_handler/src/service_status_update_handler.cc +++ b/src/components/protocol_handler/src/service_status_update_handler.cc @@ -19,7 +19,9 @@ hmi_apis::Common_ServiceType::eType GetHMIServiceType( case SERVICE_TYPE_NAVI: { return Common_ServiceType::VIDEO; } - default: { return Common_ServiceType::INVALID_ENUM; } + default: { + return Common_ServiceType::INVALID_ENUM; + } } } diff --git a/src/components/protocol_handler/test/service_status_update_handler_test.cc b/src/components/protocol_handler/test/service_status_update_handler_test.cc index 7d4516a7ff..5db7f2be45 100644 --- a/src/components/protocol_handler/test/service_status_update_handler_test.cc +++ b/src/components/protocol_handler/test/service_status_update_handler_test.cc @@ -87,7 +87,9 @@ class ServiceStatusUpdateHandlerTest case ServiceStatus::PROTECTION_ENFORCED: { return Common_ServiceEvent::REQUEST_REJECTED; } - default: { return Common_ServiceEvent::INVALID_ENUM; } + default: { + return Common_ServiceEvent::INVALID_ENUM; + } } } diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc index 8d9755963c..4d66d7ec2d 100644 --- a/src/components/security_manager/src/crypto_manager_impl.cc +++ b/src/components/security_manager/src/crypto_manager_impl.cc @@ -50,8 +50,6 @@ #include "utils/macro.h" #include "utils/scope_guard.h" -#define OPENSSL1_1_VERSION 0x1010000fL -#define TLS1_1_MINIMAL_VERSION 0x1000103fL #define CONST_SSL_METHOD_MINIMAL_VERSION 0x00909000L namespace security_manager { @@ -165,58 +163,23 @@ bool CryptoManagerImpl::Init() { #endif switch (get_settings().security_manager_protocol_name()) { case SSLv3: -#ifdef OPENSSL_NO_SSL3 SDL_LOG_WARN("OpenSSL does not support SSL3 protocol"); return false; -#else - SDL_LOG_DEBUG("SSLv3 is used"); - method = is_server ? SSLv3_server_method() : SSLv3_client_method(); - SSL_CTX_set_max_proto_version(context_, SSL3_VERSION); - break; -#endif case TLSv1: - SDL_LOG_DEBUG("TLSv1 is used"); -#if OPENSSL_VERSION_NUMBER < OPENSSL1_1_VERSION - method = is_server ? TLSv1_server_method() : TLSv1_client_method(); -#else - method = is_server ? TLS_server_method() : TLS_client_method(); - SSL_CTX_set_max_proto_version(context_, TLS1_VERSION); -#endif - break; + SDL_LOG_WARN("Protocol TLSv1 is unsupported"); + return false; case TLSv1_1: - SDL_LOG_DEBUG("TLSv1_1 is used"); -#if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION - SDL_LOG_WARN( - "OpenSSL has no TLSv1.1 with version lower 1.0.1, set TLSv1.0"); - method = is_server ? TLSv1_server_method() : TLSv1_client_method(); -#elif OPENSSL_VERSION_NUMBER < OPENSSL1_1_VERSION - method = is_server ? TLSv1_1_server_method() : TLSv1_1_client_method(); -#else - method = is_server ? TLS_server_method() : TLS_client_method(); - SSL_CTX_set_max_proto_version(context_, TLS1_1_VERSION); -#endif - break; + SDL_LOG_WARN("Protocol TLSv1_1 is unsupported"); + return false; case TLSv1_2: SDL_LOG_DEBUG("TLSv1_2 is used"); -#if OPENSSL_VERSION_NUMBER < TLS1_1_MINIMAL_VERSION - SDL_LOG_WARN( - "OpenSSL has no TLSv1.2 with version lower 1.0.1, set TLSv1.0"); - method = is_server ? TLSv1_server_method() : TLSv1_client_method(); -#elif OPENSSL_VERSION_NUMBER < OPENSSL1_1_VERSION - method = is_server ? TLSv1_2_server_method() : TLSv1_2_client_method(); -#else method = is_server ? TLS_server_method() : TLS_client_method(); SSL_CTX_set_max_proto_version(context_, TLS1_2_VERSION); -#endif break; case DTLSv1: SDL_LOG_DEBUG("DTLSv1 is used"); -#if OPENSSL_VERSION_NUMBER < OPENSSL1_1_VERSION - method = is_server ? DTLSv1_server_method() : DTLSv1_client_method(); -#else method = is_server ? DTLS_server_method() : DTLS_client_method(); SSL_CTX_set_max_proto_version(context_, DTLS1_VERSION); -#endif break; default: SDL_LOG_ERROR("Unknown protocol: " @@ -248,7 +211,7 @@ bool CryptoManagerImpl::Init() { "Could not set cipher list: " << get_settings().ciphers_list()); return false; } -#if OPENSSL_VERSION_NUMBER > OPENSSL1_1_VERSION + auto sk = SSL_CTX_get_ciphers(context_); const char* p; for (int i = 0; i < sk_SSL_CIPHER_num(sk); ++i) { @@ -258,12 +221,9 @@ bool CryptoManagerImpl::Init() { break; SDL_LOG_DEBUG("Using Cipher: " << p); } -#endif } -#if OPENSSL_VERSION_NUMBER >= OPENSSL1_1_VERSION SSL_CTX_set_security_level(context_, get_settings().security_level()); -#endif if (get_settings().ca_cert_path().empty()) { SDL_LOG_WARN("Setting up empty CA certificate location"); diff --git a/src/components/security_manager/test/crypto_manager_impl_test.cc b/src/components/security_manager/test/crypto_manager_impl_test.cc index 85e1ad3129..44e24afe70 100644 --- a/src/components/security_manager/test/crypto_manager_impl_test.cc +++ b/src/components/security_manager/test/crypto_manager_impl_test.cc @@ -189,14 +189,6 @@ TEST_F(CryptoManagerTest, CorrectInit) { EXPECT_TRUE(crypto_manager_->Init()); // Recall init with other protocols - SetInitialValues( - security_manager::CLIENT, security_manager::TLSv1_2, kFordCipher); - EXPECT_TRUE(crypto_manager_->Init()); - - SetInitialValues( - security_manager::CLIENT, security_manager::TLSv1_1, kFordCipher); - EXPECT_TRUE(crypto_manager_->Init()); - SetInitialValues( security_manager::CLIENT, security_manager::DTLSv1, kFordCipher); EXPECT_TRUE(crypto_manager_->Init()); diff --git a/src/components/security_manager/test/ssl_certificate_handshake_test.cc b/src/components/security_manager/test/ssl_certificate_handshake_test.cc index d1de81de73..9c21fba0bb 100644 --- a/src/components/security_manager/test/ssl_certificate_handshake_test.cc +++ b/src/components/security_manager/test/ssl_certificate_handshake_test.cc @@ -369,14 +369,12 @@ class SSLHandshakeTest : public testing::TestWithParam { const std::vector forced_unprotected_service_; }; -INSTANTIATE_TEST_CASE_P( - CorrectProtocol, - SSLHandshakeTest, - ::testing::Values( - Protocol(security_manager::TLSv1, security_manager::TLSv1), - Protocol(security_manager::TLSv1_1, security_manager::TLSv1_1), - Protocol(security_manager::TLSv1_2, security_manager::TLSv1_2), - Protocol(security_manager::DTLSv1, security_manager::DTLSv1))); +INSTANTIATE_TEST_CASE_P(CorrectProtocol, + SSLHandshakeTest, + ::testing::Values(Protocol(security_manager::TLSv1_2, + security_manager::TLSv1_2), + Protocol(security_manager::DTLSv1, + security_manager::DTLSv1))); TEST_P(SSLHandshakeTest, NoVerification) { ASSERT_TRUE(InitServerManagers(GetParam().server_protocol, diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc index ceade03afb..d5b0e9eb80 100644 --- a/src/components/utils/src/timer.cc +++ b/src/components/utils/src/timer.cc @@ -87,7 +87,9 @@ void timer::Timer::Start(const Milliseconds timeout, single_shot_ = false; break; } - default: { ASSERT("timer_type should be kSingleShot or kPeriodic"); } + default: { + ASSERT("timer_type should be kSingleShot or kPeriodic"); + } }; StartDelegate(timeout); StartThread(); diff --git a/tools/infrastructure/check_style.sh b/tools/infrastructure/check_style.sh index 006dd340d9..139d7952ee 100755 --- a/tools/infrastructure/check_style.sh +++ b/tools/infrastructure/check_style.sh @@ -27,7 +27,7 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -FORMATER=clang-format-6.0 +FORMATER=clang-format-8 INSTALL_CMD="sudo apt-get install -f $FORMATER" if [ "$1" = "--help" ] diff --git a/tools/infrastructure/git-hooks/pre-commit b/tools/infrastructure/git-hooks/pre-commit index 710f0656c3..57fe1ae887 100755 --- a/tools/infrastructure/git-hooks/pre-commit +++ b/tools/infrastructure/git-hooks/pre-commit @@ -72,10 +72,10 @@ if [ "$?" -ne "0" ]; then exit 1 fi -# Auto update c++ files with clang-format-6.0 -CLANG_FORMAT=clang-format-6.0 +# Auto update c++ files with clang-format-8 +CLANG_FORMAT=clang-format-8 # Verify clang-format -CLANG_FORMAT_REQUIRED_VERSION=6.0 +CLANG_FORMAT_REQUIRED_VERSION=8.0 CLANG_FORMAT_CURRENT_VERSION=$($CLANG_FORMAT -version) if [[ $CLANG_FORMAT_CURRENT_VERSION != *$CLANG_FORMAT_REQUIRED_VERSION* ]] then -- cgit v1.2.1 From c564de8e07c5ff9a2d4139691ff734a01321513d Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 15 Jul 2021 14:17:48 -0400 Subject: Coverity Github Actions CI (#3737) * Add Coverity CI * Fix syntax * test * test * Add enviroment * Add env * Upload coverity result * Apply only for master branch prs --- .github/workflows/sdl_core_github_ci_coverity.yml | 63 +++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/sdl_core_github_ci_coverity.yml diff --git a/.github/workflows/sdl_core_github_ci_coverity.yml b/.github/workflows/sdl_core_github_ci_coverity.yml new file mode 100644 index 0000000000..c60482d30f --- /dev/null +++ b/.github/workflows/sdl_core_github_ci_coverity.yml @@ -0,0 +1,63 @@ +name: SDL Core Build With Coverity +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + build: + environment: Coverity + runs-on: ubuntu-20.04 + steps: + - shell: bash + env: + COVERITY_SECRET: ${{ secrets.COVERITY_TOKEN }} + run: | + echo "$COVERITY_SECRET" && echo ${{ secrets.COVERITY_TOKEN }} && echo "end" + - uses: actions/checkout@v2 + - name: Init Submodules + run: git -C ${{ github.workspace }} submodule update --init --recursive + # Install Dependencies + - name: Apt Get Dependencies + run: sudo apt-get update && sudo apt-get install libssl-dev libbluetooth3 libbluetooth-dev libudev-dev cmake html2text lcov git cmake automake1.11 build-essential libavahi-client-dev sqlite3 libsqlite3-dev libgtest-dev bluez-tools libpulse-dev libusb-1.0.0-dev cppcheck python3-pip python3-setuptools && sudo apt-get install -f clang-format-6.0 + - name: Setup CMAKE + uses: jwlawson/actions-setup-cmake@v1.8 + with: + cmake-version: '3.16.3' + # Build Project + - name: Cache 3rd Party + id: core-3rd-party + uses: actions/cache@v2 + with: + path: ${{ github.workspace }}/core_3rd_party + key: ${{ runner.os }}-core-3rd-party-v3 + - name: Make 3rd Party Directory + if: steps.core-3rd-party.outputs.cache-hit != 'true' + run: mkdir ${{ github.workspace }}/core_3rd_party + - name: Make Directories + run: cd ${{ github.workspace }} && cd ../ && mkdir build && cd build + - name: Set 3rd Party Path + run: echo "THIRD_PARTY_INSTALL_PREFIX=${{ github.workspace }}/core_3rd_party" >> $GITHUB_ENV + - name: Set 3rd Party ARCH Path + run: echo "THIRD_PARTY_INSTALL_PREFIX_ARCH=${{ github.workspace }}/core_3rd_party" >> $GITHUB_ENV + - name: Configure + run: cmake ../sdl_core -DLOGGER_NAME=BOOST + - name: Download Coverity + env: + COVERITY_SECRET: ${{ secrets.COVERITY_TOKEN }} + run: wget https://scan.coverity.com/download/linux64 --post-data "token=${COVERITY_SECRET}&project=smartdevicelink%2Fsdl_core" -O coverity_tool.tgz + - name: unzip + run: tar zxvf coverity_tool.tgz + - name: Build + run: make install-3rd_party && ./cov-analysis-linux64-2020.09/bin/cov-build --dir cov-int make -j `nproc` install + - name: Set Library Path + run: echo "LD_LIBRARY_PATH=$THIRD_PARTY_INSTALL_PREFIX/lib:." >> $GITHUB_ENV + - name: Compress Coverity + run: tar czvf myproject.tgz cov-int + - name: Upload Coverity + env: + COVERITY_SECRET: ${{ secrets.COVERITY_TOKEN }} + run: curl --form token=${COVERITY_SECRET} --form email=jack@livio.io --form file=@myproject.tgz --form version="Version" --form description="Description" https://scan.coverity.com/builds?project=smartdevicelink%2Fsdl_core + -- cgit v1.2.1 From 716cfac5e19673daf6a77e3eb17472fd74201019 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Thu, 15 Jul 2021 14:18:27 -0400 Subject: Remove Deprecated Methods For SDL Core 8.0.0 (#3735) * Remove deprecated methods * Style * Fix external policy build --- .../app_launch/app_launch_data_json.h | 8 -- .../application_manager/app_service_manager.h | 3 - .../include/application_manager/application.h | 6 -- .../application_manager/application_manager_impl.h | 13 --- .../application_manager/hmi_capabilities_impl.h | 3 - .../application_manager/hmi_language_handler.h | 3 - .../plugin_manager/rpc_plugin.h | 7 -- .../plugin_manager/rpc_plugin_manager_impl.h | 7 -- .../application_manager/policies/policy_handler.h | 2 - .../application_manager/resumption/resume_ctrl.h | 3 - .../resumption/resume_ctrl_impl.h | 2 - .../resumption/resumption_data_json.h | 8 -- .../app_service_rpc_plugin.h | 7 -- .../src/app_service_rpc_plugin.cc | 12 --- .../rc_rpc_plugin/rc_consent_manager_impl.h | 6 -- .../include/rc_rpc_plugin/rc_rpc_plugin.h | 6 -- .../rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc | 8 -- .../include/sdl_rpc_plugin/sdl_rpc_plugin.h | 7 -- .../sdl_rpc_plugin/src/sdl_rpc_plugin.cc | 12 --- .../vehicle_info_plugin/vehicle_info_plugin.h | 7 -- .../vehicle_info_plugin/src/vehicle_info_plugin.cc | 19 ---- .../src/application_manager_impl.cc | 101 --------------------- .../src/hmi_capabilities_impl.cc | 2 - .../src/policies/policy_handler.cc | 6 -- .../src/resumption/resume_ctrl_impl.cc | 4 - .../src/resumption/resumption_data_json.cc | 4 - .../application_manager/mock_hmi_capabilities.h | 3 - .../include/application_manager/mock_resume_ctrl.h | 3 +- .../application_manager/application_manager.h | 15 --- .../include/application_manager/hmi_capabilities.h | 3 - .../policies/policy_handler_interface.h | 4 +- .../include/media_manager/media_manager.h | 7 -- .../policy/policy_external/policy/policy_manager.h | 9 -- .../include/protocol_handler/protocol_handler.h | 16 ---- src/components/include/resumption/last_state.h | 12 --- .../application_manager/mock_application_manager.h | 15 --- .../test/application_manager/mock_rpc_plugin.h | 7 -- .../policies/mock_policy_handler_interface.h | 3 - .../test/media_manager/mock_media_manager.h | 6 -- .../include/test/resumption/mock_last_state.h | 4 - .../transport_manager/mock_transport_manager.h | 2 - .../include/transport_manager/transport_manager.h | 3 - .../audio/from_mic_recorder_adapter.h | 1 - .../include/media_manager/media_manager_impl.h | 7 -- .../media_manager/src/media_manager_impl.cc | 33 ------- .../include/policy/policy_manager_impl.h | 8 -- .../policy_external/src/policy_manager_impl.cc | 12 --- .../protocol_handler/protocol_handler_impl.h | 5 - .../protocol_handler/src/protocol_handler_impl.cc | 8 -- .../include/resumption/last_state_impl.h | 9 -- src/components/resumption/src/last_state_impl.cc | 27 ------ .../bluetooth/bluetooth_transport_adapter.h | 4 - .../iap2_emulation/iap2_transport_adapter.h | 11 --- .../transport_manager/tcp/tcp_transport_adapter.h | 5 - .../transport_adapter/transport_adapter_impl.h | 11 --- .../transport_manager/transport_manager_default.h | 3 - .../transport_manager/transport_manager_impl.h | 3 - .../transport_manager/usb/usb_aoa_adapter.h | 4 - .../src/transport_manager_default.cc | 4 - .../src/transport_manager_impl.cc | 9 -- .../websocket_server_transport_adapter.cc | 7 +- .../transport_manager/raw_message_matcher.h | 4 - .../mock_transport_adapter_impl.h | 7 -- .../test/transport_manager_default_test.cc | 2 - src/components/utils/include/utils/file_system.h | 3 - src/components/utils/src/file_system.cc | 19 ---- 66 files changed, 7 insertions(+), 577 deletions(-) diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h index 9e60183960..dba2579f8f 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h @@ -54,10 +54,6 @@ class AppLaunchDataJson : public AppLaunchDataImpl { AppLaunchDataJson(const AppLaunchSettings& settings, resumption::LastStateWrapperPtr last_state_wrapper); - DEPRECATED - AppLaunchDataJson(const AppLaunchSettings& settings, - resumption::LastState& last_state); - /** * @brief allows to destroy AppLaunchDataJson object */ @@ -99,10 +95,6 @@ class AppLaunchDataJson : public AppLaunchDataImpl { int32_t& found_index, Json::Value& dictionary) const; - DEPRECATED - Json::Value& GetApplicationListAndIndex(const ApplicationData& app_data, - int32_t& founded_index) const; - private: /** * @brief update time stamp diff --git a/src/components/application_manager/include/application_manager/app_service_manager.h b/src/components/application_manager/include/application_manager/app_service_manager.h index 94606909c6..e3a5f64602 100644 --- a/src/components/application_manager/include/application_manager/app_service_manager.h +++ b/src/components/application_manager/include/application_manager/app_service_manager.h @@ -65,9 +65,6 @@ class AppServiceManager { AppServiceManager(ApplicationManager& app_manager, resumption::LastStateWrapperPtr last_state); - DEPRECATED AppServiceManager(ApplicationManager& app_manager, - resumption::LastState& last_state); - /** * @brief Class destructor */ diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index bc966cd00c..f25afeb2bc 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -371,12 +371,6 @@ class DynamicApplicationData { */ virtual smart_objects::SmartObject FindSubMenu(uint32_t menu_id) const = 0; - /* - * @brief Returns true if sub menu with such name already exist - */ - DEPRECATED virtual bool IsSubMenuNameAlreadyExist( - const std::string& name, const uint32_t parent_id) = 0; - /* * @brief Adds a interaction choice set to the application * 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 9191a06c6b..a8a41bc23a 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 @@ -159,10 +159,6 @@ class ApplicationManagerImpl const policy::PolicySettings& policy_settings); ~ApplicationManagerImpl(); - DEPRECATED - bool Init(resumption::LastState&, - media_manager::MediaManager* media_manager) OVERRIDE; - /** * Inits application manager */ @@ -189,8 +185,6 @@ class ApplicationManagerImpl uint32_t hmi_app_id) const OVERRIDE; ApplicationSharedPtr application_by_policy_id( const std::string& policy_app_id) const OVERRIDE; - DEPRECATED ApplicationSharedPtr - application_by_name(const std::string& app_name) const OVERRIDE; ApplicationSharedPtr pending_application_by_policy_id( const std::string& policy_app_id) const OVERRIDE; ApplicationSharedPtr reregister_application_by_policy_id( @@ -858,9 +852,6 @@ class ApplicationManagerImpl */ void EndNaviServices(uint32_t app_id) OVERRIDE; - DEPRECATED - void ForbidStreaming(uint32_t app_id) OVERRIDE; - void ForbidStreaming(uint32_t app_id, protocol_handler::ServiceType service_type) OVERRIDE; @@ -875,10 +866,6 @@ class ApplicationManagerImpl protocol_handler::ServiceType service_type, bool state) OVERRIDE; - void OnAppStreaming(uint32_t app_id, - protocol_handler::ServiceType service_type, - const Application::StreamingState new_state) OVERRIDE; - mobile_api::HMILevel::eType GetDefaultHmiLevel( ApplicationConstSharedPtr application) const; diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h index f646c66ca1..9a22b2a4aa 100644 --- a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h +++ b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h @@ -257,9 +257,6 @@ class HMICapabilitiesImpl : public HMICapabilities { void Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE; - DEPRECATED - void Init(resumption::LastState* last_state) OVERRIDE; - HMILanguageHandler& get_hmi_language_handler() OVERRIDE; void set_handle_response_for( diff --git a/src/components/application_manager/include/application_manager/hmi_language_handler.h b/src/components/application_manager/include/application_manager/hmi_language_handler.h index 2ef034450d..5db5a844da 100644 --- a/src/components/application_manager/include/application_manager/hmi_language_handler.h +++ b/src/components/application_manager/include/application_manager/hmi_language_handler.h @@ -96,9 +96,6 @@ class HMILanguageHandler : public event_engine::EventObserver { hmi_apis::Common_Language::eType vr, hmi_apis::Common_Language::eType tts); - DEPRECATED - void Init(resumption::LastState*); - void Init(resumption::LastStateWrapperPtr value); /** diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h index 88f91d14fc..0c7538e809 100644 --- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h +++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h @@ -86,13 +86,6 @@ class RPCPlugin { policy::PolicyHandlerInterface& policy_handler, resumption::LastStateWrapperPtr last_state) = 0; - DEPRECATED - virtual bool Init(ApplicationManager& app_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state) = 0; - /** * @brief IsAbleToProcess check if plugin is able to process function * @param function_id RPC identifier diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h index 004d6418f5..a447034d86 100644 --- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h +++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h @@ -59,13 +59,6 @@ class RPCPluginManagerImpl : public RPCPluginManager { policy::PolicyHandlerInterface& policy_handler, resumption::LastStateWrapperPtr last_state); - DEPRECATED - RPCPluginManagerImpl(ApplicationManager& app_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state); - uint32_t LoadPlugins(const std::string& plugins_path) OVERRIDE; utils::Optional FindPluginToProcess( diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index acf4ca7819..662e255871 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -86,8 +86,6 @@ class PolicyHandler : public PolicyHandlerInterface, bool InitPolicyTable() OVERRIDE; bool ResetPolicyTable() OVERRIDE; bool ClearUserConsent() OVERRIDE; - DEPRECATED bool SendMessageToSDK(const BinaryMessage& pt_string, - const std::string& url) OVERRIDE; bool ReceiveMessageFromSDK(const std::string& file, const BinaryMessage& pt_string) OVERRIDE; bool UnloadPolicyLibrary() OVERRIDE; diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h index 456eccd29c..4cc42699bc 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h @@ -276,9 +276,6 @@ class ResumeCtrl { */ virtual void RemoveFromResumption(uint32_t app_id) = 0; - DEPRECATED - virtual bool Init(resumption::LastState& last_state) = 0; - /** * @brief Initialization data for Resume controller * @return true if initialization is success otherwise diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h index 9c529b5f9a..b93b914a48 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h @@ -256,8 +256,6 @@ class ResumeCtrlImpl : public ResumeCtrl { */ void RemoveFromResumption(uint32_t app_id) OVERRIDE; - DEPRECATED bool Init(resumption::LastState& last_state) FINAL; - /** * @brief Initialization data for Resume controller * @return true if initialization is success otherwise diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h index 2394fe00dc..f33ef83a9b 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h @@ -52,11 +52,6 @@ class ResumptionDataJson : public ResumptionData { resumption::LastStateWrapperPtr last_state_wrapper, const application_manager::ApplicationManager& application_manager); - DEPRECATED - ResumptionDataJson( - LastState&, - const application_manager::ApplicationManager& application_manager); - /** * @brief allows to destroy ResumptionDataJson object */ @@ -180,9 +175,6 @@ class ResumptionDataJson : public ResumptionData { */ void Persist() OVERRIDE; - DEPRECATED - resumption::LastState& last_state() const; - private: /** * @brief GetFromSavedOrAppend allows to get existed record about application diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h index 444636ed75..bae4738524 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h @@ -50,13 +50,6 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin { policy::PolicyHandlerInterface& policy_handler, resumption::LastStateWrapperPtr last_state) OVERRIDE; - DEPRECATED - bool Init(app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state); - bool IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource source) OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc index e03973614d..0e805da46c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc @@ -58,18 +58,6 @@ bool AppServiceRpcPlugin::Init( return true; } -bool AppServiceRpcPlugin::Init(app_mngr::ApplicationManager& app_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state) { - UNUSED(last_state); - application_manager_ = &app_manager; - command_factory_.reset(new app_service_rpc_plugin::AppServiceCommandFactory( - app_manager, rpc_service, hmi_capabilities, policy_handler)); - return true; -} - bool AppServiceRpcPlugin::IsAbleToProcess( const int32_t function_id, const commands::Command::CommandSource source) { return command_factory_->IsAbleToProcess(function_id, source); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h index 5cbc4b977e..fd8c40405e 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_consent_manager_impl.h @@ -50,12 +50,6 @@ class RCConsentManagerImpl : public RCConsentManager { application_manager::ApplicationManager& application_manager, const uint32_t period_of_consent_expired); - DEPRECATED - RCConsentManagerImpl( - resumption::LastState& last_state, - application_manager::ApplicationManager& application_manager, - const uint32_t period_of_consent_expired); - void SaveModuleConsents( const std::string& policy_app_id, const std::string& mac_address, diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h index 528e116403..c1f7339aa3 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h @@ -65,12 +65,6 @@ class RCRPCPlugin : public plugins::RPCPlugin { policy::PolicyHandlerInterface& policy_handler, resumption::LastStateWrapperPtr last_state) OVERRIDE; - DEPRECATED - bool Init(app_mngr::ApplicationManager& app_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state) OVERRIDE; /** * @param int32_t command id * @param CommandSource source diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc index 87090405e7..8250437e78 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc @@ -86,14 +86,6 @@ bool RCRPCPlugin::Init( return true; } -bool RCRPCPlugin::Init(application_manager::ApplicationManager&, - application_manager::rpc_service::RPCService&, - application_manager::HMICapabilities&, - policy::PolicyHandlerInterface&, - resumption::LastState&) { - return false; -} - bool RCRPCPlugin::IsAbleToProcess( const int32_t function_id, const application_manager::commands::Command::CommandSource diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h index b4ef7e6aed..ab74ed08fb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h @@ -54,13 +54,6 @@ class SDLRPCPlugin : public plugins::RPCPlugin { policy::PolicyHandlerInterface& policy_handler, resumption::LastStateWrapperPtr last_state) OVERRIDE; - DEPRECATED - bool Init(app_mngr::ApplicationManager& app_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state) OVERRIDE; - /** * @brief ProcessResumptionSubscription send appropriate subscribe requests * to HMI diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc index c5bc79f09d..7cdfc73ed0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc @@ -61,18 +61,6 @@ bool SDLRPCPlugin::Init(app_mngr::ApplicationManager& app_manager, return true; } -bool SDLRPCPlugin::Init( - application_manager::ApplicationManager& app_manager, - application_manager::rpc_service::RPCService& rpc_service, - application_manager::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state) { - UNUSED(last_state); - command_factory_.reset(new sdl_rpc_plugin::SDLCommandFactory( - app_manager, rpc_service, hmi_capabilities, policy_handler)); - return true; -} - bool SDLRPCPlugin::IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource message_source) { diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h index 1910a9efdf..8c67bc1d10 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h @@ -55,13 +55,6 @@ class VehicleInfoPlugin : public plugins::RPCPlugin { policy::PolicyHandlerInterface& policy_handler, resumption::LastStateWrapperPtr last_state) OVERRIDE; - DEPRECATED - bool Init(app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state) OVERRIDE; - bool IsAbleToProcess( const int32_t function_id, const app_mngr::commands::Command::CommandSource source) OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc index 1a357a86ee..b20e52636c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc @@ -88,25 +88,6 @@ bool VehicleInfoPlugin::Init( return true; } -bool VehicleInfoPlugin::Init( - application_manager::ApplicationManager& application_manager, - application_manager::rpc_service::RPCService& rpc_service, - application_manager::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state) { - UNUSED(last_state); - application_manager_ = &application_manager; - custom_vehicle_data_manager_.reset( - new CustomVehicleDataManagerImpl(policy_handler, rpc_service)); - command_factory_.reset(new vehicle_info_plugin::VehicleInfoCommandFactory( - application_manager, - rpc_service, - hmi_capabilities, - policy_handler, - *(custom_vehicle_data_manager_.get()))); - return true; -} - bool VehicleInfoPlugin::IsAbleToProcess( const int32_t function_id, const commands::Command::CommandSource source) { return command_factory_->IsAbleToProcess(function_id, source); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index d2104dbf1a..884b5df0ee 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -304,13 +304,6 @@ ApplicationSharedPtr ApplicationManagerImpl::pending_application_by_policy_id( return FindPendingApp(accessor, finder); } -ApplicationSharedPtr ApplicationManagerImpl::application_by_name( - const std::string& app_name) const { - AppNamePredicate finder(app_name); - DataAccessor accessor = applications(); - return FindApp(accessor, finder); -} - ApplicationSharedPtr ApplicationManagerImpl::reregister_application_by_policy_id( const std::string& policy_app_id) const { @@ -2502,11 +2495,6 @@ void ApplicationManagerImpl::RemoveHMIFakeParameters( (*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = mobile_function_id; } -bool ApplicationManagerImpl::Init(resumption::LastState&, - media_manager::MediaManager*) { - return false; -} - bool ApplicationManagerImpl::Init( resumption::LastStateWrapperPtr last_state_wrapper, media_manager::MediaManager* media_manager) { @@ -3515,53 +3503,6 @@ bool ApplicationManagerImpl::CanAppStream( return HMIStateAllowsStreaming(app_id, service_type) && is_allowed; } -void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) { - using namespace mobile_apis::AppInterfaceUnregisteredReason; - using namespace mobile_apis::Result; - - SDL_LOG_AUTO_TRACE(); - - ApplicationSharedPtr app = application(app_id); - if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - SDL_LOG_DEBUG( - "There is no navi or projection application with id: " << app_id); - return; - } - - { - sync_primitives::AutoLock lock(navi_app_to_stop_lock_); - if (navi_app_to_stop_.end() != std::find(navi_app_to_stop_.begin(), - navi_app_to_stop_.end(), - app_id) || - navi_app_to_end_stream_.end() != - std::find(navi_app_to_end_stream_.begin(), - navi_app_to_end_stream_.end(), - app_id)) { - return; - } - } - - bool unregister = false; - { - sync_primitives::AutoLock lock(navi_service_status_lock_); - - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() == it || - (!it->second.first && !it->second.second)) { - unregister = true; - } - } - if (unregister) { - rpc_service_->ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - app_id, PROTOCOL_VIOLATION), - commands::Command::SOURCE_SDL); - UnregisterApplication(app_id, ABORTED); - return; - } - EndNaviServices(app_id); -} - void ApplicationManagerImpl::ForbidStreaming( uint32_t app_id, protocol_handler::ServiceType service_type) { using namespace mobile_apis::AppInterfaceUnregisteredReason; @@ -3645,48 +3586,6 @@ void ApplicationManagerImpl::OnAppStreaming( } } -void ApplicationManagerImpl::OnAppStreaming( - uint32_t app_id, - protocol_handler::ServiceType service_type, - const Application::StreamingState new_state) { - SDL_LOG_AUTO_TRACE(); - - ApplicationSharedPtr app = application(app_id); - if (!app || (!app->is_navi() && !app->mobile_projection_enabled())) { - SDL_LOG_DEBUG( - " There is no navi or projection application with id: " << app_id); - return; - } - DCHECK_OR_RETURN_VOID(media_manager_); - - SDL_LOG_DEBUG("New state for service " << static_cast(service_type) - << " is " - << static_cast(new_state)); - switch (new_state) { - case Application::StreamingState::kStopped: { - // Stop activity in media_manager_ when service is stopped - // State controller has been already notified by kSuspended event - // received before - media_manager_->StopStreaming(app_id, service_type); - break; - } - - case Application::StreamingState::kStarted: { - // Apply temporary streaming state and start activity in media_manager_ - state_ctrl_.OnVideoStreamingStarted(app); - media_manager_->StartStreaming(app_id, service_type); - break; - } - - case Application::StreamingState::kSuspended: { - // Don't stop activity in media_manager_ in that case - // Just cancel the temporary streaming state - state_ctrl_.OnVideoStreamingStopped(app); - break; - } - } -} - void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { using namespace protocol_handler; SDL_LOG_AUTO_TRACE(); diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc index f313e0c0a5..a8001eba91 100644 --- a/src/components/application_manager/src/hmi_capabilities_impl.cc +++ b/src/components/application_manager/src/hmi_capabilities_impl.cc @@ -431,8 +431,6 @@ void HMICapabilitiesImpl::Init( ui_language_, vr_language_, tts_language_); } -void HMICapabilitiesImpl::Init(resumption::LastState*) {} - bool HMICapabilitiesImpl::is_ui_cooperating() const { return is_ui_cooperating_; } diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index c0d61bdd4e..c8c2a25a6d 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -1236,12 +1236,6 @@ void PolicyHandler::OnPendingPermissionChange( policy_manager->RemovePendingPermissionChanges(policy_app_id); } -bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string, - const std::string& url) { - const uint32_t app_id = GetAppIdForSending(); - return SendMessageToSDK(pt_string, url, app_id); -} - bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string, const std::string& url, const uint32_t app_id) { diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index bc373d48c9..96870c12c1 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -283,10 +283,6 @@ void ResumeCtrlImpl::RemoveFromResumption(uint32_t app_id) { queue_lock_.Release(); } -bool ResumeCtrlImpl::Init(LastState&) { - return false; -} - bool ResumeCtrlImpl::SetAppHMIState( ApplicationSharedPtr application, const mobile_apis::HMILevel::eType hmi_level, diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc index 1f2d0f116f..5d6d008911 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -573,8 +573,4 @@ void ResumptionDataJson::Persist() { last_state_wrapper_->get_accessor().GetMutableData().SaveToFileSystem(); } -LastState& ResumptionDataJson::last_state() const { - return last_state_wrapper_->get_accessor().GetMutableData(); -} - } // namespace resumption diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h index e40197cc13..f0da952d18 100644 --- a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h +++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h @@ -205,9 +205,6 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities { set_seat_location_capability, void(const smart_objects::SmartObject& seat_location_capability)); - DEPRECATED - MOCK_METHOD1(Init, void(resumption::LastState* last_state)); - MOCK_METHOD1(Init, void(resumption::LastStateWrapperPtr last_state_wrapper)); MOCK_CONST_METHOD0(ccpu_version, const std::string&()); diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h index c2c02a1d0c..ed7d08e850 100644 --- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h +++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h @@ -86,8 +86,7 @@ class MockResumeCtrl : public resumption::ResumeCtrl { MOCK_METHOD1(OnAppActivated, void(app_mngr::ApplicationSharedPtr application)); MOCK_METHOD1(RemoveFromResumption, void(uint32_t app_id)); - DEPRECATED - MOCK_METHOD1(Init, bool(resumption::LastState& last_state)); + MOCK_METHOD1(Init, bool(resumption::LastStateWrapperPtr last_state)); MOCK_METHOD2(OnAppRegistrationStart, void(const std::string& policy_app_id, diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 54f7ab9f05..ef4da3e2d8 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -135,10 +135,6 @@ class ApplicationManager { public: virtual ~ApplicationManager() {} - DEPRECATED - virtual bool Init(resumption::LastState&, - media_manager::MediaManager* media_manager) = 0; - /** * Inits application manager */ @@ -210,9 +206,6 @@ class ApplicationManager { virtual ApplicationSharedPtr application_by_policy_id( const std::string& policy_app_id) const = 0; - DEPRECATED virtual ApplicationSharedPtr application_by_name( - const std::string& app_name) const = 0; - virtual ApplicationSharedPtr pending_application_by_policy_id( const std::string& policy_app_id) const = 0; @@ -867,11 +860,6 @@ class ApplicationManager { protocol_handler::ServiceType service_type, bool state) = 0; - DEPRECATED - virtual void OnAppStreaming(uint32_t app_id, - protocol_handler::ServiceType service_type, - const Application::StreamingState new_state) = 0; - /** * @brief CreateRegularState create regular HMI state for application * @param app Application @@ -899,9 +887,6 @@ class ApplicationManager { virtual bool CanAppStream( uint32_t app_id, protocol_handler::ServiceType service_type) const = 0; - DEPRECATED - virtual void ForbidStreaming(uint32_t app_id) = 0; - /** * @brief ForbidStreaming forbid the stream over the certain application. * @param app_id the application's id which should stop streaming. diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h index e7d7aa485b..93f3db76cb 100644 --- a/src/components/include/application_manager/hmi_capabilities.h +++ b/src/components/include/application_manager/hmi_capabilities.h @@ -519,9 +519,6 @@ class HMICapabilities { virtual const smart_objects::SmartObjectSPtr seat_location_capability() const = 0; - DEPRECATED - virtual void Init(resumption::LastState* last_state) = 0; - virtual void Init(resumption::LastStateWrapperPtr last_state_wrapper) = 0; /** diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h index 7ada7884bf..d79c059b34 100644 --- a/src/components/include/application_manager/policies/policy_handler_interface.h +++ b/src/components/include/application_manager/policies/policy_handler_interface.h @@ -77,9 +77,7 @@ class PolicyHandlerInterface : public VehicleDataItemProvider { virtual bool InitPolicyTable() = 0; virtual bool ResetPolicyTable() = 0; virtual bool ClearUserConsent() = 0; - // Deprecated in favor of private variant - DEPRECATED virtual bool SendMessageToSDK(const BinaryMessage& pt_string, - const std::string& url) = 0; + virtual bool ReceiveMessageFromSDK(const std::string& file, const BinaryMessage& pt_string) = 0; virtual bool UnloadPolicyLibrary() = 0; diff --git a/src/components/include/media_manager/media_manager.h b/src/components/include/media_manager/media_manager.h index 1ecdb12257..60c93843d1 100644 --- a/src/components/include/media_manager/media_manager.h +++ b/src/components/include/media_manager/media_manager.h @@ -42,13 +42,6 @@ namespace media_manager { class MediaManager { public: - DEPRECATED virtual void PlayA2DPSource(int32_t application_key) = 0; - DEPRECATED virtual void StopA2DPSource(int32_t application_key) = 0; - - DEPRECATED virtual void StartMicrophoneRecording( - int32_t application_key, - const std::string& outputFileName, - int32_t duration) = 0; virtual void StartMicrophoneRecording( int32_t application_key, const std::string& outputFileName, diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h index d9844c153b..5d57d5ca45 100644 --- a/src/components/include/policy/policy_external/policy/policy_manager.h +++ b/src/components/include/policy/policy_external/policy/policy_manager.h @@ -752,15 +752,6 @@ class PolicyManager : public usage_statistics::StatisticsManager, */ virtual const PolicySettings& get_settings() const = 0; - /** - * @deprecated Unused in EXTERNAL_PROPRIETARY policies - * @brief Finds the next URL that must be sent on OnSystemRequest retry - * @param urls vector of vectors that contain urls for each application - * @return Pair of policy application id and application url id from the - * urls vector - */ - DEPRECATED virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0; - /** * @brief Assigns new HMI types for specified application * @param device_handle device identifier diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h index 011592da49..2cea958bae 100644 --- a/src/components/include/protocol_handler/protocol_handler.h +++ b/src/components/include/protocol_handler/protocol_handler.h @@ -127,22 +127,6 @@ class ProtocolHandler { virtual const ProtocolHandlerSettings& get_settings() const = 0; virtual SessionObserver& get_session_observer() = 0; - /** - * @brief Called by connection handler to notify the context of - * OnSessionStartedCallback(). - * @param context reference to structure with started session data - * @param rejected_params list of parameters name that are rejected. - * Only valid when generated_session_id is 0. Note, even if - * generated_session_id is 0, the list may be empty. - * @param err_reason string with NACK reason. Only valid when - * generated_session_id is 0. - */ - DEPRECATED - virtual void NotifySessionStarted( - const SessionContext& context, - std::vector& rejected_params, - const std::string err_reason = std::string()) = 0; - /** * @brief Called by connection handler to notify the context of * OnSessionStartedCallback(). diff --git a/src/components/include/resumption/last_state.h b/src/components/include/resumption/last_state.h index b28e5611b7..1f54959ffc 100644 --- a/src/components/include/resumption/last_state.h +++ b/src/components/include/resumption/last_state.h @@ -45,12 +45,6 @@ class LastState { */ virtual ~LastState() {} - /** - * @brief Saves dictionary to filesystem - */ - DEPRECATED - virtual void SaveStateToFileSystem() = 0; - /** * @brief SaveToFileSystem * Saving dictionary to filesystem @@ -63,12 +57,6 @@ class LastState { */ virtual void RemoveFromFileSystem() = 0; - /** - * @brief dictionary Gets internal dictionary - * @return Reference to internal dictionary json value - */ - virtual Json::Value& get_dictionary() = 0; - /** * @brief dictionary Gets internal dictionary * @return Copy of internal dictionary json value diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index fd7ddeac15..50fb168411 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -68,10 +68,6 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_METHOD2(Init, bool(resumption::LastStateWrapperPtr last_state, media_manager::MediaManager* media_manager)); - DEPRECATED - MOCK_METHOD2(Init, - bool(resumption::LastState& last_state, - media_manager::MediaManager* media_manager)); MOCK_METHOD0(Stop, bool()); MOCK_METHOD1(set_hmi_message_handler, void(hmi_message_handler::HMIMessageHandler* handler)); @@ -117,9 +113,6 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_CONST_METHOD1(application_by_policy_id, application_manager::ApplicationSharedPtr( const std::string& policy_app_id)); - MOCK_CONST_METHOD1( - application_by_name, - application_manager::ApplicationSharedPtr(const std::string& app_name)); MOCK_CONST_METHOD1(pending_application_by_policy_id, application_manager::ApplicationSharedPtr( const std::string& policy_app_id)); @@ -319,12 +312,6 @@ class MockApplicationManager : public application_manager::ApplicationManager { void(uint32_t app_id, protocol_handler::ServiceType service_type, bool state)); - DEPRECATED - MOCK_METHOD3( - OnAppStreaming, - void(uint32_t app_id, - protocol_handler::ServiceType service_type, - const application_manager::Application::StreamingState new_state)); MOCK_CONST_METHOD6(CreateRegularState, application_manager::HmiStatePtr( application_manager::ApplicationSharedPtr app, @@ -339,8 +326,6 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_CONST_METHOD2(CanAppStream, bool(uint32_t app_id, protocol_handler::ServiceType service_type)); - DEPRECATED - MOCK_METHOD1(ForbidStreaming, void(uint32_t app_id)); MOCK_METHOD2(ForbidStreaming, void(uint32_t app_id, protocol_handler::ServiceType service_type)); diff --git a/src/components/include/test/application_manager/mock_rpc_plugin.h b/src/components/include/test/application_manager/mock_rpc_plugin.h index 2633825428..2dba5367c6 100644 --- a/src/components/include/test/application_manager/mock_rpc_plugin.h +++ b/src/components/include/test/application_manager/mock_rpc_plugin.h @@ -16,13 +16,6 @@ class MockRPCPlugin : public RPCPlugin { HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler, resumption::LastStateWrapperPtr last_state)); - DEPRECATED - MOCK_METHOD5(Init, - bool(ApplicationManager& app_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler, - resumption::LastState& last_state)); MOCK_METHOD2(IsAbleToProcess, bool(const int32_t function_id, const commands::Command::CommandSource message_source)); diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h index af4019ce21..ca5d25ed4c 100644 --- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h +++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h @@ -53,9 +53,6 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface { MOCK_METHOD0(InitPolicyTable, bool()); MOCK_METHOD0(ResetPolicyTable, bool()); MOCK_METHOD0(ClearUserConsent, bool()); - MOCK_METHOD2(SendMessageToSDK, - bool(const policy::BinaryMessage& pt_string, - const std::string& url)); MOCK_METHOD2(ReceiveMessageFromSDK, bool(const std::string& file, const policy::BinaryMessage& pt_string)); diff --git a/src/components/include/test/media_manager/mock_media_manager.h b/src/components/include/test/media_manager/mock_media_manager.h index 364c495236..cfee287d12 100644 --- a/src/components/include/test/media_manager/mock_media_manager.h +++ b/src/components/include/test/media_manager/mock_media_manager.h @@ -41,12 +41,6 @@ namespace media_manager_test { class MockMediaManager : public media_manager::MediaManager { public: - MOCK_METHOD1(PlayA2DPSource, void(int32_t application_key)); - MOCK_METHOD1(StopA2DPSource, void(int32_t application_key)); - MOCK_METHOD3(StartMicrophoneRecording, - void(int32_t application_key, - const std::string& outputFileName, - int32_t duration)); MOCK_METHOD6(StartMicrophoneRecording, void(int32_t application_key, const std::string& outputFileName, diff --git a/src/components/include/test/resumption/mock_last_state.h b/src/components/include/test/resumption/mock_last_state.h index 99c3799a95..c646dcd286 100644 --- a/src/components/include/test/resumption/mock_last_state.h +++ b/src/components/include/test/resumption/mock_last_state.h @@ -43,10 +43,6 @@ namespace resumption_test { class MockLastState : public resumption::LastState { public: - DEPRECATED - MOCK_METHOD0(SaveStateToFileSystem, void()); - DEPRECATED - MOCK_METHOD0(get_dictionary, Json::Value&()); MOCK_METHOD0(SaveToFileSystem, void()); MOCK_METHOD0(RemoveFromFileSystem, void()); MOCK_CONST_METHOD0(dictionary, Json::Value()); diff --git a/src/components/include/test/transport_manager/mock_transport_manager.h b/src/components/include/test/transport_manager/mock_transport_manager.h index 1920af18a3..7aa70b8061 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager.h +++ b/src/components/include/test/transport_manager/mock_transport_manager.h @@ -57,8 +57,6 @@ class MockTransportManager : public ::transport_manager::TransportManager, transport_manager::TMTelemetryObserver> { public: MOCK_METHOD1(Init, int(resumption::LastStateWrapperPtr last_state)); - DEPRECATED - MOCK_METHOD1(Init, int(resumption::LastState& last_state)); MOCK_METHOD0(Reinit, int()); MOCK_METHOD0(Deinit, void()); MOCK_METHOD0(StopEventsProcessing, void()); diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h index 4697bf9982..45bb159aa2 100644 --- a/src/components/include/transport_manager/transport_manager.h +++ b/src/components/include/transport_manager/transport_manager.h @@ -53,9 +53,6 @@ class TransportManager { **/ virtual ~TransportManager() {} - DEPRECATED - virtual int Init(resumption::LastState& last_state) = 0; - /** * @brief Initialize transport manager. * @return Error code. diff --git a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h index 9e0a8b5123..5ecb1a6b4a 100644 --- a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h +++ b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h @@ -53,7 +53,6 @@ class FromMicRecorderAdapter : public MediaAdapterImpl { void StopActivity(int32_t application_key); bool is_app_performing_activity(int32_t application_key) const; void set_output_file(const std::string& output_file); - DEPRECATED void set_duration(int32_t duration); void set_config(mobile_apis::SamplingRate::eType sampling_rate, mobile_apis::BitsPerSample::eType bits_per_sample, mobile_apis::AudioType::eType audio_type, diff --git a/src/components/media_manager/include/media_manager/media_manager_impl.h b/src/components/media_manager/include/media_manager/media_manager_impl.h index f8e94cbbb2..faa51feec9 100644 --- a/src/components/media_manager/include/media_manager/media_manager_impl.h +++ b/src/components/media_manager/include/media_manager/media_manager_impl.h @@ -60,13 +60,6 @@ class MediaManagerImpl : public MediaManager, const MediaManagerSettings& settings); virtual ~MediaManagerImpl(); - DEPRECATED virtual void PlayA2DPSource(int32_t application_key); - DEPRECATED virtual void StopA2DPSource(int32_t application_key); - - DEPRECATED virtual void StartMicrophoneRecording( - int32_t application_key, - const std::string& outputFileName, - int32_t duration); virtual void StartMicrophoneRecording( int32_t application_key, const std::string& outputFileName, diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc index 4fc8b38d87..8a73101b47 100644 --- a/src/components/media_manager/src/media_manager_impl.cc +++ b/src/components/media_manager/src/media_manager_impl.cc @@ -184,39 +184,6 @@ void MediaManagerImpl::Init() { } } -void MediaManagerImpl::PlayA2DPSource(int32_t application_key) { - SDL_LOG_AUTO_TRACE(); - -#if defined(EXTENDED_MEDIA_MODE) - if (!a2dp_player_ && protocol_handler_) { - a2dp_player_ = - new A2DPSourcePlayerAdapter(protocol_handler_->get_session_observer()); - } -#endif - - if (a2dp_player_) { - a2dp_player_->StartActivity(application_key); - } -} - -void MediaManagerImpl::StopA2DPSource(int32_t application_key) { - SDL_LOG_AUTO_TRACE(); - if (a2dp_player_) { - a2dp_player_->StopActivity(application_key); - } -} - -void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key, - const std::string& output_file, - int32_t duration) { - StartMicrophoneRecording(application_key, - output_file, - duration, - mobile_apis::SamplingRate::INVALID_ENUM, - mobile_apis::BitsPerSample::INVALID_ENUM, - mobile_apis::AudioType::INVALID_ENUM); -} - void MediaManagerImpl::StartMicrophoneRecording( int32_t application_key, const std::string& output_file, diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index 813af17b3f..2be8183bfa 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -790,14 +790,6 @@ class PolicyManagerImpl : public PolicyManager { */ const PolicySettings& get_settings() const OVERRIDE; - /** - * @brief Finds the next URL that must be sent on OnSystemRequest retry - * @param urls vector of vectors that contain urls for each application - * @return Pair of policy application id and application url id from the - * urls vector - */ - DEPRECATED AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) OVERRIDE; - /** * @brief Checks if there is existing URL in the EndpointUrls vector with * index saved in the policy manager and if not, it moves to the next diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index b1e1c85490..75920be58c 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -2143,18 +2143,6 @@ void PolicyManagerImpl::SetDecryptedCertificate( cache_->SetDecryptedCertificate(certificate); } -AppIdURL PolicyManagerImpl::GetNextUpdateUrl(const EndpointUrls& urls) { - SDL_LOG_AUTO_TRACE(); - - const AppIdURL next_app_url = RetrySequenceUrl(retry_sequence_url_, urls); - - retry_sequence_url_.url_idx_ = next_app_url.second + 1; - retry_sequence_url_.app_idx_ = next_app_url.first; - retry_sequence_url_.policy_app_id_ = urls[next_app_url.first].app_id; - - return next_app_url; -} - AppIdURL PolicyManagerImpl::RetrySequenceUrl(const struct RetrySequenceURL& rs, const EndpointUrls& urls) const { uint32_t url_idx = rs.url_idx_; diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h index 02c96fc3c7..b036735216 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h @@ -462,11 +462,6 @@ class ProtocolHandlerImpl * Only valid when generated_session_id is 0. Note, even if * generated_session_id is 0, the list may be empty. */ - DEPRECATED - void NotifySessionStarted(const SessionContext& context, - std::vector& rejected_params, - const std::string err_reason) OVERRIDE; - void NotifySessionStarted(SessionContext& context, std::vector& rejected_params, const std::string err_reason) OVERRIDE; diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 2595b26886..7b5d9901ea 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -2128,14 +2128,6 @@ void ProtocolHandlerImpl::NotifySessionStarted( } } -void ProtocolHandlerImpl::NotifySessionStarted( - const SessionContext& context, - std::vector& rejected_params, - const std::string err_reason) { - SessionContext context_copy = context; - NotifySessionStarted(context_copy, rejected_params, err_reason); -} - RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( const ProtocolPacket& packet) { const ConnectionID connection_id = packet.connection_id(); diff --git a/src/components/resumption/include/resumption/last_state_impl.h b/src/components/resumption/include/resumption/last_state_impl.h index 5eb4050d2d..8495c39d04 100644 --- a/src/components/resumption/include/resumption/last_state_impl.h +++ b/src/components/resumption/include/resumption/last_state_impl.h @@ -57,9 +57,6 @@ class LastStateImpl : public LastState { */ ~LastStateImpl(); - DEPRECATED - void SaveStateToFileSystem(); - /** * @brief Saving dictionary to filesystem */ @@ -76,12 +73,6 @@ class LastStateImpl : public LastState { */ Json::Value dictionary() const OVERRIDE; - /** - * @brief Get the dictionary - * @return Reference to the dictionary - */ - DEPRECATED Json::Value& get_dictionary(); - /** * @brief Resets internal dictionary * @param dictionary New dictionary json value to be set diff --git a/src/components/resumption/src/last_state_impl.cc b/src/components/resumption/src/last_state_impl.cc index 2083369a8e..9920a1499b 100644 --- a/src/components/resumption/src/last_state_impl.cc +++ b/src/components/resumption/src/last_state_impl.cc @@ -52,28 +52,6 @@ LastStateImpl::~LastStateImpl() { SaveToFileSystem(); } -void LastStateImpl::SaveStateToFileSystem() { - SDL_LOG_AUTO_TRACE(); - - std::string styled_string; - { - sync_primitives::AutoLock lock(dictionary_lock_); - styled_string = dictionary_.toStyledString(); - } - - const std::string full_path = - !app_storage_folder_.empty() - ? app_storage_folder_ + "/" + app_info_storage_ - : app_info_storage_; - - const std::vector char_vector_pdata(styled_string.begin(), - styled_string.end()); - DCHECK(file_system::CreateDirectoryRecursively(app_storage_folder_)); - SDL_LOG_INFO("LastState::SaveStateToFileSystem[DEPRECATED] " - << full_path << styled_string); - DCHECK(file_system::Write(full_path, char_vector_pdata)); -} - void LastStateImpl::SaveToFileSystem() { SDL_LOG_AUTO_TRACE(); @@ -124,11 +102,6 @@ Json::Value LastStateImpl::dictionary() const { return dictionary_; } -Json::Value& LastStateImpl::get_dictionary() { - sync_primitives::AutoLock lock(dictionary_lock_); - return dictionary_; -} - void LastStateImpl::set_dictionary(const Json::Value& dictionary) { DCHECK(dictionary.type() == Json::objectValue || dictionary.type() == Json::nullValue); diff --git a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h index 5429f50f7f..6e36877e2d 100644 --- a/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h +++ b/src/components/transport_manager/include/transport_manager/bluetooth/bluetooth_transport_adapter.h @@ -52,10 +52,6 @@ class BluetoothTransportAdapter : public TransportAdapterImpl { BluetoothTransportAdapter(resumption::LastStateWrapperPtr last_state_wrapper, const TransportManagerSettings& settings); - DEPRECATED - BluetoothTransportAdapter(resumption::LastState&, - const TransportManagerSettings& settings); - protected: /** * @brief Return type of device. diff --git a/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h b/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h index 3dabfb39ca..4525f6b5d9 100644 --- a/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h +++ b/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h @@ -63,11 +63,6 @@ class IAP2BluetoothEmulationTransportAdapter : public TcpTransportAdapter { resumption::LastStateWrapperPtr last_state_wrapper, const TransportManagerSettings& settings); - DEPRECATED - IAP2BluetoothEmulationTransportAdapter( - const uint16_t port, - resumption::LastState& last_state_wrapper, - const TransportManagerSettings& settings); /** * @brief DeviceSwitched is called during switching from iAP2 Bluetooth to * iAP2 USB transport. @@ -113,12 +108,6 @@ class IAP2USBEmulationTransportAdapter : public TcpTransportAdapter { resumption::LastStateWrapperPtr last_state_wrapper, const TransportManagerSettings& settings); - DEPRECATED - IAP2USBEmulationTransportAdapter(const uint16_t port, - resumption::LastState&, - const TransportManagerSettings& settings) = - delete; - /** * Destructor */ diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h index c5948062c9..1cd5c1cb7b 100644 --- a/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h +++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_transport_adapter.h @@ -53,11 +53,6 @@ class TcpTransportAdapter : public TransportAdapterImpl { resumption::LastStateWrapperPtr last_state_wrapper, const TransportManagerSettings& settings); - DEPRECATED - TcpTransportAdapter(uint16_t port, - resumption::LastState&, - const TransportManagerSettings& settings) = delete; - /** * @brief Destructor. */ diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h index cfc886cb15..58dd4b16db 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h @@ -85,13 +85,6 @@ class TransportAdapterImpl : public TransportAdapter, resumption::LastStateWrapperPtr last_state_wrapper, const TransportManagerSettings& settings); - DEPRECATED - TransportAdapterImpl(DeviceScanner* device_scanner, - ServerConnectionFactory* server_connection_factory, - ClientConnectionListener* client_connection_listener, - resumption::LastState& last_state, - const TransportManagerSettings& settings) = delete; - /** * @brief Destructor. **/ @@ -677,10 +670,6 @@ class TransportAdapterImpl : public TransportAdapter, TMTelemetryObserver* metric_observer_; #endif // TELEMETRY_MONITOR - resumption::LastState& last_state() const { - return last_state_wrapper_->get_accessor().GetMutableData(); - } - /** * @brief Pointer to the device scanner. */ diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_default.h b/src/components/transport_manager/include/transport_manager/transport_manager_default.h index 81fc92dc38..d9407276b0 100644 --- a/src/components/transport_manager/include/transport_manager/transport_manager_default.h +++ b/src/components/transport_manager/include/transport_manager/transport_manager_default.h @@ -82,9 +82,6 @@ class TransportManagerDefault : public TransportManagerImpl { */ int Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE; - DEPRECATED - int Init(resumption::LastState& last_state) OVERRIDE; - /** * @brief Destructor. */ diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h index 85d96bac55..b45d7cc379 100644 --- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h @@ -126,9 +126,6 @@ class TransportManagerImpl */ int Init(resumption::LastStateWrapperPtr last_state_wrapper) OVERRIDE; - DEPRECATED - int Init(resumption::LastState& last_state) OVERRIDE; - /** * Reinitializes transport manager * @return Error code diff --git a/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h b/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h index 45c6d4c0e4..12516e769e 100644 --- a/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h +++ b/src/components/transport_manager/include/transport_manager/usb/usb_aoa_adapter.h @@ -47,10 +47,6 @@ class UsbAoaAdapter : public TransportAdapterImpl { UsbAoaAdapter(resumption::LastStateWrapperPtr last_state_wrapper, const TransportManagerSettings& settings); - DEPRECATED - UsbAoaAdapter(resumption::LastState&, - const TransportManagerSettings& settings) = delete; - virtual ~UsbAoaAdapter(); protected: diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc index 45d0b04528..0ffb8432ea 100644 --- a/src/components/transport_manager/src/transport_manager_default.cc +++ b/src/components/transport_manager/src/transport_manager_default.cc @@ -190,10 +190,6 @@ int TransportManagerDefault::Init( return E_SUCCESS; } -int TransportManagerDefault::Init(resumption::LastState&) { - return 1; -} - TransportManagerDefault::~TransportManagerDefault() {} } // namespace transport_manager diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index bb6f3626e1..5f4ddc9d7e 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -582,15 +582,6 @@ int TransportManagerImpl::Init( return E_SUCCESS; } -int TransportManagerImpl::Init(resumption::LastState& last_state) { - // Last state required to initialize Transport adapters - UNUSED(last_state); - SDL_LOG_TRACE("enter"); - is_initialized_ = true; - SDL_LOG_TRACE("exit with E_SUCCESS"); - return E_SUCCESS; -} - void TransportManagerImpl::Deinit() { SDL_LOG_AUTO_TRACE(); DisconnectAllDevices(); diff --git a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc index 68f23a6326..18c6ad9be1 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc @@ -100,7 +100,9 @@ TransportAdapter::Error WebSocketServerTransportAdapter::Init() { void WebSocketServerTransportAdapter::Store() const { SDL_LOG_AUTO_TRACE(); if (webengine_device_) { - Json::Value& dictionary = last_state().get_dictionary(); + resumption::LastStateAccessor accessor = + last_state_wrapper_->get_accessor(); + Json::Value dictionary = accessor.GetData().dictionary(); if (dictionary["TransportManager"].isMember("WebsocketServerAdapter")) { SDL_LOG_DEBUG( "WebsocketServerAdapter already exists. Storing is skipped"); @@ -119,7 +121,8 @@ void WebSocketServerTransportAdapter::Store() const { bool WebSocketServerTransportAdapter::Restore() { SDL_LOG_AUTO_TRACE(); - const Json::Value& dictionary = last_state().get_dictionary(); + resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); + Json::Value dictionary = accessor.GetData().dictionary(); const Json::Value ws_adapter_dictionary = dictionary["TransportManager"]["WebsocketServerAdapter"]; webengine_device_id_ = diff --git a/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h index 5aedfd58aa..4f5cbf71eb 100644 --- a/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h +++ b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h @@ -54,10 +54,6 @@ using namespace ::protocol_handler; class RawMessageMatcher : public MatcherInterface { public: explicit RawMessageMatcher(RawMessagePtr ptr); - - DEPRECATED - virtual bool MatchAndExplain(const RawMessagePtr msg, - MatchResultListener* listener) const; virtual void DescribeTo(std::ostream* os) const; virtual void DescribeNegationTo(std::ostream* os) const; diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h index 7b1d720ba2..4be51431d7 100644 --- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h +++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h @@ -66,13 +66,6 @@ class MockTransportAdapterImpl : public TransportAdapterImpl { last_state_wrapper, settings) {} - DEPRECATED - MockTransportAdapterImpl(DeviceScanner*, - ServerConnectionFactory*, - ClientConnectionListener*, - resumption::LastState&, - const transport_manager::TransportManagerSettings&); - ConnectionSPtr FindStatedConnection(const DeviceUID& device_handle, const ApplicationHandle& app_handle) { return this->FindEstablishedConnection(device_handle, app_handle); diff --git a/src/components/transport_manager/test/transport_manager_default_test.cc b/src/components/transport_manager/test/transport_manager_default_test.cc index 67b4a0a8ba..66cfa85ef9 100644 --- a/src/components/transport_manager/test/transport_manager_default_test.cc +++ b/src/components/transport_manager/test/transport_manager_default_test.cc @@ -210,8 +210,6 @@ void TestTransportManagerDefault::ExpectationsSettings_TM( .WillByDefault(ReturnRef(kWSServerCACertPath)); ON_CALL(*mock_last_state_, dictionary()) .WillByDefault(Return(custom_dictionary_)); - ON_CALL(*mock_last_state_, get_dictionary()) - .WillByDefault(ReturnRef(custom_dictionary_)); EXPECT_CALL(transport_manager_settings_, use_last_state()) .WillRepeatedly(Return(use_last_state)); diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h index 232d9583b1..382f38e520 100644 --- a/src/components/utils/include/utils/file_system.h +++ b/src/components/utils/include/utils/file_system.h @@ -257,9 +257,6 @@ bool ReadBinaryFile(const std::string& name, bool ReadFile(const std::string& name, std::string& result); -DEPRECATED -const std::string ConvertPathForURL(const std::string& path); - /** * @brief Create empty file * diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc index f0c838a7f9..b2c1f44c53 100644 --- a/src/components/utils/src/file_system.cc +++ b/src/components/utils/src/file_system.cc @@ -458,25 +458,6 @@ bool file_system::ReadFile(const std::string& name, std::string& result) { return true; } -const std::string file_system::ConvertPathForURL(const std::string& path) { - SDL_LOG_AUTO_TRACE(); - const std::string reserved_symbols = "!#$&'()*+,:;=?@[] "; - std::string converted_path; - - for (const auto symbol : path) { - size_t pos = reserved_symbols.find_first_of(symbol); - if (pos != std::string::npos) { - const size_t size = 100; - char percent_value[size]; - snprintf(percent_value, size, "%%%x", symbol); - converted_path += percent_value; - } else { - converted_path += symbol; - } - } - return converted_path; -} - bool file_system::CreateFile(const std::string& path) { SDL_LOG_AUTO_TRACE(); -- cgit v1.2.1 From 82476469248d60d00f785e0dbd066369db1ffbf0 Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Thu, 22 Jul 2021 09:55:14 -0400 Subject: Fix cmake warning under external flow (#3730) * Established the new policy for CMP0054 and added if and else for different Policy values --- CMakeLists.txt | 1 + src/components/policy/policy_external/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e638310f88..3b53b87e39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ # POSSIBILITY OF SUCH DAMAGE. cmake_minimum_required(VERSION 2.8.11) +cmake_policy(SET CMP0054 NEW) set (PROJECT smartDeviceLinkCore) project (${PROJECT}) diff --git a/src/components/policy/policy_external/CMakeLists.txt b/src/components/policy/policy_external/CMakeLists.txt index 72f7dd7bdb..0e3735093f 100644 --- a/src/components/policy/policy_external/CMakeLists.txt +++ b/src/components/policy/policy_external/CMakeLists.txt @@ -132,7 +132,7 @@ if (ENABLE_LOG AND ${LOGGER_NAME} STREQUAL "LOG4CXX") target_link_libraries(Policy log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) endif() -add_custom_target(copy_library_Policy ALL +add_custom_target(copy_policy_library ALL COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${library_name} ${copy_destination} -- cgit v1.2.1 From 1df399beed9b523323240fb5fe7fcc9309669d2b Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Thu, 22 Jul 2021 09:59:04 -0400 Subject: adding the interface name to the types in HMI_API.xml (#3742) Co-authored-by: Roman Reznichenko --- src/components/interfaces/HMI_API.xml | 144 +++++++++++++++++----------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index 92806e7372..b185b88ada 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1809,10 +1809,10 @@ uuid of a module. "moduleId + moduleType" uniquely identify a module. - + Location of a module. - + Service area of a module. @@ -1832,7 +1832,7 @@ - + Contains a list of SeatLocation in the vehicle @@ -1880,8 +1880,8 @@ Specify the mode of a massage zone. - - + + @@ -1895,7 +1895,7 @@ The intensity or firmness of a cushion. - + @@ -1914,7 +1914,7 @@ - + @@ -1925,7 +1925,7 @@ Seat control data corresponds to "SEAT" ModuleType. - + @@ -1941,9 +1941,9 @@ - - - + + + @@ -1953,7 +1953,7 @@ It should not be used to identify a module by mobile application. - + Information about a RC module, including its id. @@ -2107,13 +2107,13 @@ Identifies the 4-alpha-character station call sign plus an optional (-FM) extension - + Used for network Application. Consists of Country Code and FCC Facility ID. Identifies the station call sign or other identifying information in the long format. - + Provides the 3-dimensional geographic station location. @@ -2157,7 +2157,7 @@ - + Read-only Station Information Service (SIS) data provides basic information about the station such as call sign, as well as information not displayable to the consumer such as the station identification number @@ -2167,7 +2167,7 @@ The short name or a short description of the radio control module. - + Information about a RC module, including its id. @@ -2293,7 +2293,7 @@ - + @@ -2322,7 +2322,7 @@ The short name or a short description of the climate control module. - + Information about a RC module, including its id. @@ -2437,7 +2437,7 @@ - + In a getter response or a notification, it is the current primary audio source of the system. In a setter request, it is the target audio source that the system shall switch to. @@ -2456,7 +2456,7 @@ Reflects the volume of audio, from 0%-100%. - + Defines the list of supported channels (band) and their current/desired settings on HMI @@ -2468,7 +2468,7 @@ It should not be used to identify a module by mobile application. - + Information about a RC module, including its id. @@ -2605,7 +2605,7 @@ - + Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request. @@ -2630,25 +2630,25 @@ It should not be used to identify a module by mobile application. - + Information about a RC module, including its id. - + An array of available light names that are controllable. - + The name of a light or a group of lights. - + - + - + An array of LightNames and their current or desired status. No change to the status of the LightNames that are not listed in the array. @@ -2665,9 +2665,9 @@ Corresponds to "HMI_SETTINGS" ModuleType - - - + + + @@ -2677,7 +2677,7 @@ It should not be used to identify a module by mobile application. - + Information about a RC module, including its id. @@ -2702,13 +2702,13 @@ - + - + - + - + @@ -2744,7 +2744,7 @@ The name of the Button from the ButtonName enum - + Information about a RC module, including its id. @@ -2886,8 +2886,8 @@ Currently only predefined window template layouts are defined. - - + + @@ -3280,7 +3280,7 @@ The status of component volume. See ComponentVolumeStatus. - + The status of TPMS according to the particular tire. @@ -3638,7 +3638,7 @@ - + Latitude/Longitude of the location. @@ -3653,10 +3653,10 @@ Phone number of location / establishment. - + Image / icon of intended location. - + Address to be used by navigation engines for search @@ -3708,24 +3708,24 @@ The preferred frame rate per second of the head unit. The mobile application / app library may take other factors into account that constrain the frame rate lower than this value, but it should not perform streaming at a higher frame rate than this value. - + - + Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other param included. - + Describes supported capabilities for video streaming - + An array of ImageFieldName values for which the system supports sending OnFileUpdate notifications. If you send an Image struct for that image field with a name without having uploaded the image data using PutFile that matches that name, the system will request that you upload the data with PutFile at a later point when the HMI needs it. The HMI will then display the image in the appropriate field. If not sent, assume false. @@ -3743,7 +3743,7 @@ Describes the capabilities of a single keyboard layout. - + Number of keys available for special characters, App can customize as per their needs. @@ -3753,7 +3753,7 @@ Availability of capability to mask input characters using keyboard. True: Available, False: Not Available - + Capabilities of supported keyboard layouts by HMI. @@ -3765,13 +3765,13 @@ or omitted for the main window on the main display. - + A set of all fields that support text data. See TextField - + A set of all fields that support images. See ImageField - + Provides information about image types supported by the system. @@ -3780,19 +3780,19 @@ The number of on-window custom presets available (if any); otherwise omitted. - + The number of buttons and the capabilities of each on-window button. - + The number of soft buttons available on-window and the capabilities for each button. An array of available menu layouts. If this parameter is not provided, only the `LIST` layout is assumed to be available - + Contains the head unit's capabilities for dynamic updating features declaring if the module will send dynamic update RPCs. - + See KeyboardCapabilities @@ -3800,12 +3800,12 @@ Contains information about the display capabilities. - + Informs the application how many windows the app is allowed to create per type. - + Contains a list of capabilities of all windows related to the app. Once the app has registered the capabilities of all windows are provided. @@ -3830,39 +3830,39 @@ - + - + - + - + Describes capabilities when the driver is distracted - + If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported. - + If included, the platform supports RC radio controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported. - + If included, the platform supports RC button controls with the included button names. - + If included, the platform supports seat controls. - + If included, the platform supports audio controls. - + If included, the platform supports hmi setting controls. - + If included, the platform supports light controls. @@ -4395,10 +4395,10 @@ - + Contains information about the locations of each seat - + Describes capabilities when the driver is distracted @@ -4471,7 +4471,7 @@ The seek next / skip previous subscription buttons' content - + If the type is TIME, this number of seconds may be present alongside the skip indicator. -- cgit v1.2.1 From 473400504342e0f4271e5bf187c66188eb13fe9f Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Thu, 22 Jul 2021 10:53:19 -0400 Subject: Fix resumption for menuLayout global property (#3733) * Added methods get and set the menuLayout and added to the request on the HMI this field * fixup! Added methods get and set the menuLayout and added to the request on the HMI this field Co-authored-by: Roman Reznichenko --- .../include/application_manager/application.h | 3 +++ .../include/application_manager/application_data_impl.h | 3 +++ .../src/commands/mobile/set_global_properties_request.cc | 1 + .../application_manager/src/application_data_impl.cc | 16 ++++++++++++++++ .../src/helpers/application_helper.cc | 1 + .../src/message_helper/message_helper.cc | 8 +++++++- .../src/resumption/resumption_data.cc | 2 ++ .../application_manager/test/application_helper_test.cc | 5 +++++ .../test/include/application_manager/mock_application.h | 3 +++ 9 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index f25afeb2bc..2d7006e19a 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -203,6 +203,7 @@ class DynamicApplicationData { virtual const smart_objects::SmartObject* keyboard_props() const = 0; virtual const smart_objects::SmartObject* menu_title() const = 0; virtual const smart_objects::SmartObject* menu_icon() const = 0; + virtual const smart_objects::SmartObject* menu_layout() const = 0; virtual smart_objects::SmartObject day_color_scheme() const = 0; virtual smart_objects::SmartObject night_color_scheme() const = 0; virtual std::string display_layout() const = 0; @@ -242,6 +243,8 @@ class DynamicApplicationData { const smart_objects::SmartObject& keyboard_props) = 0; virtual void set_menu_title(const smart_objects::SmartObject& menu_title) = 0; virtual void set_menu_icon(const smart_objects::SmartObject& menu_icon) = 0; + virtual void set_menu_layout( + const smart_objects::SmartObject& menu_layout) = 0; virtual uint32_t audio_stream_retry_number() const = 0; diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h index a64e0c8f33..086e71b48b 100644 --- a/src/components/application_manager/include/application_manager/application_data_impl.h +++ b/src/components/application_manager/include/application_manager/application_data_impl.h @@ -102,6 +102,7 @@ class DynamicApplicationDataImpl : public virtual Application { const smart_objects::SmartObject* keyboard_props() const; const smart_objects::SmartObject* menu_title() const; const smart_objects::SmartObject* menu_icon() const; + const smart_objects::SmartObject* menu_layout() const; smart_objects::SmartObject day_color_scheme() const OVERRIDE; smart_objects::SmartObject night_color_scheme() const OVERRIDE; @@ -141,6 +142,7 @@ class DynamicApplicationDataImpl : public virtual Application { void set_keyboard_props(const smart_objects::SmartObject& keyboard_props); void set_menu_title(const smart_objects::SmartObject& menu_title); void set_menu_icon(const smart_objects::SmartObject& menu_icon); + void set_menu_layout(const smart_objects::SmartObject& menu_layout); void set_day_color_scheme(const smart_objects::SmartObject& color_scheme); void set_night_color_scheme(const smart_objects::SmartObject& color_scheme); void set_display_layout(const std::string& layout); @@ -323,6 +325,7 @@ class DynamicApplicationDataImpl : public virtual Application { smart_objects::SmartObject* keyboard_props_; smart_objects::SmartObject* menu_title_; smart_objects::SmartObject* menu_icon_; + smart_objects::SmartObject* menu_layout_; smart_objects::SmartObject* tbt_show_command_; smart_objects::SmartObjectSPtr display_capabilities_; AppWindowsTemplates window_templates_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc index bbce4d2bb3..0aab000376 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc @@ -186,6 +186,7 @@ void SetGlobalPropertiesRequest::Run() { msg_params[strings::menu_layout].asUInt()); if (app->menu_layout_supported(menu_layout)) { params[strings::menu_layout] = msg_params[strings::menu_layout]; + app->set_menu_layout(msg_params[strings::menu_layout]); } else { is_menu_layout_available_ = false; } diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc index e190025add..1d6ea8afe8 100644 --- a/src/components/application_manager/src/application_data_impl.cc +++ b/src/components/application_manager/src/application_data_impl.cc @@ -201,6 +201,7 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl() , keyboard_props_(nullptr) , menu_title_(nullptr) , menu_icon_(nullptr) + , menu_layout_(nullptr) , tbt_show_command_(nullptr) , commands_() , commands_lock_ptr_(std::make_shared()) @@ -349,6 +350,11 @@ const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon() return menu_icon_; } +const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_layout() + const { + return menu_layout_; +} + smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme() const { using namespace mobile_apis::PredefinedWindows; @@ -467,6 +473,8 @@ void DynamicApplicationDataImpl::load_global_properties( SetGlobalProperties(properties_so.getElement(strings::menu_icon), &DynamicApplicationData::set_menu_icon); + SetGlobalProperties(properties_so.getElement(strings::menu_layout), + &DynamicApplicationData::set_menu_layout); } void DynamicApplicationDataImpl::set_help_prompt( @@ -560,6 +568,14 @@ void DynamicApplicationDataImpl::set_menu_icon( menu_icon_ = new smart_objects::SmartObject(menu_icon); } +void DynamicApplicationDataImpl::set_menu_layout( + const smart_objects::SmartObject& menu_layout) { + if (menu_layout_) { + delete menu_layout_; + } + menu_layout_ = new smart_objects::SmartObject(menu_layout); +} + void DynamicApplicationDataImpl::set_day_color_scheme( const smart_objects::SmartObject& color_scheme) { using namespace mobile_apis::PredefinedWindows; diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc index 74810d7e09..863d85a7f0 100644 --- a/src/components/application_manager/src/helpers/application_helper.cc +++ b/src/components/application_manager/src/helpers/application_helper.cc @@ -87,6 +87,7 @@ void DeleteGlobalProperties(ApplicationSharedPtr app, app->set_keyboard_props(empty_so); app->set_menu_icon(empty_so); app->set_menu_title(empty_so); + app->set_menu_layout(empty_so); MessageHelper::SendResetPropertiesRequest(app, app_manager); } diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 301c26a750..6dbb7b35ae 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1289,7 +1289,7 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( if (can_send_ui && (app->vr_help_title() || app->vr_help() || app->keyboard_props() || - app->menu_title() || app->menu_icon())) { + app->menu_title() || app->menu_icon() || app->menu_layout())) { smart_objects::SmartObjectSPtr ui_global_properties = CreateMessageForHMI( hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (ui_global_properties) { @@ -1313,6 +1313,9 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( if (app->menu_icon()) { ui_msg_params[strings::menu_icon] = (*app->menu_icon()); } + if (app->menu_layout()) { + ui_msg_params[strings::menu_layout] = (*app->menu_layout()); + } ui_msg_params[strings::app_id] = app->app_id(); (*ui_global_properties)[strings::msg_params] = ui_msg_params; @@ -1995,6 +1998,9 @@ smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestsToHMI( msg_params[strings::menu_params][strings::parent_id] = (*i->second)[strings::parent_id]; } + if ((*i->second).keyExists(strings::menu_layout)) { + msg_params[strings::menu_layout] = (*i->second)[strings::menu_layout]; + } msg_params[strings::app_id] = app->app_id(); (*ui_sub_menu)[strings::msg_params] = msg_params; if (((*i->second).keyExists(strings::menu_icon)) && diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc index 95dd331b88..c72231d334 100644 --- a/src/components/application_manager/src/resumption/resumption_data.cc +++ b/src/components/application_manager/src/resumption/resumption_data.cc @@ -132,6 +132,8 @@ smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties( PointerToSmartObj(application->menu_title()); global_properties[strings::menu_icon] = PointerToSmartObj(application->menu_icon()); + global_properties[strings::menu_layout] = + PointerToSmartObj(application->menu_layout()); return global_properties; } diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc index 1633b9d29b..5c6d3b22f6 100644 --- a/src/components/application_manager/test/application_helper_test.cc +++ b/src/components/application_manager/test/application_helper_test.cc @@ -176,6 +176,7 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) { app_impl_->set_keyboard_props(dummy_data); app_impl_->set_menu_title(dummy_data); app_impl_->set_menu_icon(dummy_data); + app_impl_->set_menu_layout(dummy_data); const bool persistent = false; const bool downloaded = true; @@ -205,6 +206,8 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) { EXPECT_TRUE(menu_title->asString() == some_string); auto menu_icon = app_impl_->menu_icon(); EXPECT_TRUE(menu_icon->asString() == some_string); + auto menu_layout = app_impl_->menu_layout(); + EXPECT_TRUE(menu_layout->asString() == some_string); auto file_ptr = app_impl_->GetFile(filename); EXPECT_TRUE(NULL != file_ptr); EXPECT_TRUE(file_ptr->file_name == filename); @@ -239,6 +242,8 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) { EXPECT_FALSE(menu_title->asString() == some_string); menu_icon = app_impl_->menu_icon(); EXPECT_FALSE(menu_icon->asString() == some_string); + menu_layout = app_impl_->menu_layout(); + EXPECT_FALSE(menu_layout->asString() == some_string); file_ptr = app_impl_->GetFile(filename); EXPECT_TRUE(NULL == file_ptr); } diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h index 2c9fe688b4..ac2a534929 100644 --- a/src/components/application_manager/test/include/application_manager/mock_application.h +++ b/src/components/application_manager/test/include/application_manager/mock_application.h @@ -253,6 +253,7 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(menu_layout, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(day_color_scheme, smart_objects::SmartObject()); MOCK_CONST_METHOD0(night_color_scheme, smart_objects::SmartObject()); MOCK_CONST_METHOD0(display_layout, std::string()); @@ -305,6 +306,8 @@ class MockApplication : public ::application_manager::Application { void(const smart_objects::SmartObject& menu_title)); MOCK_METHOD1(set_menu_icon, void(const smart_objects::SmartObject& menu_icon)); + MOCK_METHOD1(set_menu_layout, + void(const smart_objects::SmartObject& menu_layout)); MOCK_METHOD1(set_day_color_scheme, void(const smart_objects::SmartObject& color_scheme)); MOCK_METHOD1(set_night_color_scheme, -- cgit v1.2.1 From e9b3e093980444b57dc6c82d6f9661f965954ae1 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Tue, 27 Jul 2021 17:13:22 -0400 Subject: Suspend notifications to mobile until HMI state is established (#3675) * Suspend any notifications meant for mobile app until HMI state is properly established --- .../application_manager/src/application_manager_impl.cc | 1 + src/components/application_manager/src/rpc_service_impl.cc | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 884b5df0ee..f5dedc0e35 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -451,6 +451,7 @@ void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) { sync_primitives::AutoLock lock(applications_list_lock_ptr_); const mobile_apis::HMILevel::eType default_level = GetDefaultHmiLevel(app); state_ctrl_.OnApplicationRegistered(app, default_level); + commands_holder_->Resume(app, CommandHolder::CommandType::kMobileCommand); } void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) { diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index f0cd720e30..6cb03705ab 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -138,10 +138,18 @@ bool RPCServiceImpl::ManageMobileCommand( const uint32_t connection_key = static_cast( (*message)[strings::params][strings::connection_key].asUInt()); + const WindowID window_id = MessageHelper::ExtractWindowIdFromSmartObject( + (*message)[strings::msg_params]); + int32_t message_type = + (*message)[strings::params][strings::message_type].asInt(); auto app_ptr = app_manager_.application(connection_key); - if (app_ptr && app_manager_.IsAppInReconnectMode(app_ptr->device(), - app_ptr->policy_app_id())) { + if (app_ptr && + (app_manager_.IsAppInReconnectMode(app_ptr->device(), + app_ptr->policy_app_id()) || + (!app_ptr->WindowIdExists(window_id) && + mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id && + mobile_apis::messageType::notification == message_type))) { commands_holder_.Suspend( app_ptr, CommandHolder::CommandType::kMobileCommand, source, message); return true; @@ -209,8 +217,6 @@ bool RPCServiceImpl::ManageMobileCommand( return false; } - int32_t message_type = - (*message)[strings::params][strings::message_type].asInt(); if (message_type == mobile_apis::messageType::response) { if (command->Init() && command->CheckPermissions()) { command->Run(); -- cgit v1.2.1 From be877b5bc3f48199883852f3bb52698d515d3090 Mon Sep 17 00:00:00 2001 From: Collin Date: Thu, 29 Jul 2021 17:17:17 -0400 Subject: remove reference to ui get capabilities response parameter systemCapabilities.displayCapabilities (#3746) --- .../src/commands/hmi/ui_get_capabilities_response.cc | 5 ----- .../commands/hmi/ui_get_capabilities_response_test.cc | 19 ------------------- 2 files changed, 24 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc index 45c5f59326..128f41e01f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc @@ -151,11 +151,6 @@ void UIGetCapabilitiesResponse::Run() { hmi_capabilities_.set_driver_distraction_supported(true); } } - if (system_capabilities_so.keyExists(strings::display_capabilities)) { - sections_to_update.push_back(strings::display_capabilities); - hmi_capabilities_.set_system_display_capabilities( - system_capabilities_so[strings::display_capabilities]); - } } if (msg_params.keyExists(strings::pcm_stream_capabilities)) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc index a1661dc247..37531b469a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc @@ -356,25 +356,6 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) { command->Run(); } -TEST_F(UIGetCapabilitiesResponseTest, SetSystemDisplayCapabilities_SUCCESS) { - MessageSharedPtr command_msg = CreateCommandMsg(); - (*command_msg)[strings::msg_params][strings::system_capabilities] = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - ResponseFromHMIPtr command( - CreateCommand(command_msg)); - - const auto& display_capability_so = - (*command_msg)[strings::msg_params][strings::system_capabilities] - [strings::display_capabilities]; - - EXPECT_CALL(mock_hmi_capabilities_, - set_system_display_capabilities(display_capability_so)); - - ASSERT_TRUE(command->Init()); - command->Run(); -} - TEST_F(UIGetCapabilitiesResponseTest, SaveCachedCapabilitiesToFileCall_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); -- cgit v1.2.1 From c94a3cfb7d0dfc606c96c3cf08a5674b6e7ca1da Mon Sep 17 00:00:00 2001 From: "Iryna Lytvynenko (GitHub)" Date: Wed, 4 Aug 2021 22:28:33 +0300 Subject: Feature/sdl 0236 tire status mismatch (#3583) * Temporary commit with link to rpc_spec fork * Indicate that the structure is included in the Common interface * Mark the parameters as non mandatory * Update link to rpc_spec fork * Fix Message Helper linkage to VehicleInfoPlugin * Fix versioning for TirePressure param * Bump version up to 8.0 * Add link to rpc_spec fork * Address review comments Co-authored-by: Dmitriy Boltovskiy Co-authored-by: Yana Chernysheva Co-authored-by: Andrii Kalinich --- src/appMain/sdl_preloaded_pt.json | 221 ++++++++++++++++++++- .../include/application_manager/message_helper.h | 11 + .../application_manager/smart_object_keys.h | 7 + .../rpc_plugins/vehicle_info_plugin/CMakeLists.txt | 2 +- .../commands/mobile/get_vehicle_data_request.cc | 6 + .../mobile/on_vehicle_data_notification.cc | 10 +- .../vehicle_info_plugin/test/CMakeLists.txt | 2 +- .../src/message_helper/message_helper.cc | 39 ++++ .../application_manager/src/smart_object_keys.cc | 7 + .../application_manager/mock_message_helper.h | 4 + .../test/mock_message_helper.cc | 7 + tools/rpc_spec | 2 +- 12 files changed, 306 insertions(+), 12 deletions(-) diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index 50bbce6a97..e018a597f7 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -3616,7 +3616,16 @@ "name": "pressureTelltale", "key": "OEM_REF_PRES_TEL", "type": "WarningLightStatus", - "mandatory": true + "mandatory": true, + "since": "2.0", + "until": "8.0" + }, + { + "name": "pressureTelltale", + "key": "OEM_REF_PRES_TEL", + "type": "WarningLightStatus", + "mandatory": false, + "since": "8.0" }, { "name": "leftFront", @@ -3646,7 +3655,40 @@ ], "key": "OEM_REF_LEFT_FR", "type": "Struct", - "mandatory": true + "mandatory": true, + "since": "2.0", + "until": "8.0" + }, + { + "name": "leftFront", + "params": [ + { + "name": "status", + "key": "OEM_REF_LEFT_FR_ST", + "type": "ComponentVolumeStatus", + "mandatory": true + }, + { + "name": "tpms", + "key": "OEM_REF_LEFT_FR_TMPS", + "type": "TPMS", + "mandatory": false, + "since": "5.0" + }, + { + "name": "pressure", + "key": "OEM_REF_LEFT_FR_PRES", + "type": "Float", + "mandatory": false, + "minvalue": 0, + "maxvalue": 2000, + "since": "5.0" + } + ], + "key": "OEM_REF_LEFT_FR", + "type": "Struct", + "mandatory": false, + "since": "8.0" }, { "name": "rightFront", @@ -3676,7 +3718,40 @@ ], "key": "OEM_REF_RIGHT_FR", "type": "Struct", - "mandatory": true + "mandatory": true, + "since": "2.0", + "until": "8.0" + }, + { + "name": "rightFront", + "params": [ + { + "name": "status", + "key": "OEM_REF_RIGHT_FR_ST", + "type": "ComponentVolumeStatus", + "mandatory": true + }, + { + "name": "tpms", + "key": "OEM_REF_RIGHT_FR_TMPS", + "type": "TPMS", + "mandatory": false, + "since": "5.0" + }, + { + "name": "pressure", + "key": "OEM_REF_RIGHT_FR_PRES", + "type": "Float", + "mandatory": false, + "minvalue": 0, + "maxvalue": 2000, + "since": "5.0" + } + ], + "key": "OEM_REF_RIGHT_FR", + "type": "Struct", + "mandatory": false, + "since": "8.0" }, { "name": "leftRear", @@ -3706,7 +3781,40 @@ ], "key": "OEM_REF_LEFT_REAR", "type": "Struct", - "mandatory": true + "mandatory": true, + "since": "2.0", + "until": "8.0" + }, + { + "name": "leftRear", + "params": [ + { + "name": "status", + "key": "OEM_REF_LEFT_REAR_ST", + "type": "ComponentVolumeStatus", + "mandatory": true + }, + { + "name": "tpms", + "key": "OEM_REF_LEFT_REAR_TMPS", + "type": "TPMS", + "mandatory": false, + "since": "5.0" + }, + { + "name": "pressure", + "key": "OEM_REF_LEFT_REAR_PRES", + "type": "Float", + "mandatory": false, + "minvalue": 0, + "maxvalue": 2000, + "since": "5.0" + } + ], + "key": "OEM_REF_LEFT_REAR", + "type": "Struct", + "mandatory": false, + "since": "8.0" }, { "name": "rightRear", @@ -3736,7 +3844,40 @@ ], "key": "OEM_REF_RIGHT_REAR", "type": "Struct", - "mandatory": true + "mandatory": true, + "since": "2.0", + "until": "8.0" + }, + { + "name": "rightRear", + "params": [ + { + "name": "status", + "key": "OEM_REF_RIGHT_REAR_ST", + "type": "ComponentVolumeStatus", + "mandatory": true + }, + { + "name": "tpms", + "key": "OEM_REF_RIGHT_REAR_TMPS", + "type": "TPMS", + "mandatory": false, + "since": "5.0" + }, + { + "name": "pressure", + "key": "OEM_REF_RIGHT_REAR_PRES", + "type": "Float", + "mandatory": false, + "minvalue": 0, + "maxvalue": 2000, + "since": "5.0" + } + ], + "key": "OEM_REF_RIGHT_REAR", + "type": "Struct", + "mandatory": false, + "since": "8.0" }, { "name": "innerLeftRear", @@ -3766,7 +3907,40 @@ ], "key": "OEM_REF_IN_LEFT_REAR", "type": "Struct", - "mandatory": true + "mandatory": true, + "since": "2.0", + "until": "8.0" + }, + { + "name": "innerLeftRear", + "params": [ + { + "name": "status", + "key": "OEM_REF_IN_LEFT_REAR_ST", + "type": "ComponentVolumeStatus", + "mandatory": true + }, + { + "name": "tpms", + "key": "OEM_REF_IN_LEFT_REAR_TMPS", + "type": "TPMS", + "mandatory": false, + "since": "5.0" + }, + { + "name": "pressure", + "key": "OEM_REF_IN_LEFT_REAR_PRES", + "type": "Float", + "mandatory": false, + "minvalue": 0, + "maxvalue": 2000, + "since": "5.0" + } + ], + "key": "OEM_REF_IN_LEFT_REAR", + "type": "Struct", + "mandatory": false, + "since": "8.0" }, { "name": "innerRightRear", @@ -3796,7 +3970,40 @@ ], "key": "OEM_REF_IN_RIGHT_REAR", "type": "Struct", - "mandatory": true + "mandatory": true, + "since": "2.0", + "until": "8.0" + }, + { + "name": "innerRightRear", + "params": [ + { + "name": "status", + "key": "OEM_REF_IN_RIGHT_REAR_ST", + "type": "ComponentVolumeStatus", + "mandatory": true + }, + { + "name": "tpms", + "key": "OEM_REF_IN_RIGHT_REAR_TMPS", + "type": "TPMS", + "mandatory": false, + "since": "5.0" + }, + { + "name": "pressure", + "key": "OEM_REF_IN_RIGHT_REAR_PRES", + "type": "Float", + "mandatory": false, + "minvalue": 0, + "maxvalue": 2000, + "since": "5.0" + } + ], + "key": "OEM_REF_IN_RIGHT_REAR", + "type": "Struct", + "mandatory": false, + "since": "8.0" } ], "key": "OEM_REF_TIRE_PRES", diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 4aea48c086..2adef91c2e 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -1113,6 +1113,17 @@ class MessageHelper { ApplicationManager& app_mngr, const WindowID window_id); + /** + * @brief AddDefaultParamsToTireStatus adds missing default sub-params to + * tirePressure param, if version of related application requires presence of + * all sub-params in response + * @param application shared pointer to related application + * @param response_from_hmi reference to response from HMI + */ + static void AddDefaultParamsToTireStatus( + ApplicationSharedPtr application, + smart_objects::SmartObject& response_from_hmi); + private: /** * @brief Allows to fill SO according to the current permissions. diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index 5572dfd55d..5a79059f1f 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -308,6 +308,13 @@ extern const char* vin; extern const char* gearStatus; extern const char* prndl; extern const char* tire_pressure; +extern const char* pressure_telltale; +extern const char* left_front; +extern const char* right_front; +extern const char* left_rear; +extern const char* right_rear; +extern const char* inner_left_rear; +extern const char* inner_right_rear; extern const char* odometer; extern const char* belt_status; extern const char* electronic_park_brake_status; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt index a741c32129..e858967619 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt @@ -45,7 +45,6 @@ collect_sources(VEHICLE_INFO_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src") set(LIBRARIES HMI_API MOBILE_API - MessageHelper ApplicationManager v4_protocol_v1_2_no_extra SmartObjects @@ -63,6 +62,7 @@ target_link_libraries("vehicle_info_plugin_static" ${LIBRARIES}) add_library(vehicle_info_plugin SHARED "src/vehicle_info_plugin.cc" ) target_link_libraries(vehicle_info_plugin vehicle_info_plugin_static) +target_link_libraries(vehicle_info_plugin MessageHelper) set(INSTALL_DESTINATION bin) diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc index 17a450ca89..18149fbe02 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc @@ -126,6 +126,12 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { std::string response_info; GetInfo(message, response_info); + if (message[strings::msg_params].keyExists(strings::tire_pressure)) { + ApplicationSharedPtr app = + application_manager_.application(connection_key()); + MessageHelper::AddDefaultParamsToTireStatus(app, message); + } + auto data_not_available_with_params = [this, &result_code, &message]() { if (hmi_apis::Common_Result::DATA_NOT_AVAILABLE != result_code) { return false; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc index e062728217..0ae38a9398 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc @@ -89,16 +89,22 @@ void OnVehicleDataNotification::Run() { SDL_LOG_ERROR("NULL pointer"); continue; } + + smart_objects::SmartObject output_message = *message_; + if (strings::tire_pressure == name) { + MessageHelper::AddDefaultParamsToTireStatus(app, output_message); + } + notified_app_it = find(notify_apps.begin(), notify_apps.end(), app); if (notified_app_it == notify_apps.end()) { notify_apps.push_back(app); smart_objects::SmartObject msg_param = smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_param[name] = (*message_)[strings::msg_params][name]; + msg_param[name] = output_message[strings::msg_params][name]; appSO.push_back(msg_param); } else { size_t idx = std::distance(notify_apps.begin(), notified_app_it); - appSO[idx][name] = (*message_)[strings::msg_params][name]; + appSO[idx][name] = output_message[strings::msg_params][name]; } } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt index c9697d71f2..1073974324 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt @@ -64,7 +64,7 @@ set(LIBRARIES HMI_API MOBILE_API connectionHandler - vehicle_info_plugin + vehicle_info_plugin_static SmartObjects formatters jsoncpp diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 6dbb7b35ae..dde580adeb 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -62,6 +62,7 @@ #include "utils/file_system.h" #include "utils/logger.h" #include "utils/macro.h" +#include "utils/semantic_version.h" #include "formatters/CFormatterJsonBase.h" #include "formatters/CFormatterJsonSDLRPCv1.h" @@ -3483,4 +3484,42 @@ WindowID MessageHelper::ExtractWindowIdFromSmartObject( return mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } +void MessageHelper::AddDefaultParamsToTireStatus( + ApplicationSharedPtr app, smart_objects::SmartObject& response_from_hmi) { + const utils::SemanticVersion max_version_with_mandatory_params(8, 0, 0); + + if (!app) { + SDL_LOG_ERROR("Application not found"); + return; + } + + if (app->msg_version() >= max_version_with_mandatory_params) { + SDL_LOG_DEBUG( + "Tire status parameters are " + "non-mandatory for this app version, no need in default values"); + return; + } + + smart_objects::SmartObject& tire_status = + response_from_hmi[strings::msg_params][strings::tire_pressure]; + + if (!tire_status.keyExists(strings::pressure_telltale)) { + tire_status[strings::pressure_telltale] = + mobile_apis::WarningLightStatus::WLS_NOT_USED; + } + + const std::vector tires{strings::left_front, + strings::right_front, + strings::left_rear, + strings::right_rear, + strings::inner_left_rear, + strings::inner_right_rear}; + for (const std::string& tire : tires) { + if (!tire_status.keyExists(tire)) { + tire_status[tire][strings::status] = + mobile_apis::ComponentVolumeStatus::CVS_UNKNOWN; + } + } +} + } // namespace application_manager diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index a680653d6c..b7c40987ad 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -275,6 +275,13 @@ const char* vin = "vin"; const char* gearStatus = "gearStatus"; const char* prndl = "prndl"; const char* tire_pressure = "tirePressure"; +const char* pressure_telltale = "pressureTelltale"; +const char* left_front = "leftFront"; +const char* right_front = "rightFront"; +const char* left_rear = "leftRear"; +const char* right_rear = "rightRear"; +const char* inner_left_rear = "innerLeftRear"; +const char* inner_right_rear = "innerRightRear"; const char* odometer = "odometer"; const char* belt_status = "beltStatus"; const char* electronic_park_brake_status = "electronicParkBrakeStatus"; diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index dd84ce4c40..82a0574c7f 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -394,6 +394,10 @@ class MockMessageHelper { application_manager::ApplicationManager& app_mngr, const application_manager::WindowID window_id)); + MOCK_METHOD2(AddDefaultParamsToTireStatus, + void(application_manager::ApplicationSharedPtr application, + smart_objects::SmartObject& response_from_hmi)); + static MockMessageHelper* message_helper_mock(); }; diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index f96a0eca5c..3cab2be0fb 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -689,4 +689,11 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateResponseMessageFromHmi( return MockMessageHelper::message_helper_mock()->CreateResponseMessageFromHmi( function_id, correlation_id, result_code); } + +void MessageHelper::AddDefaultParamsToTireStatus( + application_manager::ApplicationSharedPtr application, + smart_objects::SmartObject& response_from_hmi) { + return MockMessageHelper::message_helper_mock()->AddDefaultParamsToTireStatus( + application, response_from_hmi); +} } // namespace application_manager diff --git a/tools/rpc_spec b/tools/rpc_spec index 72632f9469..44f0a419c6 160000 --- a/tools/rpc_spec +++ b/tools/rpc_spec @@ -1 +1 @@ -Subproject commit 72632f946941d63a57ee5e99896e3eae3627f7dd +Subproject commit 44f0a419c6a43815bc095134712eab4fef352ad7 -- cgit v1.2.1 From 595d76585bdcc110ae4093a62f7ff77445aa88e2 Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Mon, 9 Aug 2021 12:58:18 -0400 Subject: Fix handling of RC.SetGlobalProperties response (#3741) * Added result processing and wrote a test for RC_SetGlobalProperties * Apply suggestions from code review Co-authored-by: Shobhit Adlakha * Added result processing and wrote a test for RC_SetGlobalProperties Co-authored-by: Roman Reznichenko Co-authored-by: Shobhit Adlakha --- .../commands/command_request_impl.h | 29 +++++++++++++++++ .../mobile/reset_global_properties_request.h | 2 ++ .../mobile/reset_global_properties_request.cc | 31 +++++++++++++------ .../mobile/reset_global_properties_test.cc | 36 ++++++++++++++++++++++ .../src/commands/command_request_impl.cc | 24 +++++++++++++++ 5 files changed, 112 insertions(+), 10 deletions(-) diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index 5723de3b08..084340ad08 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -273,6 +273,22 @@ class CommandRequestImpl : public CommandImpl, bool PrepareResultForMobileResponse(ResponseInfo& out_first, ResponseInfo& out_second) const; + /** + * @brief Checks result code from HMI for splitted RPC + * and returns parameter for sending to mobile app. + * @param out_first Contains result_code from HMI response and + * interface that returns response + * @param out_second Contains result_code from HMI response and + * interface that returns response + * @param out_third Contains result_code from HMI response and + * interface that returns response + * @return true if result code complies successful result code + * otherwise returns false + */ + bool PrepareResultForMobileResponse(ResponseInfo& out_first, + ResponseInfo& out_second, + ResponseInfo& out_third) const; + /** * @brief If message from HMI contains returns this info * or process result code from HMI and checks state of interface @@ -296,6 +312,19 @@ class CommandRequestImpl : public CommandImpl, mobile_apis::Result::eType PrepareResultCodeForResponse( const ResponseInfo& first, const ResponseInfo& second); + /** + * @brief Prepare result code for sending to mobile application + * @param first contains result_code from HMI response and + * interface that returns response + * @param second contains result_code from HMI response and + * interface that returns response. + * @return resulting code for sending to mobile application. + */ + mobile_apis::Result::eType PrepareResultCodeForResponse( + const ResponseInfo& first, + const ResponseInfo& second, + const ResponseInfo& third); + /** * @brief Resolves if the return code must be * UNSUPPORTED_RESOURCE diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h index 7475520889..760eb09c2d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h @@ -105,7 +105,9 @@ class ResetGlobalPropertiesRequest hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType tts_result_; + hmi_apis::Common_Result::eType rc_result_; std::string ui_response_info_; + std::string rc_response_info_; std::string tts_response_info_; }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc index f4e07d4b78..dd5e3d3e88 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc @@ -58,7 +58,8 @@ ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( hmi_capabilities, policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} + , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) + , rc_result_(hmi_apis::Common_Result::INVALID_ENUM) {} ResetGlobalPropertiesRequest::~ResetGlobalPropertiesRequest() {} @@ -146,6 +147,14 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { GetInfo(message, tts_response_info_); break; } + case hmi_apis::FunctionID::RC_SetGlobalProperties: { + SDL_LOG_INFO("Received RC_SetGlobalProperties event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_RC); + rc_result_ = static_cast( + message[strings::params][hmi_response::code].asInt()); + GetInfo(message, rc_response_info_); + break; + } default: { SDL_LOG_ERROR("Received unknown event " << event.id()); return; @@ -183,6 +192,8 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters( ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); app_mngr::commands::ResponseInfo tts_properties_info( tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_); + app_mngr::commands::ResponseInfo rc_properties_info( + rc_result_, HmiInterfaces::HMI_INTERFACE_RC, application_manager_); HmiInterfaces::InterfaceState tts_interface_state = application_manager_.hmi_interfaces().GetInterfaceState( @@ -195,14 +206,13 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters( out_result_code = mobile_apis::Result::WARNINGS; out_response_info = "Unsupported phoneme type sent in a prompt"; } else { - result = - PrepareResultForMobileResponse(ui_properties_info, tts_properties_info); - out_result_code = - PrepareResultCodeForResponse(ui_properties_info, tts_properties_info); - out_response_info = app_mngr::commands::MergeInfos(tts_properties_info, - tts_response_info_, - ui_properties_info, - ui_response_info_); + result = PrepareResultForMobileResponse( + ui_properties_info, tts_properties_info, rc_properties_info); + out_result_code = PrepareResultCodeForResponse( + ui_properties_info, tts_properties_info, rc_properties_info); + + out_response_info = app_mngr::commands::MergeInfos( + tts_response_info_, ui_response_info_, rc_response_info_); } return result; @@ -210,7 +220,8 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters( bool ResetGlobalPropertiesRequest::IsPendingResponseExist() { return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) || - IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI); + IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) || + IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_RC); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc index 8ca15f39fe..f62f6b4682 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc @@ -282,6 +282,42 @@ TEST_F(ResetGlobalPropertiesRequestTest, command_->on_event(event); } +TEST_F(ResetGlobalPropertiesRequestTest, + OnEvent_RC_SetGlobalProperties_SUCCESS) { + am::ResetGlobalPropertiesResult result; + result.user_location = true; + + EXPECT_CALL(app_mngr_, ResetGlobalProperties(_, _)).WillOnce(Return(result)); + + smart_objects::SmartObjectSPtr msg_params = + std::make_shared( + smart_objects::SmartType_Map); + + EXPECT_CALL(mock_message_helper_, CreateRCResetGlobalPropertiesRequest(_, _)) + .WillOnce(Return(msg_params)); + + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::FunctionID::RC_SetGlobalProperties), _)) + .WillOnce(Return(true)); + + command_->Run(); + + EXPECT_CALL(mock_rpc_service_, + ManageMobileCommand( + MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), + am::commands::Command::SOURCE_SDL)); + + (*msg_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + + Event event(hmi_apis::FunctionID::RC_SetGlobalProperties); + event.set_smart_object(*msg_); + + command_->on_event(event); +} + TEST_F(ResetGlobalPropertiesResponseTest, Run_Sendmsg_SUCCESS) { MessageSharedPtr message(CreateMessage()); ResetGlobalPropertiesResponsePtr command( diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 0bf3716aa9..dad2689f29 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -748,6 +748,17 @@ bool CommandRequestImpl::PrepareResultForMobileResponse( return result; } +bool CommandRequestImpl::PrepareResultForMobileResponse( + ResponseInfo& out_first, + ResponseInfo& out_second, + ResponseInfo& out_third) const { + SDL_LOG_AUTO_TRACE(); + bool result = (PrepareResultForMobileResponse(out_first, out_second) || + PrepareResultForMobileResponse(out_second, out_third)) && + PrepareResultForMobileResponse(out_first, out_third); + return result; +} + void CommandRequestImpl::GetInfo( const smart_objects::SmartObject& response_from_hmi, std::string& out_info) { @@ -787,6 +798,19 @@ mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( return result_code; } +mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( + const ResponseInfo& first, + const ResponseInfo& second, + const ResponseInfo& third) { + SDL_LOG_AUTO_TRACE(); + + const auto first_comparison = PrepareResultCodeForResponse(first, second); + const auto second_comparison = PrepareResultCodeForResponse(second, third); + const auto third_comparison = PrepareResultCodeForResponse(first, third); + + return std::max({first_comparison, second_comparison, third_comparison}); +} + const CommandParametersPermissions& CommandRequestImpl::parameters_permissions() const { return parameters_permissions_; -- cgit v1.2.1 From f51f4fd4c7475b30cbf2c2dbc4507ac13583b7bf Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Tue, 10 Aug 2021 10:15:25 -0400 Subject: Fix sub menues deletion wrong order (#3748) * Fix wrong requests order for recursive deletion The issue which was observed is that SDL sends `DeleteSubMenu` request to HMI for a "parent node" submenu and then sends subsequent `DeleteSubMenu` requests recursively for all child nodes starting from the bottom one. Such order confuses HMI because deletion of parent node may automatically trigger deletion of all its child nodes on HMI side so subsequent requests from SDL for a child nodes might be rejected. To make sure that HMI removes all the hierarchy properly, SDL should start deletion sequence from the bottom nodes and delete the parent node in the end. To resolve that issue, DeleteSubMenu request logic was updated. Currently, SDL recursively iterates through the submenu and command nodes and collects them in a queue. Once queue is ready, SDL sends requests one by one, waiting for a HMI response for each sent request before sending the subsequent. Once the responses to all requests are received, SDL sends the final response to mobile app and finalizes the command. * Updated DeleteSubMenu unit tests to cover new logic --- .../commands/mobile/delete_sub_menu_request.h | 31 +- .../src/commands/mobile/delete_sub_menu_request.cc | 192 +++++--- .../test/commands/mobile/delete_sub_menu_test.cc | 498 +++++++++++++++------ 3 files changed, 523 insertions(+), 198 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h index af2ba4a1ea..20fff456d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h @@ -82,34 +82,45 @@ class DeleteSubMenuRequest : public app_mngr::commands::CommandRequestImpl { bool Init() FINAL; private: - /* - * @brief Deletes submenus that have a parentID that matches the parentID - * parameter + /** + * @brief Creates and queues up delete requests for a submenus that have a + * parent ID which matches the parentID parameter * * @param app_id Application ID * @param parentID Parent ID of a nested submenu */ void DeleteNestedSubMenus(app_mngr::ApplicationSharedPtr const app, - uint32_t parentID, + const uint32_t parentID, const app_mngr::SubMenuMap& subMenus); - /* - * @brief Deletes VR commands from SDL for corresponding submenu ID + /** + * @brief Creates and queues up delete requests for each VR command tied to + * the given submenu ID * * @param app_id Application ID * @param parentID Parent ID of a nested submenu */ void DeleteSubMenuVRCommands(app_mngr::ApplicationConstSharedPtr app, - uint32_t parentID); + const uint32_t parentID); - /* - * @brief Deletes UI commands from SDL for corresponding submenu ID + /** + * @brief Creates and queues up delete requests for each UI command tied to + * the given submenu ID * * @param app_id Application ID * @param parentID Parent ID of a nested submenu */ void DeleteSubMenuUICommands(app_mngr::ApplicationSharedPtr const app, - uint32_t parentID); + const uint32_t parentID); + + /** + * @brief Takes the next request in the queue and sends it to HMI + */ + void SendNextRequest(); + + typedef std::list RequestsList; + RequestsList requests_list_; + uint32_t pending_request_corr_id_; DISALLOW_COPY_AND_ASSIGN(DeleteSubMenuRequest); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc index 19ec2dfb27..49e76ae327 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc @@ -56,7 +56,9 @@ DeleteSubMenuRequest::DeleteSubMenuRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) {} + policy_handler) + , requests_list_() + , pending_request_corr_id_(0) {} DeleteSubMenuRequest::~DeleteSubMenuRequest() {} @@ -82,19 +84,42 @@ void DeleteSubMenuRequest::Run() { return; } + { + const DataAccessor accessor = app->sub_menu_map(); + const SubMenuMap& sub_menus = accessor.GetData(); + DeleteNestedSubMenus(app, menu_id, sub_menus); + } + smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - msg_params[strings::menu_id] = (*message_)[strings::msg_params][strings::menu_id]; msg_params[strings::app_id] = app->app_id(); + requests_list_.push_back(msg_params); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + SendNextRequest(); +} - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params, true); +void DeleteSubMenuRequest::SendNextRequest() { + SDL_LOG_AUTO_TRACE(); + + const auto request_params = requests_list_.front(); + auto function_id = hmi_apis::FunctionID::UI_DeleteSubMenu; + + if (request_params.keyExists(strings::cmd_id)) { + function_id = request_params.keyExists(strings::grammar_id) + ? hmi_apis::FunctionID::VR_DeleteCommand + : hmi_apis::FunctionID::UI_DeleteCommand; + } + + pending_request_corr_id_ = SendHMIRequest(function_id, &request_params, true); + SDL_LOG_DEBUG( + "Waiting for response for corr_id = " << pending_request_corr_id_); } void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app, - uint32_t parentID, + const uint32_t parentID, const SubMenuMap& subMenus) { SDL_LOG_AUTO_TRACE(); @@ -108,26 +133,26 @@ void DeleteSubMenuRequest::DeleteNestedSubMenus(ApplicationSharedPtr const app, } if (parentID == (*it->second)[strings::parent_id].asUInt()) { - uint32_t menuID = (*it->second)[strings::menu_id].asUInt(); + const uint32_t menuID = (*it->second)[strings::menu_id].asUInt(); DeleteNestedSubMenus(app, menuID, subMenus); - DeleteSubMenuVRCommands(app, menuID); - DeleteSubMenuUICommands(app, menuID); + smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); msg_params[strings::menu_id] = menuID; msg_params[strings::app_id] = app->app_id(); - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params); - ++it; - SDL_LOG_DEBUG("Removing submenuID: " << menuID); - app->RemoveSubMenu(menuID); - } else { - ++it; + requests_list_.push_back(msg_params); } + + ++it; } + + SDL_LOG_DEBUG("Delete commands with Parent ID: " << parentID); + DeleteSubMenuVRCommands(app, parentID); + DeleteSubMenuUICommands(app, parentID); } void DeleteSubMenuRequest::DeleteSubMenuVRCommands( - ApplicationConstSharedPtr app, uint32_t parentID) { + ApplicationConstSharedPtr app, const uint32_t parentID) { SDL_LOG_AUTO_TRACE(); const DataAccessor accessor = app->commands_map(); @@ -148,7 +173,7 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands( msg_params[strings::grammar_id] = app->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); + requests_list_.push_back(msg_params); } } } @@ -175,16 +200,11 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands( const uint32_t cmd_id = (*it->second)[strings::cmd_id].asUInt(); msg_params[strings::app_id] = app->app_id(); msg_params[strings::cmd_id] = cmd_id; - SDL_LOG_DEBUG("Removing UI Command: " << cmd_id); - app->RemoveCommand(cmd_id); - app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false); - it = commands.begin(); // Can not relay on - // iterators after erase was called - - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); - } else { - ++it; + + requests_list_.push_back(msg_params); } + + ++it; } } @@ -193,48 +213,110 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { - case hmi_apis::FunctionID::UI_DeleteSubMenu: { - EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - hmi_apis::Common_Result::eType result_code = - static_cast( - message[strings::params][hmi_response::code].asInt()); - std::string response_info; - GetInfo(message, response_info); - const bool result = PrepareResultForMobileResponse( - result_code, HmiInterfaces::HMI_INTERFACE_UI); - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - SDL_LOG_ERROR("NULL pointer"); - return; + case hmi_apis::FunctionID::UI_DeleteCommand: { + SDL_LOG_DEBUG("Received UI_DeleteCommand response"); + + const auto corr_id = + message[strings::params][strings::correlation_id].asUInt(); + if (pending_request_corr_id_ == corr_id) { + auto msg_params = requests_list_.front(); + + const auto result_code = static_cast( + message[strings::params][hmi_response::code].asInt()); + + auto app = application_manager_.application(connection_key()); + if (!app) { + SDL_LOG_ERROR("Application not found"); + return; + } + + if (IsHMIResultSuccess(result_code)) { + const auto cmd_id = msg_params[strings::cmd_id].asUInt(); + SDL_LOG_DEBUG("Removing UI Command: " << cmd_id); + app->RemoveCommand(cmd_id); + app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false); + } + + requests_list_.pop_front(); } - if (result) { - // delete sub menu items from SDL and HMI - uint32_t parentID = - (*message_)[strings::msg_params][strings::menu_id].asUInt(); - const DataAccessor accessor = application->sub_menu_map(); - const SubMenuMap& subMenus = accessor.GetData(); - DeleteNestedSubMenus(application, parentID, subMenus); - DeleteSubMenuVRCommands(application, parentID); - DeleteSubMenuUICommands(application, parentID); - application->RemoveSubMenu( - (*message_)[strings::msg_params][strings::menu_id].asInt()); + break; + } + + case hmi_apis::FunctionID::VR_DeleteCommand: { + SDL_LOG_DEBUG("Received VR_DeleteCommand response"); + + const auto corr_id = + message[strings::params][strings::correlation_id].asUInt(); + + if (corr_id == pending_request_corr_id_) { + auto app = application_manager_.application(connection_key()); + if (!app) { + SDL_LOG_ERROR("Application not found"); + return; + } + + requests_list_.pop_front(); } - SendResponse(result, - MessageHelper::HMIToMobileResult(result_code), - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); break; } + + case hmi_apis::FunctionID::UI_DeleteSubMenu: { + SDL_LOG_DEBUG("Received UI_DeleteSubMenu response"); + + const auto corr_id = + message[strings::params][strings::correlation_id].asUInt(); + if (corr_id == pending_request_corr_id_) { + auto msg_params = requests_list_.front(); + + const auto result_code = static_cast( + message[strings::params][hmi_response::code].asInt()); + + auto app = application_manager_.application(connection_key()); + if (!app) { + SDL_LOG_ERROR("Application not found"); + return; + } + + if (IsHMIResultSuccess(result_code)) { + const auto menu_id = msg_params[strings::menu_id].asUInt(); + SDL_LOG_DEBUG("Removing submenuID: " << menu_id); + app->RemoveSubMenu(menu_id); + } + + requests_list_.pop_front(); + } + + break; + } + default: { SDL_LOG_ERROR("Received unknown event" << event.id()); return; } } + + if (!requests_list_.empty()) { + SDL_LOG_DEBUG("Still waiting for another requests"); + SendNextRequest(); + return; + } + + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + + hmi_apis::Common_Result::eType result_code = + static_cast( + message[strings::params][hmi_response::code].asInt()); + std::string response_info; + GetInfo(message, response_info); + const bool result = PrepareResultForMobileResponse( + result_code, HmiInterfaces::HMI_INTERFACE_UI); + + SendResponse(result, + MessageHelper::HMIToMobileResult(result_code), + response_info.empty() ? NULL : response_info.c_str(), + &(message[strings::msg_params])); } bool DeleteSubMenuRequest::Init() { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc index f5856a8eda..975cba89a1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc @@ -67,6 +67,7 @@ using sdl_rpc_plugin::commands::DeleteSubMenuResponse; typedef std::shared_ptr DeleteSubMenuRequestPtr; typedef std::shared_ptr DeleteSubMenuResponsePtr; +typedef std::shared_ptr EventPtr; MATCHER_P(CheckMessageResultCode, result_code, "") { return (*arg)[am::strings::msg_params][am::strings::result_code].asInt() == @@ -89,8 +90,9 @@ namespace { const uint32_t kConnectionKey = 2u; const uint32_t kCorrelationId = 10u; const uint32_t kMenuId = 100u; +const uint32_t kMenuIdChild = 101u; const uint32_t kGrammarId = 101u; -const int32_t kCmdId = 102; +const int32_t kCmdId = 102u; } // namespace class DeleteSubMenuRequestTest @@ -107,6 +109,224 @@ class DeleteSubMenuRequestTest std::make_shared()) , app_(CreateMockApp()) {} + /** + * @brief Generates submenu smart object with specified params + * @param menu_id id of the menu + * @param parent_id id of parent menu + * @return generated smart object + */ + smart_objects::SmartObjectSPtr GenerateSubMenuMap(const uint32_t menu_id, + const uint32_t parent_id) { + smart_objects::SmartObjectSPtr smartObjectPtr = + std::make_shared(); + + smart_objects::SmartObject& object = *smartObjectPtr; + + object[am::strings::position] = 1; + object[am::strings::menu_name] = "SubMenu " + std::to_string(menu_id); + object[am::strings::menu_id] = menu_id; + object[am::strings::parent_id] = parent_id; + + return smartObjectPtr; + } + + /** + * @brief Generates UI & VR commands smart object with specified params + * @param cmd_id id of the command + * @param parent_id id of parent command + * @return generated smart object + */ + smart_objects::SmartObjectSPtr GenerateUiVrCommandMapChild( + const uint32_t cmd_id, const uint32_t parent_id) { + smart_objects::SmartObjectSPtr smartObjectPtr = + std::make_shared(); + + smart_objects::SmartObject& object = *smartObjectPtr; + + object[am::strings::cmd_id] = cmd_id; + object[am::strings::grammar_id] = kGrammarId; + object[am::strings::vr_commands] = "VR commands"; + object[am::strings::type] = hmi_apis::Common_VRCommandType::Command; + object[am::strings::menu_params][am::hmi_request::parent_id] = parent_id; + + return smartObjectPtr; + } + + /** + * @brief Sets up expectations for a successful execution of submenu request + * @param next_function_id function id of the next request + */ + void SetUpSubMenuRequestExpectations( + const hmi_apis::FunctionID::eType next_function_id) { + (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId; + (*message_)[am::strings::params][am::strings::connection_key] = + kConnectionKey; + (*message_)[am::strings::params][am::strings::function_id] = + next_function_id; + + smart_objects::SmartObject sub_menu = + (*message_)[am::strings::msg_params][am::strings::menu_id]; + EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); + EXPECT_CALL(*app_, FindSubMenu(kMenuId)).WillOnce(Return(sub_menu)); + + ON_CALL(*app_, sub_menu_map()).WillByDefault(Return(sub_menu_accessor_)); + ON_CALL(*app_, commands_map()).WillByDefault(Return(accessor_)); + + EXPECT_CALL(*app_, app_id()).WillRepeatedly(Return(kConnectionKey)); + EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillOnce(Return(kCorrelationId)); + + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(next_function_id), _)) + .WillOnce(Return(true)); + } + + /** + * @brief Prepares submenu response event with the specified params + * @param correlation_id correlation id + * @param menu_id id of the menu + * @return pointer to prepared event + */ + EventPtr PrepareSubMenuResponseEvent(const uint32_t correlation_id, + const uint32_t menu_id) { + EventPtr menu_event = + std::make_shared(hmi_apis::FunctionID::UI_DeleteSubMenu); + (*message_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + (*message_)[am::strings::msg_params][am::strings::app_id] = kConnectionKey; + (*message_)[am::strings::params][am::strings::correlation_id] = + correlation_id; + (*message_)[am::strings::msg_params][am::strings::menu_id] = menu_id; + menu_event->set_smart_object(*message_); + + return menu_event; + } + + /** + * @brief Sets up expectations for a successful execution of submenu + * subsequent response + * @param event pointer to event representing the response message + * @param next_function_id function id of the next request + */ + void SetUpSubMenuSubsequentResponseExpectations( + EventPtr event, hmi_apis::FunctionID::eType next_function_id) { + const auto& event_so_ref = event->smart_object(); + const auto correlation_id = event->smart_object_correlation_id(); + const auto menu_id = + event_so_ref[am::strings::msg_params][am::strings::menu_id].asUInt(); + + EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); + EXPECT_CALL(*app_, RemoveSubMenu(menu_id)); + + EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillOnce(Return(correlation_id + 1)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(next_function_id), _)) + .WillOnce(Return(true)); + } + + /** + * @brief Prepares VR command response event with the specified params + * @param correlation_id correlation id + * @return pointer to prepared event + */ + EventPtr PrepareVrCommandResponseEvent(const uint32_t correlation_id) { + EventPtr vr_event = + std::make_shared(hmi_apis::FunctionID::VR_DeleteCommand); + (*message_)[am::strings::msg_params][am::strings::app_id] = kConnectionKey; + (*message_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + (*message_)[am::strings::params][am::strings::correlation_id] = + correlation_id; + vr_event->set_smart_object(*message_); + + return vr_event; + } + + /** + * @brief Sets up expectations for a successful execution of VR command + * subsequent response + * @param event pointer to event representing the response message + * @param next_function_id function id of the next request + */ + void SetUpVrCommandSubsequentResponseExpectations( + EventPtr event, hmi_apis::FunctionID::eType next_function_id) { + const auto correlation_id = event->smart_object_correlation_id(); + + EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); + EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillOnce(Return(correlation_id + 1)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(next_function_id), _)) + .WillOnce(Return(true)); + } + + /** + * @brief Prepares UI command response event with the specified params + * @param correlation_id correlation id + * @param cmd_id id of the command + * @return pointer to prepared event + */ + EventPtr PrepareUiCommandResponseEvent(const uint32_t correlation_id, + const uint32_t cmd_id) { + EventPtr ui_event = + std::make_shared(hmi_apis::FunctionID::UI_DeleteCommand); + (*message_)[am::strings::params][am::strings::correlation_id] = + correlation_id; + (*message_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + (*message_)[am::strings::msg_params][am::strings::app_id] = kConnectionKey; + (*message_)[am::strings::msg_params][am::strings::cmd_id] = cmd_id; + ui_event->set_smart_object(*message_); + + return ui_event; + } + + /** + * @brief Sets up expectations for a successful execution of UI command + * subsequent response + * @param event pointer to event representing the response message + * @param next_function_id function id of the next request + */ + void SetUpUiCommandSubsequentResponseExpectations( + EventPtr event, hmi_apis::FunctionID::eType next_function_id) { + const auto correlation_id = event->smart_object_correlation_id(); + const auto& event_so_ref = event->smart_object(); + const auto cmd_id = + event_so_ref[am::strings::msg_params][am::strings::cmd_id].asUInt(); + + EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); + EXPECT_CALL(*app_, RemoveCommand(cmd_id)) + .WillOnce(DeleteCommand(&commands_map_)); + EXPECT_CALL(*app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandDeleted(cmd_id, false)); + + EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillOnce(Return(correlation_id + 1)); + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(next_function_id), _)) + .WillOnce(Return(true)); + } + + /** + * @brief Sets up expectations for a successful execution of submenu final + * response + * @param event pointer to event representing the response message + */ + void SetUpSubMenuFinalResponseExpectations(EventPtr event) { + const auto& event_so_ref = event->smart_object(); + const auto menu_id = + event_so_ref[am::strings::msg_params][am::strings::menu_id].asUInt(); + + EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); + EXPECT_CALL(*app_, RemoveSubMenu(menu_id)); + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), + am::commands::Command::SOURCE_SDL)); + } + am::CommandsMap commands_map_; am::SubMenuMap sub_menu_map_; mutable std::shared_ptr commands_lock_; @@ -215,175 +435,187 @@ TEST_F(DeleteSubMenuRequestTest, Run_FindSubMenuFalse_UNSUCCESS) { command_->Run(); } -TEST_F(DeleteSubMenuRequestTest, Run_SendHMIRequest_SUCCESS) { - (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId; - (*message_)[am::strings::params][am::strings::connection_key] = - kConnectionKey; - - smart_objects::SmartObject sub_menu = - (*message_)[am::strings::msg_params][am::strings::menu_id]; - EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_)); - EXPECT_CALL(*app_, FindSubMenu(kMenuId)).WillOnce(Return(sub_menu)); - - EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); - EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) - .WillOnce(Return(kCorrelationId)); - - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteSubMenu), _)) - .WillOnce(Return(true)); - command_->Run(); -} - TEST_F(DeleteSubMenuRequestTest, OnEvent_UnknownEventId_UNSUCCESS) { Event event(hmi_apis::FunctionID::INVALID_ENUM); - EXPECT_CALL(app_mngr_, application(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, + ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)) + .Times(0); command_->on_event(event); } TEST_F(DeleteSubMenuRequestTest, OnEvent_InvalidApp_UNSUCCESS) { - Event event(hmi_apis::FunctionID::UI_DeleteSubMenu); - (*message_)[am::strings::params][am::hmi_response::code] = - hmi_apis::Common_Result::eType::SUCCESS; - event.set_smart_object(*message_); + auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0); + sub_menu_map_.insert(std::pair( + kMenuId, sub_menu_ptr.get())); + + SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->Run(); + MockAppPtr invalid_app; + EventPtr event = PrepareSubMenuResponseEvent(kCorrelationId, kMenuId); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(invalid_app)); EXPECT_CALL(*app_, RemoveSubMenu(_)).Times(0); - command_->on_event(event); + EXPECT_CALL(mock_rpc_service_, + ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)) + .Times(0); + + command_->on_event(*event); } -TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { - Event event(hmi_apis::FunctionID::UI_DeleteSubMenu); - (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId; - (*message_)[am::strings::params][am::strings::connection_key] = - kConnectionKey; - (*message_)[am::strings::msg_params][am::strings::vr_commands] = - "vr_commands"; - (*message_)[am::strings::msg_params][am::strings::cmd_id] = kCmdId; - (*message_)[am::strings::msg_params][am::strings::menu_params] - [am::hmi_request::parent_id] = kMenuId; - const hmi_apis::Common_Result::eType result_code = - hmi_apis::Common_Result::SUCCESS; - (*message_)[am::strings::params][am::hmi_response::code] = result_code; - event.set_smart_object(*message_); +TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenuOnly_SUCCESS) { + auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0); + sub_menu_map_.insert(std::pair( + kMenuId, sub_menu_ptr.get())); - commands_map_.insert( - std::make_pair(0, &((*message_)[am::strings::msg_params]))); + SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->Run(); - smart_objects::SmartObjectSPtr smartObjectPtr = - std::make_shared(); + EventPtr event = PrepareSubMenuResponseEvent(kCorrelationId, kMenuId); + SetUpSubMenuFinalResponseExpectations(event); + command_->on_event(*event); +} - smart_objects::SmartObject& object = *smartObjectPtr; +TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenuWithChildMenu_SUCCESS) { + auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0); + sub_menu_map_.insert(std::pair( + kMenuId, sub_menu_ptr.get())); - object[am::strings::position] = 1; - object[am::strings::menu_name] = "SubMenu"; + auto sub_menu_child_ptr = GenerateSubMenuMap(kMenuIdChild, kMenuId); + sub_menu_map_.insert(std::pair( + kMenuIdChild, sub_menu_child_ptr.get())); - sub_menu_map_.insert( - std::pair(5, &object)); - EXPECT_CALL(*app_, sub_menu_map()).WillRepeatedly(Return(sub_menu_accessor_)); - EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); + SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->Run(); - InSequence seq; - EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_)); - EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); - EXPECT_CALL(*app_, get_grammar_id()).WillOnce(Return(kGrammarId)); + EventPtr event = PrepareSubMenuResponseEvent(kCorrelationId, kMenuIdChild); + SetUpSubMenuSubsequentResponseExpectations( + event, hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->on_event(*event); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _)) - .WillOnce(Return(true)); - - EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_)); - EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); - EXPECT_CALL(*app_, RemoveCommand(_)).WillOnce(DeleteCommand(&commands_map_)); - EXPECT_CALL(*app_, help_prompt_manager()) - .WillOnce(ReturnRef(*mock_help_prompt_manager_)); - EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandDeleted(kCmdId, false)); - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _)) - .WillOnce(Return(true)); + EventPtr event_final = + PrepareSubMenuResponseEvent(kCorrelationId + 1, kMenuId); + SetUpSubMenuFinalResponseExpectations(event_final); + command_->on_event(*event_final); +} - EXPECT_CALL(*app_, RemoveSubMenu(_)); - EXPECT_CALL( - mock_rpc_service_, - ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), - am::commands::Command::SOURCE_SDL)); - EXPECT_CALL(*app_, UpdateHash()); +TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenuWithVrAndUi_SUCCESS) { + auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0); + sub_menu_map_.insert(std::pair( + kMenuId, sub_menu_ptr.get())); - DeleteSubMenuRequestPtr command = - CreateCommand(message_); + auto command_ptr = GenerateUiVrCommandMapChild(kCmdId, kMenuId); + commands_map_.insert(std::pair( + kCmdId, command_ptr.get())); - command->Init(); - command->on_event(event); -} + SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::VR_DeleteCommand); + command_->Run(); -TEST_F(DeleteSubMenuResponseTest, Run_SUCCESS) { - MessageSharedPtr message(CreateMessage()); - (*message)[am::strings::msg_params][am::strings::connection_key] = - kConnectionKey; - DeleteSubMenuResponsePtr command( - CreateCommand(message)); + EventPtr event_vr = PrepareVrCommandResponseEvent(kCorrelationId); + SetUpVrCommandSubsequentResponseExpectations( + event_vr, hmi_apis::FunctionID::UI_DeleteCommand); + command_->on_event(*event_vr); - EXPECT_CALL( - mock_rpc_service_, - SendMessageToMobile(CheckMessageConnectionKey(kConnectionKey), _)); - command->Run(); + EventPtr event_ui = PrepareUiCommandResponseEvent(kCorrelationId + 1, kCmdId); + SetUpUiCommandSubsequentResponseExpectations( + event_ui, hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->on_event(*event_ui); + + EventPtr event_final = + PrepareSubMenuResponseEvent(kCorrelationId + 2, kMenuId); + SetUpSubMenuFinalResponseExpectations(event_final); + command_->on_event(*event_final); } TEST_F(DeleteSubMenuRequestTest, - DeleteSubmenu_CommandhaventVrCommadsAndMenuParams_DontSendHMIRequest) { - Event event(hmi_apis::FunctionID::UI_DeleteSubMenu); - (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId; - (*message_)[am::strings::params][am::strings::connection_key] = - kConnectionKey; - (*message_)[am::strings::params][am::hmi_response::code] = - am::mobile_api::Result::SUCCESS; - event.set_smart_object(*message_); + OnEvent_DeleteSubmenuWithChildVrAndUi_SUCCESS) { + auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0); + sub_menu_map_.insert(std::pair( + kMenuId, sub_menu_ptr.get())); - commands_map_.insert( - std::make_pair(0, &((*message_)[am::strings::msg_params]))); + auto sub_menu_child_ptr = GenerateSubMenuMap(kMenuIdChild, kMenuId); + sub_menu_map_.insert(std::pair( + kMenuIdChild, sub_menu_child_ptr.get())); - EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); - EXPECT_CALL(*app_, sub_menu_map()).WillRepeatedly(Return(sub_menu_accessor_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); - EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); - EXPECT_CALL(*app_, RemoveCommand(_)).Times(0); + auto command_ptr = GenerateUiVrCommandMapChild(kCmdId, kMenuIdChild); + commands_map_.insert(std::pair( + kCmdId, command_ptr.get())); - EXPECT_CALL( - mock_rpc_service_, - ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), - am::commands::Command::SOURCE_SDL)); - command_->on_event(event); + SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::VR_DeleteCommand); + command_->Run(); + + EventPtr event_vr = PrepareVrCommandResponseEvent(kCorrelationId); + SetUpVrCommandSubsequentResponseExpectations( + event_vr, hmi_apis::FunctionID::UI_DeleteCommand); + command_->on_event(*event_vr); + + EventPtr event_ui = PrepareUiCommandResponseEvent(kCorrelationId + 1, kCmdId); + SetUpUiCommandSubsequentResponseExpectations( + event_ui, hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->on_event(*event_ui); + + EventPtr event_submenu = + PrepareSubMenuResponseEvent(kCorrelationId + 2, kMenuIdChild); + SetUpSubMenuSubsequentResponseExpectations( + event_submenu, hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->on_event(*event_submenu); + + EventPtr event_final = + PrepareSubMenuResponseEvent(kCorrelationId + 3, kMenuId); + SetUpSubMenuFinalResponseExpectations(event_final); + command_->on_event(*event_final); } TEST_F(DeleteSubMenuRequestTest, - DeleteSubmenu_NotAChildOfMenupartam_DontSendHMIRequest) { - Event event(hmi_apis::FunctionID::UI_DeleteSubMenu); - (*message_)[am::strings::msg_params][am::strings::menu_id] = kMenuId; - (*message_)[am::strings::msg_params][am::strings::menu_params] - [am::hmi_request::parent_id] = kMenuId + 1; - (*message_)[am::strings::params][am::strings::connection_key] = - kConnectionKey; - (*message_)[am::strings::params][am::hmi_response::code] = - am::mobile_api::Result::SUCCESS; - event.set_smart_object(*message_); + OnEvent_DeleteSubmenuVrAndUiWithChild_SUCCESS) { + auto sub_menu_ptr = GenerateSubMenuMap(kMenuId, 0); + sub_menu_map_.insert(std::pair( + kMenuId, sub_menu_ptr.get())); - commands_map_.insert( - std::make_pair(0, &((*message_)[am::strings::msg_params]))); + auto command_ptr = GenerateUiVrCommandMapChild(kCmdId, kMenuId); + commands_map_.insert(std::pair( + kCmdId, command_ptr.get())); - EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); - EXPECT_CALL(*app_, sub_menu_map()).WillRepeatedly(Return(sub_menu_accessor_)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); - EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); - EXPECT_CALL(*app_, RemoveCommand(_)).Times(0); + auto sub_menu_child_ptr = GenerateSubMenuMap(kMenuIdChild, kMenuId); + sub_menu_map_.insert(std::pair( + kMenuIdChild, sub_menu_child_ptr.get())); + + SetUpSubMenuRequestExpectations(hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->Run(); + + EventPtr event_submenu = + PrepareSubMenuResponseEvent(kCorrelationId, kMenuIdChild); + SetUpSubMenuSubsequentResponseExpectations( + event_submenu, hmi_apis::FunctionID::VR_DeleteCommand); + command_->on_event(*event_submenu); + + EventPtr event_vr = PrepareVrCommandResponseEvent(kCorrelationId + 1); + SetUpVrCommandSubsequentResponseExpectations( + event_vr, hmi_apis::FunctionID::UI_DeleteCommand); + command_->on_event(*event_vr); + + EventPtr event_ui = PrepareUiCommandResponseEvent(kCorrelationId + 2, kCmdId); + SetUpUiCommandSubsequentResponseExpectations( + event_ui, hmi_apis::FunctionID::UI_DeleteSubMenu); + command_->on_event(*event_ui); + + EventPtr event_final = + PrepareSubMenuResponseEvent(kCorrelationId + 3, kMenuId); + SetUpSubMenuFinalResponseExpectations(event_final); + command_->on_event(*event_final); +} + +TEST_F(DeleteSubMenuResponseTest, Run_SUCCESS) { + MessageSharedPtr message(CreateMessage()); + (*message)[am::strings::msg_params][am::strings::connection_key] = + kConnectionKey; + DeleteSubMenuResponsePtr command( + CreateCommand(message)); EXPECT_CALL( mock_rpc_service_, - ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), - am::commands::Command::SOURCE_SDL)); - command_->on_event(event); + SendMessageToMobile(CheckMessageConnectionKey(kConnectionKey), _)); + command->Run(); } } // namespace delete_sub_menu_request -- cgit v1.2.1 From 50457915a4081e8c135d6a400eb30330f0d37c9d Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Wed, 11 Aug 2021 09:12:02 -0400 Subject: Remove dependency between optional params in OnRemoteControlSettings (#3749) * Removed dependence on allowed when updating accessMode * Update src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc Co-authored-by: Shobhit Adlakha Co-authored-by: Roman Reznichenko Co-authored-by: Shobhit Adlakha --- .../rc_on_remote_control_settings_notification.cc | 37 +++++++++++----------- .../commands/on_remote_control_settings_test.cc | 5 +-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc index 217258b086..860e18a105 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc @@ -87,35 +87,34 @@ void RCOnRemoteControlSettingsNotification::DisallowRCFunctionality() { void RCOnRemoteControlSettingsNotification::Run() { SDL_LOG_AUTO_TRACE(); - if (!(*message_)[app_mngr::strings::msg_params].keyExists( - message_params::kAllowed)) { - SDL_LOG_DEBUG("Notification is ignored due to \"allow\" parameter absense"); + if ((*message_)[app_mngr::strings::msg_params].empty()) { + SDL_LOG_DEBUG("Notification is ignored due to absence of any parameters"); SDL_LOG_DEBUG("RC Functionality remains unchanged"); return; } + hmi_apis::Common_RCAccessMode::eType access_mode = + hmi_apis::Common_RCAccessMode::INVALID_ENUM; + if ((*message_)[app_mngr::strings::msg_params].keyExists( + message_params::kAccessMode)) { + access_mode = static_cast( + (*message_)[app_mngr::strings::msg_params][message_params::kAccessMode] + .asUInt()); + SDL_LOG_DEBUG( + "Setting up access mode : " << AccessModeToString(access_mode)); + } else { + access_mode = resource_allocation_manager_.GetAccessMode(); + SDL_LOG_DEBUG("No access mode received. Using last known: " + << AccessModeToString(access_mode)); + } + resource_allocation_manager_.SetAccessMode(access_mode); + const bool is_allowed = (*message_)[app_mngr::strings::msg_params][message_params::kAllowed] .asBool(); if (is_allowed) { - hmi_apis::Common_RCAccessMode::eType access_mode = - hmi_apis::Common_RCAccessMode::INVALID_ENUM; SDL_LOG_DEBUG("Allowing RC Functionality"); resource_allocation_manager_.set_rc_enabled(true); - if ((*message_)[app_mngr::strings::msg_params].keyExists( - message_params::kAccessMode)) { - access_mode = static_cast( - (*message_)[app_mngr::strings::msg_params] - [message_params::kAccessMode] - .asUInt()); - SDL_LOG_DEBUG( - "Setting up access mode : " << AccessModeToString(access_mode)); - } else { - access_mode = resource_allocation_manager_.GetAccessMode(); - SDL_LOG_DEBUG("No access mode received. Using last known: " - << AccessModeToString(access_mode)); - } - resource_allocation_manager_.SetAccessMode(access_mode); } else { SDL_LOG_DEBUG("Disallowing RC Functionality"); DisallowRCFunctionality(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc index 62b726ac60..7907013fa3 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc @@ -145,9 +145,10 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest, MessageSharedPtr mobile_message = CreateBasicMessage(); (*mobile_message)[application_manager::strings::msg_params] [message_params::kAllowed] = false; - - EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations()); + ON_CALL(mock_allocation_manager_, GetAccessMode()) + .WillByDefault(Return(hmi_apis::Common_RCAccessMode::ASK_DRIVER)); EXPECT_CALL(mock_interior_data_manager_, OnDisablingRC()); + EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations()); EXPECT_CALL(mock_rc_consent_manger_, RemoveAllConsents()); // Act -- cgit v1.2.1 From 253280549e45ed726cce9246682fe09263ef5525 Mon Sep 17 00:00:00 2001 From: "Yana Chernysheva (GitHub)" <59469418+ychernysheva@users.noreply.github.com> Date: Wed, 11 Aug 2021 19:56:55 +0300 Subject: [SDL-0189] Restructuring OnResetTimeout (#3726) * Add Reset Timeout Handler, remove deprecated functionality, create Request Controller interface. * fixup! Add Reset Timeout Handler, remove deprecated functionality, create Request Controller interface. * Fix compilation errors after merge of develop branch * Remove deprecated functions from SubtleAlert request and remove redundant UTs * Add changes to HMI API * Increase timeout in case if SIVD need Consent popup * Increase timeout for ButtonPress request * Restrict timeout for Subtle Alert with soft buttons * update timeout for hmi request * careful stopping of the request controller * Fix OnResetTimeout for Alerts with soft buttons (#192) * Do not manage requests with NULL timeout * Revert double timeouts from core * Apply smaller timeout to requests * Address Livio comments * Add timeout compensation parameter Update default timeout logic accordingly for all commands. Added new file to ini file. * Fix affected unit tests * Address Livio comments * Update rpc_spec * Update rpc_spec one more time Co-authored-by: Yevhenii Co-authored-by: Yevhenii Co-authored-by: Vadym Luchko (gitHub) Co-authored-by: Vadym Luchko (GitHub) <76956836+VadymLuchko@users.noreply.github.com> Co-authored-by: Dmytro Boltovskyi (GitHub) Co-authored-by: Andrii Kalinich --- src/appMain/smartDeviceLink.ini | 2 + .../application_manager/application_manager_impl.h | 25 +- .../commands/command_request_impl.h | 7 + .../application_manager/request_controller.h | 320 ----------- .../application_manager/request_controller_impl.h | 217 ++++++++ .../include/application_manager/request_info.h | 6 +- .../request_timeout_handler_impl.h | 75 +++ .../application_manager/smart_object_keys.h | 4 + .../test/commands/hmi/dummy_hmi_commands_test.cc | 8 +- .../commands/mobile/dummy_mobile_commands_test.cc | 8 +- .../rc_rpc_plugin/resource_allocation_manager.h | 13 + .../resource_allocation_manager_impl.h | 4 + .../src/commands/rc_command_request.cc | 5 + .../src/resource_allocation_manager_impl.cc | 22 + .../test/commands/button_press_request_test.cc | 2 + .../rc_get_interior_vehicle_data_consent_test.cc | 15 +- .../set_interior_vehicle_data_request_test.cc | 2 + .../mock/mock_resource_allocation_manager.h | 4 + .../commands/hmi/on_reset_timeout_notification.h | 83 +++ .../hmi/on_tts_reset_timeout_notification.h | 83 --- .../hmi/on_ui_reset_timeout_notification.h | 83 --- .../hmi/navi_audio_start_stream_request.cc | 6 +- .../src/commands/hmi/navi_start_stream_request.cc | 6 +- .../commands/hmi/on_reset_timeout_notification.cc | 72 +++ .../hmi/on_tts_reset_timeout_notification.cc | 71 --- .../hmi/on_ui_reset_timeout_notification.cc | 72 --- .../src/commands/hmi/sdl_activate_app_request.cc | 4 +- .../src/commands/mobile/alert_maneuver_request.cc | 10 +- .../src/commands/mobile/alert_request.cc | 17 +- .../create_interaction_choice_set_request.cc | 2 +- .../src/commands/mobile/get_way_points_request.cc | 10 +- .../mobile/perform_audio_pass_thru_request.cc | 12 +- .../commands/mobile/perform_interaction_request.cc | 15 +- .../commands/mobile/scrollable_message_request.cc | 10 +- .../src/commands/mobile/slider_request.cc | 13 +- .../src/commands/mobile/speak_request.cc | 10 +- .../src/commands/mobile/subtle_alert_request.cc | 17 +- .../sdl_rpc_plugin/src/hmi_command_factory.cc | 10 +- .../test/commands/hmi/dummy_hmi_commands_test.cc | 14 +- .../test/commands/hmi/hmi_notifications_test.cc | 34 +- .../commands/hmi/sdl_activate_app_request_test.cc | 5 +- .../test/commands/mobile/alert_request_test.cc | 21 - .../mobile/create_interaction_choice_set_test.cc | 14 +- .../commands/mobile/dummy_mobile_commands_test.cc | 8 +- .../commands/mobile/get_way_points_request_test.cc | 2 +- .../mobile/perform_audio_pass_thru_test.cc | 32 +- .../mobile/register_app_interface_request_test.cc | 3 + .../commands/mobile/scrollable_message_test.cc | 24 +- .../test/commands/mobile/slider_test.cc | 16 - .../test/commands/mobile/speak_request_test.cc | 12 - .../commands/vi_commands_test.h | 9 +- .../src/application_manager_impl.cc | 41 +- .../src/commands/command_impl.cc | 4 +- .../src/commands/command_request_impl.cc | 51 +- .../src/commands/request_from_hmi.cc | 4 +- .../application_manager/src/hmi_interfaces_impl.cc | 4 +- .../application_manager/src/request_controller.cc | 546 ------------------- .../src/request_controller_impl.cc | 586 +++++++++++++++++++++ .../application_manager/src/request_info.cc | 20 +- .../src/request_timeout_handler_impl.cc | 122 +++++ .../application_manager/src/rpc_service_impl.cc | 19 +- .../application_manager/src/smart_object_keys.cc | 4 + .../application_manager/test/CMakeLists.txt | 1 + .../test/commands/command_impl_test.cc | 4 +- .../test/help_prompt_manager_test.cc | 3 + .../commands/command_request_test.h | 7 +- .../application_manager/commands/commands_test.h | 14 +- .../test/message_helper/message_helper_test.cc | 3 +- .../request_controller/request_controller_test.cc | 34 +- .../test/request_timeout_handler_test.cc | 306 +++++++++++ .../test/rpc_service_impl_test.cc | 9 +- .../test/zero_request_amount_test.cc | 18 +- .../include/config_profile/profile.h | 7 + src/components/config_profile/src/profile.cc | 17 + .../application_manager/application_manager.h | 13 +- .../application_manager_settings.h | 1 + .../application_manager/request_controller.h | 194 +++++++ .../application_manager/request_timeout_handler.h | 85 +++ .../application_manager/mock_application_manager.h | 8 +- .../mock_application_manager_settings.h | 1 + .../application_manager/mock_request_controller.h | 87 +++ .../mock_request_timeout_handler.h | 57 ++ src/components/interfaces/HMI_API.xml | 42 +- tools/rpc_spec | 2 +- 84 files changed, 2301 insertions(+), 1552 deletions(-) delete mode 100644 src/components/application_manager/include/application_manager/request_controller.h create mode 100644 src/components/application_manager/include/application_manager/request_controller_impl.h create mode 100644 src/components/application_manager/include/application_manager/request_timeout_handler_impl.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_reset_timeout_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc delete mode 100644 src/components/application_manager/src/request_controller.cc create mode 100644 src/components/application_manager/src/request_controller_impl.cc create mode 100644 src/components/application_manager/src/request_timeout_handler_impl.cc create mode 100644 src/components/application_manager/test/request_timeout_handler_test.cc create mode 100644 src/components/include/application_manager/request_controller.h create mode 100644 src/components/include/application_manager/request_timeout_handler.h create mode 100644 src/components/include/test/application_manager/mock_request_controller.h create mode 100644 src/components/include/test/application_manager/mock_request_timeout_handler.h diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index d19f7ef7a1..56822db0ef 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -58,6 +58,8 @@ HMICapabilitiesCacheFile = hmi_capabilities_cache.json MaxCmdID = 2000000000 ; SDL respond timeout (in milliseconds) in case of HMI has not respond on a mobile request DefaultTimeout = 10000 +; Extra time to compensate default timeout due to external delays +DefaultTimeoutCompensation = 1000 ; Available disk space in bytes for each application file handling ; Default value is 100 MiB AppDirectoryQuota = 104857600 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 a8a41bc23a..09f2c7d4df 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 @@ -53,7 +53,6 @@ #include "application_manager/hmi_interfaces_impl.h" #include "application_manager/message.h" #include "application_manager/message_helper.h" -#include "application_manager/request_controller.h" #include "application_manager/resumption/resume_ctrl.h" #include "application_manager/rpc_handler.h" #include "application_manager/rpc_service.h" @@ -781,14 +780,14 @@ class ApplicationManagerImpl * * @param ptr Reference to shared pointer that point on hmi notification */ - void addNotification(const CommandSharedPtr ptr); + void AddNotification(const CommandSharedPtr ptr); /** * @ Add notification to collection * - * @param ptr Reference to shared pointer that point on hmi notification + * @param notification Pointer that points to hmi notification */ - void removeNotification(const commands::Command* notification); + void RemoveNotification(const commands::Command* notification); /** * @ Updates request timeout @@ -797,7 +796,7 @@ class ApplicationManagerImpl * @param mobile_correlation_id Correlation ID of the mobile request * @param new_timeout_value New timeout in milliseconds to be set */ - void updateRequestTimeout(uint32_t connection_key, + void UpdateRequestTimeout(uint32_t connection_key, uint32_t mobile_correlation_id, uint32_t new_timeout_value) OVERRIDE; @@ -986,6 +985,18 @@ class ApplicationManagerImpl return *rpc_handler_; } + request_controller::RequestTimeoutHandler& get_request_timeout_handler() + const OVERRIDE { + DCHECK(request_timeout_handler_); + return *request_timeout_handler_; + } + + request_controller::RequestController& get_request_controller() + const OVERRIDE { + DCHECK(request_ctrl_); + return *request_ctrl_; + } + void SetRPCService(std::unique_ptr& rpc_service) { rpc_service_ = std::move(rpc_service); } @@ -1589,8 +1600,10 @@ class ApplicationManagerImpl connection_handler::ConnectionHandler* connection_handler_; std::unique_ptr policy_handler_; protocol_handler::ProtocolHandler* protocol_handler_; + std::unique_ptr + request_timeout_handler_; + std::unique_ptr request_ctrl_; std::unique_ptr plugin_manager_; - request_controller::RequestController request_ctrl_; std::unique_ptr app_service_manager_; /** diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index 084340ad08..727863d16d 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -419,6 +419,13 @@ class CommandRequestImpl : public CommandImpl, */ void AddTimeOutComponentInfoToMessage( smart_objects::SmartObject& response) const; + /** + * @brief AddRequestToTimeoutHandler checks the request and adds it to + * request_timeout_handler map for tracking + * @param request_to_hmi request to HMI + */ + void AddRequestToTimeoutHandler( + const smart_objects::SmartObject& request_to_hmi) const; }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/request_controller.h b/src/components/application_manager/include/application_manager/request_controller.h deleted file mode 100644 index 8a3c90061e..0000000000 --- a/src/components/application_manager/include/application_manager/request_controller.h +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_ - -#include -#include -#include - -#include "utils/lock.h" - -#include "utils/conditional_variable.h" -#include "utils/threads/thread.h" -#include "utils/threads/thread_delegate.h" -#include "utils/timer.h" - -#include "interfaces/HMI_API.h" -#include "interfaces/MOBILE_API.h" - -#include "application_manager/request_controller_settings.h" -#include "application_manager/request_info.h" -#include "application_manager/request_tracker.h" - -namespace application_manager { - -namespace request_controller { - -/** - * @brief RequestController class is used to control currently active mobile - * requests. - */ -class RequestController { - public: - /** - * @brief Result code for addRequest - */ - enum TResult { - SUCCESS = 0, - TOO_MANY_REQUESTS, - TOO_MANY_PENDING_REQUESTS, - NONE_HMI_LEVEL_MANY_REQUESTS, - INVALID_DATA - }; - - /** - * @brief Thread pool state - */ - enum TPoolState { - UNDEFINED = 0, - STARTED, - STOPPED, - }; - - // Methods - - /** - * @brief Class constructor - * - */ - RequestController(const RequestControlerSettings& settings); - - /** - * @brief Class destructor - * - */ - virtual ~RequestController(); - - /** - * @brief Initialize thread pool - * - */ - void InitializeThreadpool(); - - /** - * @brief Destroy thread pool - * - */ - void DestroyThreadpool(); - - /** - * @brief Check if max request amount wasn't exceed and adds request to queue. - * - * @param request Active mobile request - * @param hmi_level Current application hmi_level - * - * @return Result code - * - */ - TResult addMobileRequest(const RequestPtr request, - const mobile_apis::HMILevel::eType& hmi_level); - - /** - * @brief Store HMI request until response or timeout won't remove it - * - * @param request Active hmi request - * @return Result code - * - */ - TResult addHMIRequest(const RequestPtr request); - - /** - * @ Add notification to collection - * - * @param ptr Reference to shared pointer that point on hmi notification - */ - void addNotification(const RequestPtr ptr); - - /** - * @brief Removes request from queue - * - * @param correlation_id Active request correlation ID, - * @param connection_key Active request connection key (0 for HMI requersts) - * @param function_id Active request function id - * @param force_terminate if true, request controller will terminate - * even if not allowed by request - */ - void TerminateRequest(const uint32_t correlation_id, - const uint32_t connection_key, - const int32_t function_id, - bool force_terminate = false); - - /** - * @brief Removes request from queue - * - * @param mobile_correlation_id Active mobile request correlation ID - * - */ - void OnMobileResponse(const uint32_t mobile_correlation_id, - const uint32_t connection_key, - const int32_t function_id); - - /** - * @brief Removes request from queue - * - * @param mobile_correlation_id Active mobile request correlation ID - * - */ - void OnHMIResponse(const uint32_t correlation_id, const int32_t function_id); - - /** - * @ Add notification to collection - * - * @param ptr Reference to shared pointer that point on hmi notification - */ - void removeNotification(const commands::Command* notification); - - /** - * @brief Removes all requests from queue for specified application - * - * @param app_id Mobile application ID (app_id) - * - */ - void terminateAppRequests(const uint32_t& app_id); - - /** - * @brief Terminates all requests from HMI - */ - void terminateAllHMIRequests(); - - /** - * @brief Terminates all requests from Mobile - */ - void terminateAllMobileRequests(); - - /** - * @brief Updates request timeout - * - * @param app_id Connection key of application - * @param mobile_correlation_id Correlation ID of the mobile request - * @param new_timeout_value New timeout to be set in milliseconds - */ - void updateRequestTimeout(const uint32_t& app_id, - const uint32_t& mobile_correlation_id, - const uint32_t& new_timeout); - - /* - * @brief Function Should be called when Low Voltage is occured - */ - void OnLowVoltage(); - - /* - * @brief Function Should be called when Low Voltage is occured - */ - void OnWakeUp(); - - bool IsLowVoltage(); - - protected: - /** - * @brief Timer callback which handles all request timeouts - */ - void TimeoutThread(); - - /** - * @brief Signal timer condition variable - */ - void NotifyTimer(); - - void terminateWaitingForExecutionAppRequests(const uint32_t& app_id); - void terminateWaitingForResponseAppRequests(const uint32_t& app_id); - - /** - * @brief Checks whether all constraints are met before adding of request into - * processing queue. Verifies amount of pending requests, amount of requests - * per time scale for different HMI levels - * @param request - request to check constraints for - * @param level - HMI level in which request has been issued - * @return Appropriate result code of verification - */ - TResult CheckPosibilitytoAdd(const RequestPtr request, - const mobile_api::HMILevel::eType level); - - /** - * @brief Check Posibility to add new requests, or limits was exceeded - * @param pending_requests_amount - maximum count of request that should be - * allowed for all applications - * @return True if new request could be added, false otherwise - */ - bool CheckPendingRequestsAmount(const uint32_t& pending_requests_amount); - - private: - class Worker : public threads::ThreadDelegate { - public: - explicit Worker(RequestController* requestController); - virtual ~Worker(); - virtual void threadMain(); - virtual void exitThreadMain(); - - protected: - private: - RequestController* request_controller_; - sync_primitives::Lock thread_lock_; - volatile bool stop_flag_; - }; - - std::vector pool_; - volatile TPoolState pool_state_; - uint32_t pool_size_; - sync_primitives::ConditionalVariable cond_var_; - - std::list mobile_request_list_; - sync_primitives::Lock mobile_request_list_lock_; - - /* - * Requests, that are waiting for responses - * RequestInfoSet provides correct processing of requests with thre same - * app_id and corr_id - */ - RequestInfoSet waiting_for_response_; - - /** - * @brief Tracker verifying time scale and maximum requests amount in - * different HMI levels - */ - RequestTracker request_tracker_; - - /** - * @brief Set of HMI notifications with timeout. - */ - std::list notification_list_; - - /** - * @brief Map keeping track of how many duplicate messages were sent for a - * given correlation id, to prevent early termination of a request - */ - std::map duplicate_message_count_; - sync_primitives::Lock duplicate_message_count_lock_; - - /* - * timer for checking requests timeout - */ - timer::Timer timer_; - - /* - * Timer for lock - */ - bool timer_stop_flag_; - sync_primitives::Lock timer_lock; - sync_primitives::ConditionalVariable timer_condition_; - - bool is_low_voltage_; - const RequestControlerSettings& settings_; - DISALLOW_COPY_AND_ASSIGN(RequestController); -}; - -} // namespace request_controller - -} // namespace application_manager - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_ diff --git a/src/components/application_manager/include/application_manager/request_controller_impl.h b/src/components/application_manager/include/application_manager/request_controller_impl.h new file mode 100644 index 0000000000..7277cdc3fa --- /dev/null +++ b/src/components/application_manager/include/application_manager/request_controller_impl.h @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2014, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_IMPL_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_IMPL_H_ + +#include +#include +#include + +#include "utils/lock.h" + +#include "utils/conditional_variable.h" +#include "utils/threads/thread.h" +#include "utils/threads/thread_delegate.h" +#include "utils/timer.h" + +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" + +#include "application_manager/request_controller.h" +#include "application_manager/request_controller_settings.h" +#include "application_manager/request_info.h" +#include "application_manager/request_tracker.h" + +namespace application_manager { + +namespace request_controller { + +class RequestControllerImpl : public RequestController { + public: + /** + * @brief Class constructor + * + */ + RequestControllerImpl(const RequestControlerSettings& settings, + RequestTimeoutHandler& request_timeout_handler); + + ~RequestControllerImpl(); + + void Stop() OVERRIDE; + + void InitializeThreadpool() OVERRIDE; + + void DestroyThreadpool() OVERRIDE; + + TResult AddMobileRequest( + const RequestPtr request, + const mobile_apis::HMILevel::eType& hmi_level) OVERRIDE; + + TResult AddHMIRequest(const RequestPtr request) OVERRIDE; + + void AddNotification(const RequestPtr ptr) OVERRIDE; + + void TerminateRequest(const uint32_t correlation_id, + const uint32_t connection_key, + const int32_t function_id, + const bool force_terminate = false) OVERRIDE; + + void OnMobileResponse(const uint32_t mobile_correlation_id, + const uint32_t connection_key, + const int32_t function_id) OVERRIDE; + + void OnHMIResponse(const uint32_t correlation_id, + const int32_t function_id) OVERRIDE; + + void RemoveNotification(const commands::Command* notification) OVERRIDE; + + void TerminateAppRequests(const uint32_t app_id) OVERRIDE; + + void TerminateAllHMIRequests() OVERRIDE; + + void TerminateAllMobileRequests() OVERRIDE; + + void UpdateRequestTimeout(const uint32_t app_id, + const uint32_t mobile_correlation_id, + const uint32_t new_timeout) OVERRIDE; + + void OnLowVoltage() OVERRIDE; + + void OnWakeUp() OVERRIDE; + + bool IsLowVoltage() OVERRIDE; + + protected: + /** + * @brief Timer callback which handles all request timeouts + */ + void TimeoutThread(); + + /** + * @brief Signal timer condition variable + */ + void NotifyTimer(); + + void TerminateWaitingForExecutionAppRequests(const uint32_t app_id); + void TerminateWaitingForResponseAppRequests(const uint32_t app_id); + + /** + * @brief Checks whether all constraints are met before adding of request into + * processing queue. Verifies amount of pending requests, amount of requests + * per time scale for different HMI levels + * @param request - request to check constraints for + * @param level - HMI level in which request has been issued + * @return Appropriate result code of verification + */ + TResult CheckPosibilitytoAdd(const RequestPtr request, + const mobile_api::HMILevel::eType level); + + /** + * @brief Check Posibility to add new requests, or limits was exceeded + * @param pending_requests_amount - maximum count of request that should be + * allowed for all applications + * @return True if new request could be added, false otherwise + */ + bool CheckPendingRequestsAmount(const uint32_t pending_requests_amount); + + private: + class Worker : public threads::ThreadDelegate { + public: + explicit Worker(RequestControllerImpl* request_controller); + virtual ~Worker(); + virtual void threadMain(); + virtual void exitThreadMain(); + + protected: + private: + RequestControllerImpl* request_controller_; + sync_primitives::Lock thread_lock_; + volatile bool stop_flag_; + }; + + std::vector pool_; + volatile TPoolState pool_state_; + uint32_t pool_size_; + sync_primitives::ConditionalVariable cond_var_; + + std::list mobile_request_list_; + sync_primitives::Lock mobile_request_list_lock_; + + /* + * Requests, that are waiting for responses + * RequestInfoSet provides correct processing of requests with thre same + * app_id and corr_id + */ + RequestInfoSet waiting_for_response_; + + /** + * @brief Tracker verifying time scale and maximum requests amount in + * different HMI levels + */ + RequestTracker request_tracker_; + + /** + * @brief Set of HMI notifications with timeout. + */ + std::list notification_list_; + + /** + * @brief Map keeping track of how many duplicate messages were sent for a + * given correlation id, to prevent early termination of a request + */ + std::map duplicate_message_count_; + sync_primitives::Lock duplicate_message_count_lock_; + + /* + * timer for checking requests timeout + */ + timer::Timer timer_; + + /* + * Timer for lock + */ + bool timer_stop_flag_; + sync_primitives::Lock timer_lock; + sync_primitives::ConditionalVariable timer_condition_; + + bool is_low_voltage_; + const RequestControlerSettings& settings_; + RequestTimeoutHandler& request_timeout_handler_; + DISALLOW_COPY_AND_ASSIGN(RequestControllerImpl); +}; + +} // namespace request_controller + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h index c6cf00caea..e3d5dfd491 100644 --- a/src/components/application_manager/include/application_manager/request_info.h +++ b/src/components/application_manager/include/application_manager/request_info.h @@ -127,7 +127,7 @@ struct RequestInfo { } uint64_t hash(); static uint64_t GenerateHash(uint32_t var1, uint32_t var2); - static uint32_t HmiConnectionKey; + static constexpr uint32_t kHmiConnectionKey = 0; protected: RequestPtr request_; @@ -199,7 +199,7 @@ class RequestInfoSet { * @return founded request or shared_ptr with NULL */ RequestInfoPtr Find(const uint32_t connection_key, - const uint32_t correlation_id); + const uint32_t correlation_id) const; /* * @brief Get request with smalest end_time_ @@ -269,7 +269,7 @@ class RequestInfoSet { TimeSortedRequestInfoSet time_sorted_pending_requests_; HashSortedRequestInfoSet hash_sorted_pending_requests_; - sync_primitives::Lock pending_requests_lock_; + mutable sync_primitives::Lock pending_requests_lock_; }; /** diff --git a/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h b/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h new file mode 100644 index 0000000000..c58d09598f --- /dev/null +++ b/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_IMPL_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_IMPL_H_ + +#include +#include "application_manager/application_manager.h" +#include "application_manager/event_engine/event_observer.h" +#include "application_manager/request_timeout_handler.h" + +namespace application_manager { + +namespace request_controller { + +class RequestTimeoutHandlerImpl : public event_engine::EventObserver, + public RequestTimeoutHandler { + public: + RequestTimeoutHandlerImpl(ApplicationManager& application_manager); + void AddRequest(const uint32_t hmi_correlation_id, + const Request& request) OVERRIDE; + void RemoveRequest(const uint32_t hmi_correlation_id) OVERRIDE; + void on_event(const event_engine::Event& event) OVERRIDE; + + private: + /** + * @brief Checks whether specified request timeout should be updated or not + * @param request reference to request structure to check + * @param timeout new timeout to apply + * @param method_name name of method to check + * @return true if timeout update is required for this request, otherwise + * returns false + */ + bool IsTimeoutUpdateRequired(const Request& request, + const uint32_t timeout, + const hmi_apis::FunctionID::eType method_name); + + std::map requests_; + ApplicationManager& application_manager_; + mutable sync_primitives::Lock requests_lock_; +}; + +} // namespace request_controller +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h index 5a79059f1f..b1b3c5f000 100644 --- a/src/components/application_manager/include/application_manager/smart_object_keys.h +++ b/src/components/application_manager/include/application_manager/smart_object_keys.h @@ -501,6 +501,10 @@ extern const char* const rect; extern const char* const x; extern const char* const y; extern const char* const preferred_fps; + +// OnResetTimeout +extern const char* const request_id; +extern const char* const reset_period; } // namespace strings namespace hmi_interface { diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc index 4236ac23f9..4e79bad899 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -92,14 +92,10 @@ class HMICommandsTest : public components::commands_test::CommandRequestTest< typedef Command CommandType; void InitCommand(const uint32_t& timeout) OVERRIDE { + CommandRequestTest::InitCommand(timeout); + stream_retry_.first = 0; stream_retry_.second = 0; - EXPECT_CALL(app_mngr_settings_, default_timeout()) - .WillOnce(ReturnRef(timeout)); - ON_CALL(app_mngr_, event_dispatcher()) - .WillByDefault(ReturnRef(event_dispatcher_)); - ON_CALL(app_mngr_, get_settings()) - .WillByDefault(ReturnRef(app_mngr_settings_)); ON_CALL(app_mngr_settings_, start_stream_retry_amount()) .WillByDefault(ReturnRef(stream_retry_)); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc index 69bff3ad76..3c70028574 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc @@ -88,12 +88,8 @@ class MobileCommandsTest : public components::commands_test::CommandRequestTest< typedef Command CommandType; void InitCommand(const uint32_t& timeout) OVERRIDE { - EXPECT_CALL(app_mngr_settings_, default_timeout()) - .WillOnce(ReturnRef(timeout)); - ON_CALL(app_mngr_, event_dispatcher()) - .WillByDefault(ReturnRef(event_dispatcher_)); - ON_CALL(app_mngr_, get_settings()) - .WillByDefault(ReturnRef(app_mngr_settings_)); + CommandRequestTest::InitCommand(timeout); + ON_CALL(app_mngr_settings_, app_icons_folder()) .WillByDefault(ReturnRef(kEmptyString_)); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h index ee0bd11885..623498dac7 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h @@ -129,6 +129,19 @@ class ResourceAllocationManager { virtual bool IsResourceFree(const std::string& module_type, const std::string& module_id) const = 0; + /** + * @brief IsResourceAllocated check if module is allocated by certain + * application + * @param module_type module to be checked + * @param module_id uuid of a resource to be checked + * @param app_id app to be checked + * @return true if module_type is allocated by application with provided + * app_id + */ + virtual bool IsResourceAllocated(const std::string& module_type, + const std::string& module_id, + const uint32_t app_id) = 0; + /** * @brief AcquireResource forces acquiring resource by application * @param module_type resource to acquire diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h index 0fd5449912..4361312dde 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager_impl.h @@ -94,6 +94,10 @@ class ResourceAllocationManagerImpl : public ResourceAllocationManager { bool IsResourceFree(const std::string& module_type, const std::string& module_id) const FINAL; + bool IsResourceAllocated(const std::string& module_type, + const std::string& module_id, + const uint32_t app_id) FINAL; + void SetAccessMode( const hmi_apis::Common_RCAccessMode::eType access_mode) FINAL; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc index 12608d64c1..e179c0c0d7 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc @@ -278,6 +278,11 @@ void RCCommandRequest::ProcessConsentResult(const bool is_allowed, SDL_LOG_AUTO_TRACE(); if (is_allowed) { SetResourceState(module_type, ResourceState::BUSY); + const auto default_timeout = + application_manager_.get_settings().default_timeout() + + application_manager_.get_settings().default_timeout_compensation(); + application_manager_.UpdateRequestTimeout( + connection_key(), correlation_id(), default_timeout); Execute(); // run child's logic } else { resource_allocation_manager_.OnDriverDisallowed( diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc index a26cf71448..0c513cb01e 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc @@ -488,6 +488,28 @@ bool ResourceAllocationManagerImpl::IsResourceFree( return ResourceState::FREE == resource->second; } +bool ResourceAllocationManagerImpl::IsResourceAllocated( + const std::string& module_type, + const std::string& module_id, + const uint32_t app_id) { + ModuleUid module(module_type, module_id); + sync_primitives::AutoLock lock(allocated_resources_lock_); + const auto allocation = allocated_resources_.find(module); + if (allocated_resources_.end() == allocation) { + SDL_LOG_DEBUG("Resource " << module_type << " is not allocated."); + return false; + } + + if (app_id != allocation->second) { + SDL_LOG_DEBUG("Resource " << module_type + << " is allocated by different application " + << allocation->second); + return true; + } + + return false; +} + void ResourceAllocationManagerImpl::SetAccessMode( const hmi_apis::Common_RCAccessMode::eType access_mode) { if (hmi_apis::Common_RCAccessMode::ASK_DRIVER != access_mode) { diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc index 6c0962a557..3772a25f47 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc @@ -105,6 +105,8 @@ class ButtonPressRequestTest .WillByDefault(Return(true)); ON_CALL(mock_allocation_manager_, is_rc_enabled()) .WillByDefault(Return(true)); + ON_CALL(mock_allocation_manager_, GetAccessMode()) + .WillByDefault(Return(hmi_apis::Common_RCAccessMode::AUTO_ALLOW)); ON_CALL(mock_rc_capabilities_manager_, CheckButtonName(_, _)) .WillByDefault(Return(true)); ON_CALL(mock_rc_capabilities_manager_, CheckIfModuleExistsInCapabilities(_)) diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc index 8fbaeda2f2..15b2148187 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc @@ -39,10 +39,11 @@ #include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_request_controller_settings.h" +#include "application_manager/mock_request_timeout_handler.h" #include "application_manager/mock_rpc_plugin.h" #include "application_manager/mock_rpc_plugin_manager.h" #include "application_manager/mock_rpc_protection_manager.h" -#include "application_manager/request_controller.h" +#include "application_manager/request_controller_impl.h" #include "application_manager/rpc_service_impl.h" #include "hmi_message_handler/mock_hmi_message_handler.h" #include "include/test/protocol_handler/mock_protocol_handler.h" @@ -81,6 +82,7 @@ using test::components::application_manager_test::MockApplication; using test::components::application_manager_test::MockCommandFactory; using test::components::application_manager_test::MockHMICapabilities; using test::components::application_manager_test::MockRequestControlerSettings; +using test::components::application_manager_test::MockRequestTimeoutHandler; using test::components::commands_test::CommandRequestTest; using test::components::commands_test::CommandsTestMocks; using test::components::hmi_message_handler_test::MockHMIMessageHandler; @@ -108,9 +110,10 @@ class RCGetInteriorVehicleDataConsentTest , command_holder(app_mngr_) , rc_capabilities_(std::make_shared( smart_objects::SmartType::SmartType_Array)) - , request_controller(mock_request_controler) , rpc_protection_manager_( std::make_shared()) + , request_controller(mock_request_controler, + mock_request_timeout_handler_) , rpc_service_(app_mngr_, request_controller, &mock_protocol_handler, @@ -214,9 +217,10 @@ class RCGetInteriorVehicleDataConsentTest smart_objects::SmartObjectSPtr rc_capabilities_; MockRPCPlugin mock_rpc_plugin; MockCommandFactory mock_command_factory; - am::request_controller::RequestController request_controller; std::shared_ptr rpc_protection_manager_; + MockRequestTimeoutHandler mock_request_timeout_handler_; + am::request_controller::RequestControllerImpl request_controller; am::rpc_service::RPCServiceImpl rpc_service_; RCRPCPlugin rc_plugin_; std::shared_ptr rc_app_extension_; @@ -235,6 +239,8 @@ TEST_F(RCGetInteriorVehicleDataConsentTest, Run_MobileSendButtonPressMessage_HMISendASKDRIVERModeToMobile) { // Arrange auto mobile_message = CreateBasicMessage(); + ON_CALL(mock_allocation_manager_, GetAccessMode()) + .WillByDefault(Return(hmi_apis::Common_RCAccessMode::ASK_DRIVER)); // Expectations EXPECT_CALL(mock_allocation_manager_, AcquireResource(_, _, _)) @@ -279,6 +285,9 @@ TEST_F(RCGetInteriorVehicleDataConsentTest, .WillOnce(ReturnRef(mock_command_factory)); auto mobile_message = CreateBasicMessage(); + ON_CALL(mock_allocation_manager_, GetAccessMode()) + .WillByDefault(Return(hmi_apis::Common_RCAccessMode::AUTO_DENY)); + auto rc_consent_response = CreateRCCommand( mobile_message); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc index 9b06ddb137..9ba959de29 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc @@ -112,6 +112,8 @@ class SetInteriorVehicleDataRequestTest ON_CALL(mock_rc_capabilities_manager_, GetModuleDataCapabilities(_, _)) .WillByDefault( Return(std::make_pair("", capabilitiesStatus::kSuccess))); + ON_CALL(mock_allocation_manager_, GetAccessMode()) + .WillByDefault(Return(hmi_apis::Common_RCAccessMode::AUTO_ALLOW)); } MessageSharedPtr CreateBasicMessage() { diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h index fca6c9c77e..2f128d64a8 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/include/rc_rpc_plugin/mock/mock_resource_allocation_manager.h @@ -70,6 +70,10 @@ class MockResourceAllocationManager MOCK_CONST_METHOD2(IsResourceFree, bool(const std::string& module_type, const std::string& module_id)); + MOCK_METHOD3(IsResourceAllocated, + bool(const std::string& module_type, + const std::string& module_id, + const uint32_t app_id)); MOCK_METHOD0(ResetAllAllocations, void()); MOCK_METHOD2(SendOnRCStatusNotifications, void(rc_rpc_plugin::NotificationTrigger::eType, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h new file mode 100644 index 0000000000..57c6f55e03 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESET_TIMEOUT_NOTIFICATION_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESET_TIMEOUT_NOTIFICATION_H_ + +#include "application_manager/commands/notification_from_hmi.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +namespace hmi { + +/** + * @brief OnResetTimeoutNotification command class + **/ +class OnResetTimeoutNotification + : public app_mngr::commands::NotificationFromHMI { + public: + /** + * @brief OnResetTimeoutNotification class constructor + * + * @param message Incoming SmartObject message + **/ + OnResetTimeoutNotification( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + /** + * @brief OnResetTimeoutNotification class destructor + **/ + virtual ~OnResetTimeoutNotification(); + + /** + * @brief Execute command + **/ + virtual void Run(); + + private: + DISALLOW_COPY_AND_ASSIGN(OnResetTimeoutNotification); +}; + +} // namespace hmi + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_RESET_TIMEOUT_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h deleted file mode 100644 index c8bd159064..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_RESET_TIMEOUT_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_RESET_TIMEOUT_NOTIFICATION_H_ - -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -namespace hmi { - -/** - * @brief OnTTSResetTimeoutNotification command class - **/ -class OnTTSResetTimeoutNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnTTSResetTimeoutNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnTTSResetTimeoutNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnTTSResetTimeoutNotification class destructor - **/ - virtual ~OnTTSResetTimeoutNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnTTSResetTimeoutNotification); -}; - -} // namespace hmi - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_TTS_RESET_TIMEOUT_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h deleted file mode 100644 index 1c87f82349..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_RESET_TIMEOUT_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_RESET_TIMEOUT_NOTIFICATION_H_ - -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -namespace hmi { - -/** - * @brief OnUIResetTimeoutNotification command class - **/ -class OnUIResetTimeoutNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnUIResetTimeoutNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnUIResetTimeoutNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnUIResetTimeoutNotification class destructor - **/ - virtual ~OnUIResetTimeoutNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnUIResetTimeoutNotification); -}; - -} // namespace hmi - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_UI_RESET_TIMEOUT_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc index 21d6282436..05d0a4e8f2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc @@ -58,9 +58,11 @@ AudioStartStreamRequest::AudioStartStreamRequest( SDL_LOG_AUTO_TRACE(); std::pair stream_retry = application_manager_.get_settings().start_stream_retry_amount(); - default_timeout_ = stream_retry.second; + default_timeout_ = + stream_retry.second + + application_manager_.get_settings().default_timeout_compensation(); retry_number_ = stream_retry.first; - SDL_LOG_DEBUG("default_timeout_ = " << default_timeout_ + SDL_LOG_DEBUG("default_timeout_ = " << stream_retry.second << "; retry_number_ = " << retry_number_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc index 973c323ebe..c671b11282 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc @@ -58,9 +58,11 @@ NaviStartStreamRequest::NaviStartStreamRequest( SDL_LOG_AUTO_TRACE(); std::pair stream_retry = application_manager_.get_settings().start_stream_retry_amount(); - default_timeout_ = stream_retry.second; + default_timeout_ = + stream_retry.second + + application_manager_.get_settings().default_timeout_compensation(); retry_number_ = stream_retry.first; - SDL_LOG_DEBUG("default_timeout_ = " << default_timeout_ + SDL_LOG_DEBUG("default_timeout_ = " << stream_retry.second << "; retry_number_ = " << retry_number_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_reset_timeout_notification.cc new file mode 100644 index 0000000000..ff5b2709c0 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_reset_timeout_notification.cc @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h" +#include "application_manager/event_engine/event.h" +#include "interfaces/HMI_API.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +namespace hmi { + +SDL_CREATE_LOG_VARIABLE("Commands") + +OnResetTimeoutNotification::OnResetTimeoutNotification( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : NotificationFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +OnResetTimeoutNotification::~OnResetTimeoutNotification() {} + +void OnResetTimeoutNotification::Run() { + SDL_LOG_AUTO_TRACE(); + + event_engine::Event event( + hmi_apis::FunctionID::BasicCommunication_OnResetTimeout); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace hmi + +} // namespace commands + +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc deleted file mode 100644 index 96f6c5cd5b..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_reset_timeout_notification.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -namespace hmi { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnTTSResetTimeoutNotification::OnTTSResetTimeoutNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnTTSResetTimeoutNotification::~OnTTSResetTimeoutNotification() {} - -void OnTTSResetTimeoutNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace hmi - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc deleted file mode 100644 index d8de31cfbc..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_ui_reset_timeout_notification.cc +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h" -#include "application_manager/event_engine/event.h" -#include "interfaces/HMI_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -namespace hmi { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnUIResetTimeoutNotification::OnUIResetTimeoutNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnUIResetTimeoutNotification::~OnUIResetTimeoutNotification() {} - -void OnUIResetTimeoutNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - event_engine::Event event(hmi_apis::FunctionID::UI_OnResetTimeout); - event.set_smart_object(*message_); - event.raise(application_manager_.event_dispatcher()); -} - -} // namespace hmi - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 66ac9c458b..4de8b17b8d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -142,7 +142,7 @@ void SDLActivateAppRequest::Run() { application_manager_.get_settings(); uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * settings.cloud_app_max_retry_attempts()); - application_manager_.updateRequestTimeout( + application_manager_.UpdateRequestTimeout( 0, correlation_id(), default_timeout_ + total_retry_timeout); subscribe_on_event(BasicCommunication_OnAppRegistered); application_manager_.connection_handler().ConnectToDevice(app->device()); @@ -227,7 +227,7 @@ void SDLActivateAppRequest::Run() { application_manager_.get_settings(); uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * settings.cloud_app_max_retry_attempts()); - application_manager_.updateRequestTimeout( + application_manager_.UpdateRequestTimeout( 0, correlation_id(), default_timeout_ + total_retry_timeout); subscribe_on_event(BasicCommunication_OnAppRegistered); application_manager_.connection_handler().ConnectToDevice( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc index 8728bb4403..0e0d91f05d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc @@ -51,9 +51,7 @@ AlertManeuverRequest::AlertManeuverRequest( hmi_capabilities, policy_handler) , tts_speak_result_code_(hmi_apis::Common_Result::INVALID_ENUM) - , navi_alert_maneuver_result_code_(hmi_apis::Common_Result::INVALID_ENUM) { - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} + , navi_alert_maneuver_result_code_(hmi_apis::Common_Result::INVALID_ENUM) {} AlertManeuverRequest::~AlertManeuverRequest() {} @@ -179,13 +177,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { GetInfo(message, info_tts_); break; } - case hmi_apis::FunctionID::TTS_OnResetTimeout: { - SDL_LOG_INFO("Received TTS_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } default: { SDL_LOG_ERROR("Received unknown event " << event.id()); SendResponse( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc index 5d1a058f16..26c209bf2a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc @@ -65,10 +65,7 @@ AlertRequest::AlertRequest( , awaiting_tts_stop_speaking_response_(false) , is_ui_alert_sent_(false) , alert_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} + , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) {} AlertRequest::~AlertRequest() {} @@ -129,18 +126,6 @@ void AlertRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { - case hmi_apis::FunctionID::TTS_OnResetTimeout: - case hmi_apis::FunctionID::UI_OnResetTimeout: { - SDL_LOG_INFO( - "Received UI_OnResetTimeout event " - " or TTS_OnResetTimeout event " - << awaiting_tts_speak_response_ << " " - << awaiting_tts_stop_speaking_response_ << " " - << awaiting_ui_alert_response_); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } case hmi_apis::FunctionID::UI_Alert: { SDL_LOG_INFO("Received UI_Alert event"); // Unsubscribe from event to avoid unwanted messages diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index f3e0b67921..2f624efe76 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -369,7 +369,7 @@ void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { << expected_chs_count_ - received_chs_count_ << " more to wait."); if (received_chs_count_ < expected_chs_count_) { - application_manager_.updateRequestTimeout( + application_manager_.UpdateRequestTimeout( connection_key(), correlation_id(), default_timeout()); SDL_LOG_DEBUG("Timeout for request was updated"); } else { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc index 54b542d245..9e156bf755 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc @@ -51,9 +51,7 @@ GetWayPointsRequest::GetWayPointsRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); -} + policy_handler) {} GetWayPointsRequest::~GetWayPointsRequest() {} @@ -81,12 +79,6 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { - case hmi_apis::FunctionID::UI_OnResetTimeout: { - SDL_LOG_INFO("Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } case hmi_apis::FunctionID::Navigation_GetWayPoints: { SDL_LOG_INFO("Received Navigation_GetWayPoints event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc index 0accdd1e76..74b474f76b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -59,9 +59,7 @@ PerformAudioPassThruRequest::PerformAudioPassThruRequest( hmi_capabilities, policy_handler) , result_tts_speak_(hmi_apis::Common_Result::INVALID_ENUM) - , result_ui_(hmi_apis::Common_Result::INVALID_ENUM) { - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} + , result_ui_(hmi_apis::Common_Result::INVALID_ENUM) {} PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {} @@ -183,18 +181,12 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { StartMicrophoneRecording(); // update request timeout to get time for perform audio recording - application_manager_.updateRequestTimeout( + application_manager_.UpdateRequestTimeout( connection_key(), correlation_id(), default_timeout()); } break; } - case hmi_apis::FunctionID::TTS_OnResetTimeout: { - SDL_LOG_INFO("Received TTS_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } default: { SDL_LOG_ERROR("Received unknown event " << event.id()); return; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc index bb990574bd..da1f744689 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc @@ -83,7 +83,6 @@ PerformInteractionRequest::PerformInteractionRequest( , ui_result_code_(hmi_apis::Common_Result::INVALID_ENUM) { response_msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand); subscribe_on_event(hmi_apis::FunctionID::Buttons_OnButtonPress); } @@ -236,12 +235,6 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { - case hmi_apis::FunctionID::UI_OnResetTimeout: { - SDL_LOG_DEBUG("Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } case hmi_apis::FunctionID::UI_PerformInteraction: { SDL_LOG_DEBUG("Received UI_PerformInteraction event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); @@ -299,7 +292,7 @@ void PerformInteractionRequest::onTimeOut() { DisablePerformInteraction(); CommandRequestImpl::onTimeOut(); } else { - application_manager_.updateRequestTimeout( + application_manager_.UpdateRequestTimeout( connection_key(), correlation_id(), default_timeout_); } break; @@ -351,8 +344,10 @@ bool PerformInteractionRequest::ProcessVRResponse( SendResponse(false, MessageHelper::HMIToMobileResult(vr_result_code_)); return true; } + SDL_LOG_DEBUG("Update timeout for UI"); - application_manager_.updateRequestTimeout( + application_manager_.UpdateRequestTimeout( + connection_key(), correlation_id(), default_timeout_); return false; } @@ -378,7 +373,7 @@ bool PerformInteractionRequest::ProcessVRResponse( if (mobile_apis::InteractionMode::BOTH == interaction_mode_ || mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) { SDL_LOG_DEBUG("Update timeout for UI"); - application_manager_.updateRequestTimeout( + application_manager_.UpdateRequestTimeout( connection_key(), correlation_id(), default_timeout_); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc index 89e77d9d19..7cfe5f5414 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc @@ -58,9 +58,7 @@ ScrollableMessageRequest::ScrollableMessageRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); -} + policy_handler) {} ScrollableMessageRequest::~ScrollableMessageRequest() {} @@ -131,12 +129,6 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { - case hmi_apis::FunctionID::UI_OnResetTimeout: { - SDL_LOG_INFO("Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } case hmi_apis::FunctionID::UI_ScrollableMessage: { SDL_LOG_INFO("Received UI_ScrollableMessage event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc index 22935e2136..0fdc412572 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc @@ -55,9 +55,7 @@ SliderRequest::SliderRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); -} + policy_handler) {} SliderRequest::~SliderRequest() {} @@ -65,8 +63,7 @@ bool SliderRequest::Init() { /* Timeout in milliseconds. If omitted a standard value of 10000 milliseconds is used.*/ if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { - default_timeout_ = - application_manager_.get_settings().default_timeout() + + default_timeout_ += (*message_)[strings::msg_params][strings::timeout].asUInt(); } @@ -134,12 +131,6 @@ void SliderRequest::on_event(const event_engine::Event& event) { const SmartObject& message = event.smart_object(); const event_engine::Event::EventID event_id = event.id(); - if (event_id == FunctionID::UI_OnResetTimeout) { - SDL_LOG_INFO("Received UI_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - return; - } if (event_id != FunctionID::UI_Slider) { SDL_LOG_ERROR("Received unknown event " << event.id()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc index b8de053853..f8307f8355 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc @@ -55,9 +55,7 @@ SpeakRequest::SpeakRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) { - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} + policy_handler) {} SpeakRequest::~SpeakRequest() {} @@ -112,13 +110,7 @@ void SpeakRequest::on_event(const event_engine::Event& event) { ProcessTTSSpeakResponse(event.smart_object()); break; } - case hmi_apis::FunctionID::TTS_OnResetTimeout: { - SDL_LOG_INFO("Received TTS_OnResetTimeout event"); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } default: { SDL_LOG_ERROR("Received unknown event " << event.id()); break; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc index 2a8e267436..8491a859e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc @@ -59,10 +59,7 @@ SubtleAlertRequest::SubtleAlertRequest( , is_ui_subtle_alert_sent_(false) , is_tts_stop_speaking_sent_(false) , subtle_alert_result_(hmi_apis::Common_Result::INVALID_ENUM) - , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) { - subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout); - subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); -} + , tts_speak_result_(hmi_apis::Common_Result::INVALID_ENUM) {} SubtleAlertRequest::~SubtleAlertRequest() {} @@ -118,18 +115,6 @@ void SubtleAlertRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { - case hmi_apis::FunctionID::TTS_OnResetTimeout: - case hmi_apis::FunctionID::UI_OnResetTimeout: { - SDL_LOG_INFO( - "Received UI_OnResetTimeout event " - " or TTS_OnResetTimeout event" - << awaiting_tts_speak_response_ << " " - << awaiting_tts_stop_speaking_response_ << " " - << awaiting_ui_subtle_alert_response_); - application_manager_.updateRequestTimeout( - connection_key(), correlation_id(), default_timeout()); - break; - } case hmi_apis::FunctionID::UI_SubtleAlert: { SDL_LOG_INFO("Received UI_SubtleAlert event"); // Unsubscribe from event to avoid unwanted messages diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index 642bdc7b11..954ddb4e57 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -218,6 +218,7 @@ #include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h" #include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h" @@ -225,13 +226,11 @@ #include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_system_time_ready_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_ui_subtle_alert_pressed_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_ui_update_file_notification.h" @@ -775,8 +774,8 @@ CommandCreator& HMICommandFactory::get_creator_factory( case hmi_apis::FunctionID::UI_OnTouchEvent: { return factory.GetCreator(); } - case hmi_apis::FunctionID::UI_OnResetTimeout: { - return factory.GetCreator(); + case hmi_apis::FunctionID::BasicCommunication_OnResetTimeout: { + return factory.GetCreator(); } case hmi_apis::FunctionID::Navigation_SetVideoConfig: { return hmi_apis::messageType::request == message_type @@ -875,9 +874,6 @@ CommandCreator& HMICommandFactory::get_creator_factory( case hmi_apis::FunctionID::SDL_OnDeviceStateChanged: { return factory.GetCreator(); } - case hmi_apis::FunctionID::TTS_OnResetTimeout: { - return factory.GetCreator(); - } case hmi_apis::FunctionID::BasicCommunication_OnEventChanged: { return factory.GetCreator(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc index 5fa910b2d9..5e485adb7f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -114,6 +114,7 @@ #include "hmi/on_ready_notification.h" #include "hmi/on_received_policy_update.h" #include "hmi/on_record_start_notification.h" +#include "hmi/on_reset_timeout_notification.h" #include "hmi/on_resume_audio_source_notification.h" #include "hmi/on_sdl_close_notification.h" #include "hmi/on_sdl_consent_needed_notification.h" @@ -125,13 +126,11 @@ #include "hmi/on_system_info_changed_notification.h" #include "hmi/on_system_request_notification.h" #include "hmi/on_tts_language_change_notification.h" -#include "hmi/on_tts_reset_timeout_notification.h" #include "hmi/on_tts_started_notification.h" #include "hmi/on_tts_stopped_notification.h" #include "hmi/on_ui_command_notification.h" #include "hmi/on_ui_keyboard_input_notification.h" #include "hmi/on_ui_language_change_notification.h" -#include "hmi/on_ui_reset_timeout_notification.h" #include "hmi/on_ui_touch_event_notification.h" #include "hmi/on_update_device_list.h" #include "hmi/on_video_data_streaming_notification.h" @@ -258,14 +257,10 @@ class HMICommandsTest : public components::commands_test::CommandRequestTest< typedef Command CommandType; void InitCommand(const uint32_t& timeout) OVERRIDE { + CommandRequestTest::InitCommand(timeout); + stream_retry_.first = 0; stream_retry_.second = 0; - EXPECT_CALL(app_mngr_settings_, default_timeout()) - .WillOnce(ReturnRef(timeout)); - ON_CALL(app_mngr_, event_dispatcher()) - .WillByDefault(ReturnRef(event_dispatcher_)); - ON_CALL(app_mngr_, get_settings()) - .WillByDefault(ReturnRef(app_mngr_settings_)); ON_CALL(app_mngr_settings_, start_stream_retry_amount()) .WillByDefault(ReturnRef(stream_retry_)); } @@ -454,7 +449,6 @@ typedef Types::InitCommand(default_timeout); + app_ = ConfigureApp(&app_ptr_, kAppId_, NOT_MEDIA, NOT_NAVI, NOT_VC); - EXPECT_CALL(app_mngr_, get_settings()) - .WillOnce(ReturnRef(app_mngr_settings_)); - EXPECT_CALL(app_mngr_settings_, default_timeout()) - .WillOnce(ReturnRef(default_timeout)); - ON_CALL(app_mngr_, event_dispatcher()) - .WillByDefault(ReturnRef(mock_event_dispatcher_)); ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_)); ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_)); ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_)); @@ -362,12 +357,10 @@ typedef Types< hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated>, CommandPair, - CommandPair, + CommandPair, CommandPair, CommandPair, - CommandPair, CommandPair, CommandPair > HMIOnNotificationsEventDispatcherTypes; @@ -517,7 +510,8 @@ TEST_F(HMICommandsNotificationsTest, std::shared_ptr command = CreateCommand(message); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)); - EXPECT_CALL(app_mngr_, event_dispatcher()); + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher_)); EXPECT_CALL(mock_event_dispatcher_, raise_event(_)) .WillOnce(GetEventId(&event_id)); command->Run(); @@ -539,7 +533,8 @@ TEST_F(HMICommandsNotificationsTest, std::shared_ptr command = CreateCommand(message); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)); - EXPECT_CALL(app_mngr_, event_dispatcher()); + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher_)); EXPECT_CALL(mock_event_dispatcher_, raise_event(_)) .WillOnce(GetEventId(&event_id)); command->Run(); @@ -561,7 +556,8 @@ TEST_F(HMICommandsNotificationsTest, OnButtonPressNotificationEventDispatcher) { CreateCommand(message); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); - EXPECT_CALL(app_mngr_, event_dispatcher()); + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher_)); EXPECT_CALL(mock_event_dispatcher_, raise_event(_)) .WillOnce(GetEventId(&event_id)); command->Run(); @@ -578,7 +574,8 @@ TEST_F(HMICommandsNotificationsTest, OnReadyNotificationEventDispatcher) { CreateCommand(message); EXPECT_CALL(app_mngr_, OnHMIReady()); - EXPECT_CALL(app_mngr_, event_dispatcher()); + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher_)); EXPECT_CALL(mock_event_dispatcher_, raise_event(_)) .WillOnce(GetEventId(&event_id)); command->Run(); @@ -1298,11 +1295,10 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); EXPECT_CALL(app_mngr_settings_, max_cmd_id()).WillOnce(ReturnRef(kMaxCmdId)); - EXPECT_CALL(app_mngr_, get_settings()) - .WillOnce(ReturnRef(app_mngr_settings_)); EXPECT_CALL(*app_ptr_, is_perform_interaction_active()) .WillOnce(Return(kIsPerformInteractionActive)); - EXPECT_CALL(app_mngr_, event_dispatcher()); + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher_)); EXPECT_CALL(mock_event_dispatcher_, raise_event(_)) .WillOnce(GetEventId(&event_id)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index 31285f5b17..a2dc705f60 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -113,8 +113,9 @@ class SDLActivateAppRequestTest } void InitCommand(const uint32_t& timeout) OVERRIDE { - MockAppPtr mock_app = CreateMockApp(); CommandRequestTest::InitCommand(timeout); + + MockAppPtr mock_app = CreateMockApp(); ON_CALL((*mock_app), app_id()).WillByDefault(Return(kAppID)); ON_CALL(app_mngr_, application_by_hmi_app(kAppID)) .WillByDefault(Return(mock_app)); @@ -486,7 +487,7 @@ TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) { EXPECT_CALL(app_mngr_, get_settings()).WillOnce(ReturnRef(settings)); EXPECT_CALL(app_mngr_, - updateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout))); + UpdateRequestTimeout(0, kCorrelationID, Gt(kMinimumTimeout))); MockConnectionHandler connection_handler; EXPECT_CALL(connection_handler, ConnectToDevice(kHandle)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc index 5e1f3e4782..9130fa52a0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc @@ -403,27 +403,6 @@ TEST_F(AlertRequestTest, OnEvent_InvalidEventId_UNSUCCESS) { command->on_event(event); } -TEST_F(AlertRequestTest, DISABLED_OnEvent_UI_OnResetTimeout_SUCCESS) { - PreConditions(); - Expectations(); - AddAlertTextsToMsg(); - - (*msg_)[am::strings::msg_params][am::strings::duration] = kDefaultTimeout; - - CommandPtr command(CreateCommand(msg_)); - EXPECT_TRUE(command->Init()); - - EXPECT_CALL( - app_mngr_, - updateRequestTimeout(kConnectionKey, kCorrelationId, kDefaultTimeout)); - - ExpectManageMobileCommandWithResultCode(mobile_apis::Result::INVALID_ENUM); - - Event event(hmi_apis::FunctionID::UI_OnResetTimeout); - event.set_smart_object(*msg_); - command->on_event(event); -} - TEST_F(AlertRequestTest, OnEvent_UIAlertHasHmiResponsesToWait_UNSUCCESS) { Expectations(); AddAlertTextsToMsg(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc index 80abfec61d..d77e0588f8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc @@ -619,7 +619,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) { command_->Run(); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(0); event.set_smart_object(*message_); @@ -655,7 +655,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, .WillByDefault(Return(kCorrelationId)); command_->Run(); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(0); event.set_smart_object(*message_); @@ -696,7 +696,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, FillMessageFieldsItem2(message_); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); event.set_smart_object(*message_); command_->on_event(event); @@ -751,7 +751,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, command_->Run(); FillMessageFieldsItem2(message_); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); Event event(hmi_apis::FunctionID::VR_AddCommand); event.set_smart_object(*message_); @@ -801,7 +801,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) { command_->Run(); FillMessageFieldsItem2(message_); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(2); Event event(hmi_apis::FunctionID::VR_AddCommand); event.set_smart_object(*message_); @@ -854,7 +854,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, FillMessageFieldsItem2(message_); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); resumption_test::MockResumeCtrl mock_resume_ctrl; EXPECT_CALL(app_mngr_, resume_controller()) .WillOnce(ReturnRef(mock_resume_ctrl)); @@ -935,7 +935,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) { ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), am::commands::Command::SOURCE_SDL)); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); event.set_smart_object(*message_); command_->on_event(event); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc index 8f83a2dd10..201118eec0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc @@ -165,12 +165,8 @@ class MobileCommandsTest : public components::commands_test::CommandRequestTest< typedef Command CommandType; void InitCommand(const uint32_t& timeout) OVERRIDE { - EXPECT_CALL(app_mngr_settings_, default_timeout()) - .WillOnce(ReturnRef(timeout)); - ON_CALL(app_mngr_, event_dispatcher()) - .WillByDefault(ReturnRef(event_dispatcher_)); - ON_CALL(app_mngr_, get_settings()) - .WillByDefault(ReturnRef(app_mngr_settings_)); + CommandRequestTest::InitCommand(timeout); + ON_CALL(app_mngr_settings_, app_icons_folder()) .WillByDefault(ReturnRef(kEmptyString_)); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc index 7f7a8b55bd..fd2bc2e51a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc @@ -202,7 +202,7 @@ TEST_F(GetWayPointsRequestTest, OnEvent_DefaultCase) { event.set_smart_object(*message_); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc index 2915418d43..c7627b7e55 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -626,7 +626,7 @@ TEST_F(PerformAudioPassThruRequestTest, EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)); EXPECT_CALL(app_mngr_, StartAudioPassThruThread(_, _, _, _, _, _)); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); @@ -654,7 +654,7 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); // First call on_event for setting result_tts_speak_ to UNSUPPORTED_RESOURCE - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)); CallOnEvent caller_speak(*command_sptr_, event_speak); caller_speak(); @@ -691,31 +691,7 @@ TEST_F(PerformAudioPassThruRequestTest, app_mngr_, StartAudioPassThruThread(kConnectionKey, kCorrelationId, _, _, _, _)); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); - ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) - .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - CallOnEvent caller(*command_sptr_, event); - caller(); - - EXPECT_EQ(kConnectionKey, msg_params_[am::strings::connection_key].asUInt()); - EXPECT_EQ(kFunctionId, msg_params_[am::strings::function_id].asString()); -} - -TEST_F(PerformAudioPassThruRequestTest, - DISABLED_OnEvent_TTSOnResetTimeout_UpdateTimeout) { - am::event_engine::Event event(hmi_apis::FunctionID::TTS_OnResetTimeout); - - msg_params_[am::strings::connection_key] = kConnectionKey; - msg_params_[am::strings::function_id] = kFunctionId; - - uint32_t app_id = kConnectionKey; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); - EXPECT_CALL(app_mngr_, BeginAudioPassThru(app_id)).WillOnce(Return(true)); - - EXPECT_CALL( - app_mngr_, - StartAudioPassThruThread(kConnectionKey, kCorrelationId, _, _, _, _)); - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); CallOnEvent caller(*command_sptr_, event); @@ -729,7 +705,7 @@ TEST_F(PerformAudioPassThruRequestTest, OnEvent_DefaultCase) { am::event_engine::Event event(hmi_apis::FunctionID::INVALID_ENUM); uint32_t app_id = kConnectionKey; - EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).Times(0); CallOnEvent caller(*command_sptr_, event); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc index 4572a6d907..99491873be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc @@ -416,6 +416,7 @@ TEST_F(RegisterAppInterfaceRequestTest, DefaultTimeout_CheckIfZero_SUCCESS) { TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) { InitBasicMessage(); (*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId1; + EXPECT_CALL(app_mngr_, WaitForHmiIsReady()).WillOnce(Return(true)); EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false)); @@ -501,6 +502,7 @@ TEST_F(RegisterAppInterfaceRequestTest, InitBasicMessage(); ON_CALL(app_mngr_, WaitForHmiIsReady()).WillByDefault(Return(true)); + EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false)); ON_CALL(mock_connection_handler_, @@ -802,6 +804,7 @@ TEST_F(RegisterAppInterfaceRequestTest, (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey2; ON_CALL(app_mngr_, WaitForHmiIsReady()).WillByDefault(Return(true)); + EXPECT_CALL(app_mngr_, IsApplicationForbidden(kConnectionKey2, kAppId1)) .WillOnce(Return(false)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc index 6b17aa238d..443868168d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc @@ -173,17 +173,21 @@ TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) { (*msg_)[msg_params][timeout] = kTimeOut; (*msg_)[msg_params][interaction_mode] = mobile_apis::InteractionMode::MANUAL_ONLY; - EXPECT_EQ(kDefaultTimeout_, command_->default_timeout()); + const uint32_t initial_timeout = + kDefaultTimeout_ + kDefaultTimeoutCompensation_; + EXPECT_EQ(initial_timeout, command_->default_timeout()); command_->Init(); - EXPECT_EQ(kTimeOut + kDefaultTimeout_, command_->default_timeout()); + EXPECT_EQ(kTimeOut + initial_timeout, command_->default_timeout()); } TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_UNSUCCESS) { (*msg_)[msg_params][interaction_mode] = mobile_apis::InteractionMode::MANUAL_ONLY; - EXPECT_EQ(kDefaultTimeout_, command_->default_timeout()); + const uint32_t initial_timeout = + kDefaultTimeout_ + kDefaultTimeoutCompensation_; + EXPECT_EQ(initial_timeout, command_->default_timeout()); command_->Init(); - EXPECT_EQ(kDefaultTimeout_, command_->default_timeout()); + EXPECT_EQ(initial_timeout, command_->default_timeout()); } TEST_F(ScrollableMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) { @@ -240,18 +244,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_ReceivedUnknownEvent_UNSUCCESS) { command_->on_event(event); } -TEST_F(ScrollableMessageRequestTest, - OnEvent_ReceivedUIOnResetTimeoutEvent_SUCCESS) { - (*msg_)[params][connection_key] = kConnectionKey; - (*msg_)[params][correlation_id] = kCorrelationId; - EXPECT_CALL( - app_mngr_, - updateRequestTimeout(kConnectionKey, kCorrelationId, kDefaultTimeout_)); - Event event(hmi_apis::FunctionID::UI_OnResetTimeout); - event.set_smart_object(*msg_); - command_->on_event(event); -} - TEST_F(ScrollableMessageRequestTest, DISABLED_OnEvent_ReceivedUIScrollableMessage_SUCCESS) { (*msg_)[params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc index 0450f06ee1..d9bffc6b4a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc @@ -274,22 +274,6 @@ TEST_F(SliderRequestTest, Run_SUCCESS) { command->Run(); } -TEST_F(SliderRequestTest, OnEvent_UI_OnResetTimeout_UNSUCCESS) { - PreConditions(); - (*msg_)[am::strings::msg_params][am::strings::timeout] = kDefaultTimeout; - (*msg_)[am::strings::params][am::strings::correlation_id] = kCorrelationId; - - CommandPtr command(CreateCommand(msg_)); - EXPECT_TRUE(command->Init()); - - EXPECT_CALL(app_mngr_, - updateRequestTimeout(kConnectionKey, kCorrelationId, _)); - - Event event(hmi_apis::FunctionID::UI_OnResetTimeout); - event.set_smart_object(*msg_); - command->on_event(event); -} - TEST_F(SliderRequestTest, OnEvent_UI_UnknownEventId_UNSUCCESS) { PreConditions(); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc index 87320d3a7a..dd082a52a7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc @@ -366,18 +366,6 @@ TEST_F(SpeakRequestTest, OnEvent_TTS_SpeakWithWarning_WarningWithSuccess) { command->on_event(event); } -TEST_F(SpeakRequestTest, OnEvent_TTS_OnResetTimeout_UpdateTimeout) { - Event event(Event::EventID::TTS_OnResetTimeout); - (*request_)[am::strings::params][am::strings::connection_key] = - kConnectionKey; - (*request_)[am::strings::params][am::strings::correlation_id] = kAppId; - CommandPtr command(CreateCommand(request_)); - - EXPECT_CALL(app_mngr_, updateRequestTimeout(kConnectionKey, kAppId, _)); - - command->on_event(event); -} - TEST_F(SpeakRequestTest, OnEvent_ApplicationIsNotRegistered_UNSUCCESS) { const hmi_apis::Common_Result::eType hmi_result = hmi_apis::Common_Result::SUCCESS; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h index ae25acea87..e7d73fc4f0 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/include/vehicle_info_plugin/commands/vi_commands_test.h @@ -66,7 +66,7 @@ using ::smart_objects::SmartObject; template class VICommandsTest : public CommandsTest { public: - enum { kDefaultTimeout_ = 100 }; + enum { kDefaultTimeout_ = 100, kDefaultTimeoutCompensation_ = 10 }; template std::shared_ptr CreateCommandVI() { @@ -76,7 +76,7 @@ class VICommandsTest : public CommandsTest { template std::shared_ptr CreateCommandVI(MessageSharedPtr& msg) { - InitCommandVI(kDefaultTimeout_); + InitCommandVI(kDefaultTimeout_, kDefaultTimeoutCompensation_); vehicle_info_plugin::VehicleInfoCommandParams params = { CommandsTest::app_mngr_, CommandsTest::mock_rpc_service_, @@ -90,11 +90,14 @@ class VICommandsTest : public CommandsTest { mock_custom_vehicle_data_manager_; protected: - void InitCommandVI(const uint32_t& timeout) { + void InitCommandVI(const uint32_t timeout, const uint32_t compensation) { ON_CALL(CommandsTest::app_mngr_, get_settings()) .WillByDefault(ReturnRef(CommandsTest::app_mngr_settings_)); ON_CALL(CommandsTest::app_mngr_settings_, default_timeout()) .WillByDefault(ReturnRef(timeout)); + ON_CALL(CommandsTest::app_mngr_settings_, + default_timeout_compensation()) + .WillByDefault(ReturnRef(compensation)); } }; } // namespace commands_test diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index f5dedc0e35..e78d6ee668 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -51,6 +51,8 @@ #include "application_manager/mobile_message_handler.h" #include "application_manager/plugin_manager/rpc_plugin_manager_impl.h" #include "application_manager/policies/policy_handler.h" +#include "application_manager/request_controller_impl.h" +#include "application_manager/request_timeout_handler_impl.h" #include "application_manager/resumption/resume_ctrl_impl.h" #include "application_manager/rpc_handler_impl.h" #include "application_manager/rpc_protection_manager_impl.h" @@ -170,7 +172,10 @@ ApplicationManagerImpl::ApplicationManagerImpl( , connection_handler_(NULL) , policy_handler_(new policy::PolicyHandler(policy_settings, *this)) , protocol_handler_(NULL) - , request_ctrl_(am_settings) + , request_timeout_handler_( + new request_controller::RequestTimeoutHandlerImpl(*this)) + , request_ctrl_(new request_controller::RequestControllerImpl( + am_settings, *request_timeout_handler_)) , mobile_correlation_id_(0) , correlation_id_(0) , max_correlation_id_(UINT_MAX) @@ -215,7 +220,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( std::make_shared(*policy_handler_); policy_handler_->add_listener(rpc_protection_manager.get()); rpc_service_.reset(new rpc_service::RPCServiceImpl(*this, - request_ctrl_, + *request_ctrl_, protocol_handler_, hmi_handler_, *commands_holder_, @@ -1714,7 +1719,7 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart( } for (const auto& app : wait_list) { - request_ctrl_.terminateAppRequests(app->app_id()); + request_ctrl_->TerminateAppRequests(app->app_id()); resume_ctrl_->SaveApplication(app); } @@ -2476,7 +2481,7 @@ void ApplicationManagerImpl::StartDevicesDiscovery() { void ApplicationManagerImpl::TerminateRequest(const uint32_t connection_key, const uint32_t corr_id, const int32_t function_id) { - request_ctrl_.TerminateRequest(corr_id, connection_key, function_id, true); + request_ctrl_->TerminateRequest(corr_id, connection_key, function_id, true); } void ApplicationManagerImpl::RemoveHMIFakeParameters( @@ -2590,7 +2595,7 @@ bool ApplicationManagerImpl::Stop() { } catch (...) { SDL_LOG_ERROR("An error occurred during unregistering applications."); } - request_ctrl_.DestroyThreadpool(); + request_ctrl_->Stop(); // for PASA customer policy backup should happen :AllApp(SUSPEND) SDL_LOG_DEBUG("Unloading policy library."); @@ -2930,21 +2935,21 @@ void ApplicationManagerImpl::SetTelemetryObserver( } #endif // TELEMETRY_MONITOR -void ApplicationManagerImpl::addNotification(const CommandSharedPtr ptr) { - request_ctrl_.addNotification(ptr); +void ApplicationManagerImpl::AddNotification(const CommandSharedPtr ptr) { + request_ctrl_->AddNotification(ptr); } -void ApplicationManagerImpl::removeNotification( +void ApplicationManagerImpl::RemoveNotification( const commands::Command* notification) { - request_ctrl_.removeNotification(notification); + request_ctrl_->RemoveNotification(notification); } -void ApplicationManagerImpl::updateRequestTimeout( +void ApplicationManagerImpl::UpdateRequestTimeout( uint32_t connection_key, uint32_t mobile_correlation_id, uint32_t new_timeout_value) { SDL_LOG_AUTO_TRACE(); - request_ctrl_.updateRequestTimeout( + request_ctrl_->UpdateRequestTimeout( connection_key, mobile_correlation_id, new_timeout_value); } @@ -2954,7 +2959,7 @@ void ApplicationManagerImpl::IncreaseForwardedRequestTimeout( << get_settings().rpc_pass_through_timeout()); uint32_t new_timeout_value = get_settings().default_timeout() + get_settings().rpc_pass_through_timeout(); - request_ctrl_.updateRequestTimeout( + request_ctrl_->UpdateRequestTimeout( connection_key, mobile_correlation_id, new_timeout_value); } @@ -3176,7 +3181,7 @@ void ApplicationManagerImpl::UnregisterAllApplications() { if (is_ignition_off) { resume_controller().OnIgnitionOff(); } - request_ctrl_.terminateAllHMIRequests(); + request_ctrl_->TerminateAllHMIRequests(); } void ApplicationManagerImpl::RemoveAppsWaitingForRegistration( @@ -3276,11 +3281,10 @@ void ApplicationManagerImpl::UnregisterApplication( } if (!app_to_remove) { SDL_LOG_ERROR("Cant find application with app_id = " << app_id); - // Just to terminate RAI in case of connection is dropped (rare case) // App won't be unregistered since RAI has not been started yet SDL_LOG_DEBUG("Trying to terminate possible RAI request."); - request_ctrl_.terminateAppRequests(app_id); + request_ctrl_->TerminateAppRequests(app_id); return; } @@ -3344,7 +3348,8 @@ void ApplicationManagerImpl::UnregisterApplication( }; plugin_manager_->ForEachPlugin(on_app_unregistered); - request_ctrl_.terminateAppRequests(app_id); + + request_ctrl_->TerminateAppRequests(app_id); const bool is_applications_list_empty = applications().GetData().empty(); if (is_applications_list_empty) { @@ -3429,7 +3434,7 @@ void ApplicationManagerImpl::OnLowVoltage() { is_low_voltage_ = true; resume_ctrl_->SaveLowVoltageTime(); resume_ctrl_->StopSavePersistentDataTimer(); - request_ctrl_.OnLowVoltage(); + request_ctrl_->OnLowVoltage(); } bool ApplicationManagerImpl::IsLowVoltage() const { @@ -3441,7 +3446,7 @@ void ApplicationManagerImpl::OnWakeUp() { SDL_LOG_AUTO_TRACE(); resume_ctrl_->SaveWakeUpTime(); resume_ctrl_->StartSavePersistentDataTimer(); - request_ctrl_.OnWakeUp(); + request_ctrl_->OnWakeUp(); is_low_voltage_ = false; } diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index c7b01efb7f..c6ad7b79c1 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -81,7 +81,9 @@ CommandImpl::CommandImpl(const MessageSharedPtr& message, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) : message_(message) - , default_timeout_(application_manager.get_settings().default_timeout()) + , default_timeout_( + application_manager.get_settings().default_timeout() + + application_manager.get_settings().default_timeout_compensation()) , allowed_to_terminate_(true) , application_manager_(application_manager) , rpc_service_(rpc_service) diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index dad2689f29..3b0c6bf98c 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -44,6 +44,7 @@ #include "smart_objects/smart_object.h" #include "smart_objects/enum_schema_item.h" +#include "utils/helpers.h" namespace application_manager { @@ -468,6 +469,7 @@ uint32_t CommandRequestImpl::SendHMIRequest( const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject* msg_params, bool use_events) { + SDL_LOG_AUTO_TRACE(); smart_objects::SmartObjectSPtr result = std::make_shared(); @@ -493,7 +495,9 @@ uint32_t CommandRequestImpl::SendHMIRequest( subscribe_on_event(function_id, hmi_correlation_id); } if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { - if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { + if (rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { + AddRequestToTimeoutHandler(request); + } else { SDL_LOG_ERROR("Unable to send request"); SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); } @@ -913,6 +917,51 @@ void CommandRequestImpl::AddTimeOutComponentInfoToMessage( } } +void CommandRequestImpl::AddRequestToTimeoutHandler( + const smart_objects::SmartObject& request_to_hmi) const { + auto function_id = static_cast( + request_to_hmi[strings::params][strings::function_id].asUInt()); + // SDL must not apply "default timeout for RPCs processing" for + // BasicCommunication.DialNumber RPC (that is, SDL must always wait for HMI + // response to BC.DialNumber as long as it takes and not return GENERIC_ERROR + // to mobile app), so the OnResetTimeout logic is not applicable for + // DialNumber RPC + if (helpers::Compare( + function_id, + hmi_apis::FunctionID::BasicCommunication_DialNumber, + hmi_apis::FunctionID::INVALID_ENUM)) { + SDL_LOG_DEBUG( + "Current RPC is DialNumber or Invalid, OnResetTimeout " + "logic is not applicable in this case"); + return; + } + + // If soft buttons are present in Alert or SubtleAlert RPC, SDL will not use + // timeout tracking for response, so the OnResetTimeout logic is not + // applicable in this case + if (helpers::Compare( + function_id, + hmi_apis::FunctionID::UI_Alert, + hmi_apis::FunctionID::UI_SubtleAlert)) { + if (request_to_hmi.keyExists(strings::msg_params)) { + if (request_to_hmi[strings::msg_params].keyExists( + strings::soft_buttons)) { + SDL_LOG_DEBUG("Soft buttons are present in " + << EnumToString(function_id) + << " RPC, OnResetTimeout " + "logic is not applicable in this case"); + return; + } + } + } + + const application_manager::request_controller::Request request{ + correlation_id(), connection_key(), static_cast(function_id)}; + application_manager_.get_request_timeout_handler().AddRequest( + request_to_hmi[strings::params][strings::correlation_id].asUInt(), + request); +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc index 835df70202..467001d8db 100644 --- a/src/components/application_manager/src/commands/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/request_from_hmi.cc @@ -214,7 +214,7 @@ void RequestFromHMI::SendProviderRequest( if (hmi_destination) { SDL_LOG_DEBUG("Sending Request to HMI Provider"); application_manager_.IncreaseForwardedRequestTimeout( - application_manager::request_controller::RequestInfo::HmiConnectionKey, + application_manager::request_controller::RequestInfo::kHmiConnectionKey, correlation_id()); SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events); return; @@ -232,7 +232,7 @@ void RequestFromHMI::SendProviderRequest( SDL_LOG_DEBUG("Sending Request to Mobile Provider"); application_manager_.IncreaseForwardedRequestTimeout( - application_manager::request_controller::RequestInfo::HmiConnectionKey, + application_manager::request_controller::RequestInfo::kHmiConnectionKey, correlation_id()); SendMobileRequest( mobile_function_id, app, &(*msg)[strings::msg_params], use_events); diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc index e4fa4c936c..7365e5e081 100644 --- a/src/components/application_manager/src/hmi_interfaces_impl.cc +++ b/src/components/application_manager/src/hmi_interfaces_impl.cc @@ -132,7 +132,8 @@ generate_function_to_interface_convert_map() { convert_map[TTS_GetSupportedLanguages] = HmiInterfaces::HMI_INTERFACE_TTS; convert_map[TTS_GetLanguage] = HmiInterfaces::HMI_INTERFACE_TTS; convert_map[TTS_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_TTS; - convert_map[TTS_OnResetTimeout] = HmiInterfaces::HMI_INTERFACE_TTS; + convert_map[BasicCommunication_OnResetTimeout] = + HmiInterfaces::HMI_INTERFACE_BasicCommunication; convert_map[UI_Alert] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_SubtleAlert] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_Show] = HmiInterfaces::HMI_INTERFACE_UI; @@ -165,7 +166,6 @@ generate_function_to_interface_convert_map() { convert_map[UI_EndAudioPassThru] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_IsReady] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_ClosePopUp] = HmiInterfaces::HMI_INTERFACE_UI; - convert_map[UI_OnResetTimeout] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[UI_SendHapticData] = HmiInterfaces::HMI_INTERFACE_UI; convert_map[Navigation_IsReady] = HmiInterfaces::HMI_INTERFACE_Navigation; convert_map[Navigation_SendLocation] = diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc deleted file mode 100644 index d94bb0e4df..0000000000 --- a/src/components/application_manager/src/request_controller.cc +++ /dev/null @@ -1,546 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "utils/logger.h" - -#include "application_manager/commands/command_request_impl.h" -#include "application_manager/commands/request_to_hmi.h" -#include "application_manager/request_controller.h" - -#include "utils/timer_task_impl.h" - -namespace application_manager { - -namespace request_controller { - -using namespace sync_primitives; - -SDL_CREATE_LOG_VARIABLE("RequestController") - -RequestController::RequestController(const RequestControlerSettings& settings) - : pool_state_(UNDEFINED) - , pool_size_(settings.thread_pool_size()) - , request_tracker_(settings) - , duplicate_message_count_() - , timer_("AM RequestCtrlTimer", - new timer::TimerTaskImpl( - this, &RequestController::TimeoutThread)) - , timer_stop_flag_(false) - , is_low_voltage_(false) - , settings_(settings) { - SDL_LOG_AUTO_TRACE(); - InitializeThreadpool(); - timer_.Start(0, timer::kSingleShot); -} - -RequestController::~RequestController() { - SDL_LOG_AUTO_TRACE(); - { - sync_primitives::AutoLock auto_lock(timer_lock); - timer_stop_flag_ = true; - timer_condition_.Broadcast(); - } - timer_.Stop(); - if (pool_state_ != TPoolState::STOPPED) { - DestroyThreadpool(); - } -} - -void RequestController::InitializeThreadpool() { - SDL_LOG_AUTO_TRACE(); - // TODO(DK): Consider lazy loading threads instead of creating all at once - pool_state_ = TPoolState::STARTED; - char name[50]; - for (uint32_t i = 0; i < pool_size_; ++i) { - snprintf(name, sizeof(name) / sizeof(name[0]), "AM Pool %u", i); - pool_.push_back(threads::CreateThread(name, new Worker(this))); - pool_[i]->Start(); - SDL_LOG_DEBUG("Request thread initialized: " << name); - } -} - -void RequestController::DestroyThreadpool() { - SDL_LOG_AUTO_TRACE(); - { - AutoLock auto_lock(mobile_request_list_lock_); - pool_state_ = TPoolState::STOPPED; - SDL_LOG_DEBUG("Broadcasting STOP signal to all threads..."); - cond_var_.Broadcast(); // notify all threads we are shutting down - } - for (size_t i = 0; i < pool_.size(); ++i) { - threads::Thread* thread = pool_[i]; - thread->Stop(threads::Thread::kThreadSoftStop); - delete thread->GetDelegate(); - threads::DeleteThread(thread); - } - pool_.clear(); -} - -RequestController::TResult RequestController::CheckPosibilitytoAdd( - const RequestPtr request, const mobile_apis::HMILevel::eType level) { - SDL_LOG_AUTO_TRACE(); - if (!CheckPendingRequestsAmount(settings_.pending_requests_amount())) { - SDL_LOG_ERROR("Too many pending request"); - return RequestController::TOO_MANY_PENDING_REQUESTS; - } - - const TrackResult track_result = - request_tracker_.Track(request->connection_key(), level); - - if (TrackResult::kNoneLevelMaxRequestsExceeded == track_result) { - SDL_LOG_ERROR("Too many application requests in hmi level NONE"); - return RequestController::NONE_HMI_LEVEL_MANY_REQUESTS; - } - - if (TrackResult::kMaxRequestsExceeded == track_result) { - SDL_LOG_ERROR("Too many application requests"); - return RequestController::TOO_MANY_REQUESTS; - } - - if (IsLowVoltage()) { - SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active"); - return RequestController::INVALID_DATA; - } - - return SUCCESS; -} - -bool RequestController::CheckPendingRequestsAmount( - const uint32_t& pending_requests_amount) { - SDL_LOG_AUTO_TRACE(); - if (pending_requests_amount > 0) { - const size_t pending_requests_size = mobile_request_list_.size(); - const bool available_to_add = - pending_requests_amount > pending_requests_size; - if (!available_to_add) { - SDL_LOG_WARN("Pending requests count " << pending_requests_size - << " exceed application limit " - << pending_requests_amount); - } - return available_to_add; - } - SDL_LOG_DEBUG("CheckPendingRequestsAmount disabled"); - return true; -} - -RequestController::TResult RequestController::addMobileRequest( - const RequestPtr request, const mobile_apis::HMILevel::eType& hmi_level) { - SDL_LOG_AUTO_TRACE(); - if (!request) { - SDL_LOG_ERROR("Null Pointer request"); - cond_var_.NotifyOne(); - return INVALID_DATA; - } - SDL_LOG_DEBUG("correlation_id : " << request->correlation_id() - << "connection_key : " - << request->connection_key()); - RequestController::TResult result = CheckPosibilitytoAdd(request, hmi_level); - if (SUCCESS == result) { - AutoLock auto_lock_list(mobile_request_list_lock_); - mobile_request_list_.push_back(request); - SDL_LOG_DEBUG("Waiting for execution: " << mobile_request_list_.size()); - // wake up one thread that is waiting for a task to be available - } - cond_var_.NotifyOne(); - return result; -} - -RequestController::TResult RequestController::addHMIRequest( - const RequestPtr request) { - SDL_LOG_AUTO_TRACE(); - - if (request.use_count() == 0) { - SDL_LOG_ERROR("HMI request pointer is invalid"); - return RequestController::INVALID_DATA; - } - SDL_LOG_DEBUG(" correlation_id : " << request->correlation_id()); - - const uint64_t timeout_in_mseconds = - static_cast(request->default_timeout()); - RequestInfoPtr request_info_ptr = - std::make_shared(request, timeout_in_mseconds); - - if (0 == timeout_in_mseconds) { - SDL_LOG_DEBUG( - "Default timeout was set to 0." - "RequestController will not track timeout of this request."); - } - - if (IsLowVoltage()) { - SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active"); - return RequestController::INVALID_DATA; - } - - waiting_for_response_.Add(request_info_ptr); - SDL_LOG_DEBUG("Waiting for response count:" << waiting_for_response_.Size()); - - NotifyTimer(); - return RequestController::SUCCESS; -} - -void RequestController::addNotification(const RequestPtr ptr) { - SDL_LOG_AUTO_TRACE(); - if (IsLowVoltage()) { - SDL_LOG_ERROR( - "Impossible to add notification due to Low Voltage is active"); - return; - } - notification_list_.push_back(ptr); -} - -void RequestController::removeNotification( - const commands::Command* notification) { - SDL_LOG_AUTO_TRACE(); - std::list::iterator it = notification_list_.begin(); - for (; notification_list_.end() != it;) { - if (it->get() == notification) { - notification_list_.erase(it++); - SDL_LOG_DEBUG("Notification removed"); - return; - } else { - ++it; - } - } - SDL_LOG_DEBUG("Cannot find notification"); -} - -void RequestController::TerminateRequest(const uint32_t correlation_id, - const uint32_t connection_key, - const int32_t function_id, - bool force_terminate) { - SDL_LOG_AUTO_TRACE(); - SDL_LOG_DEBUG("correlation_id = " - << correlation_id << " connection_key = " << connection_key - << " function_id = " << function_id - << " force_terminate = " << force_terminate); - { - AutoLock auto_lock(duplicate_message_count_lock_); - auto dup_it = duplicate_message_count_.find(correlation_id); - if (duplicate_message_count_.end() != dup_it) { - --duplicate_message_count_[correlation_id]; - if (0 == duplicate_message_count_[correlation_id]) { - duplicate_message_count_.erase(dup_it); - } - SDL_LOG_DEBUG( - "Ignoring termination request due to duplicate correlation " - "ID being sent"); - return; - } - } - - RequestInfoPtr request = - waiting_for_response_.Find(connection_key, correlation_id); - if (!request) { - SDL_LOG_WARN("Request was not found in waiting_for_response"); - return; - } - if (request->request()->function_id() != function_id) { - SDL_LOG_ERROR("Request and response function_id's don't match"); - return; - } - if (force_terminate || request->request()->AllowedToTerminate()) { - waiting_for_response_.RemoveRequest(request); - } else { - SDL_LOG_WARN("Request was not terminated"); - } - NotifyTimer(); -} - -void RequestController::OnMobileResponse(const uint32_t mobile_correlation_id, - const uint32_t connection_key, - const int32_t function_id) { - SDL_LOG_AUTO_TRACE(); - TerminateRequest(mobile_correlation_id, connection_key, function_id); -} - -void RequestController::OnHMIResponse(const uint32_t correlation_id, - const int32_t function_id) { - SDL_LOG_AUTO_TRACE(); - TerminateRequest(correlation_id, RequestInfo::HmiConnectionKey, function_id); -} - -void RequestController::terminateWaitingForExecutionAppRequests( - const uint32_t& app_id) { - SDL_LOG_AUTO_TRACE(); - SDL_LOG_DEBUG("app_id: " << app_id << "Waiting for execution" - << mobile_request_list_.size()); - AutoLock auto_lock(mobile_request_list_lock_); - std::list::iterator request_it = mobile_request_list_.begin(); - while (mobile_request_list_.end() != request_it) { - RequestPtr request = (*request_it); - if ((request.use_count() != 0) && (request->connection_key() == app_id)) { - mobile_request_list_.erase(request_it++); - } else { - ++request_it; - } - } - SDL_LOG_DEBUG("Waiting for execution " << mobile_request_list_.size()); -} - -void RequestController::terminateWaitingForResponseAppRequests( - const uint32_t& app_id) { - SDL_LOG_AUTO_TRACE(); - waiting_for_response_.RemoveByConnectionKey(app_id); - SDL_LOG_DEBUG( - "Waiting for response count : " << waiting_for_response_.Size()); -} - -void RequestController::terminateAppRequests(const uint32_t& app_id) { - SDL_LOG_AUTO_TRACE(); - SDL_LOG_DEBUG("app_id : " << app_id - << "Requests waiting for execution count : " - << mobile_request_list_.size() - << "Requests waiting for response count : " - << waiting_for_response_.Size()); - - terminateWaitingForExecutionAppRequests(app_id); - terminateWaitingForResponseAppRequests(app_id); - NotifyTimer(); -} - -void RequestController::terminateAllHMIRequests() { - SDL_LOG_AUTO_TRACE(); - terminateWaitingForResponseAppRequests(RequestInfo::HmiConnectionKey); -} - -void RequestController::terminateAllMobileRequests() { - SDL_LOG_AUTO_TRACE(); - waiting_for_response_.RemoveMobileRequests(); - SDL_LOG_DEBUG("Mobile Requests waiting for response cleared"); - AutoLock waiting_execution_auto_lock(mobile_request_list_lock_); - mobile_request_list_.clear(); - SDL_LOG_DEBUG("Mobile Requests waiting for execution cleared"); - NotifyTimer(); -} - -void RequestController::updateRequestTimeout(const uint32_t& app_id, - const uint32_t& correlation_id, - const uint32_t& new_timeout) { - SDL_LOG_AUTO_TRACE(); - - SDL_LOG_DEBUG("app_id : " << app_id - << " mobile_correlation_id : " << correlation_id - << " new_timeout : " << new_timeout); - SDL_LOG_DEBUG( - "New_timeout is NULL. RequestCtrl will " - "not manage this request any more"); - - RequestInfoPtr request_info = - waiting_for_response_.Find(app_id, correlation_id); - if (request_info) { - waiting_for_response_.RemoveRequest(request_info); - request_info->updateTimeOut(new_timeout); - waiting_for_response_.Add(request_info); - NotifyTimer(); - SDL_LOG_INFO("Timeout updated for " - << " app_id: " << app_id << " correlation_id: " - << correlation_id << " new_timeout (ms): " << new_timeout); - } else { - SDL_LOG_ERROR("Can't find request with " - << " app_id: " << app_id - << " correlation_id: " << correlation_id); - } -} - -void RequestController::OnLowVoltage() { - SDL_LOG_AUTO_TRACE(); - is_low_voltage_ = true; -} - -void RequestController::OnWakeUp() { - SDL_LOG_AUTO_TRACE(); - terminateAllHMIRequests(); - terminateAllMobileRequests(); - is_low_voltage_ = false; - SDL_LOG_DEBUG("Terminate old requests done"); -} - -bool RequestController::IsLowVoltage() { - SDL_LOG_TRACE("result: " << is_low_voltage_); - return is_low_voltage_; -} - -void RequestController::TimeoutThread() { - SDL_LOG_AUTO_TRACE(); - SDL_LOG_DEBUG( - "ENTER Waiting fore response count: " << waiting_for_response_.Size()); - sync_primitives::AutoLock auto_lock(timer_lock); - while (!timer_stop_flag_) { - RequestInfoPtr probably_expired = - waiting_for_response_.FrontWithNotNullTimeout(); - if (!probably_expired) { - timer_condition_.Wait(auto_lock); - continue; - } - if (!probably_expired->isExpired()) { - SDL_LOG_DEBUG("Timeout for " - << (RequestInfo::HMIRequest == - probably_expired->request_type() - ? "HMI" - : "Mobile") - << " request id: " << probably_expired->requestId() - << " connection_key: " << probably_expired->app_id() - << " NOT expired"); - const date_time::TimeDuration current_time = date_time::getCurrentTime(); - const date_time::TimeDuration end_time = probably_expired->end_time(); - if (current_time < end_time) { - const uint32_t msecs = - static_cast(date_time::getmSecs(end_time - current_time)); - SDL_LOG_DEBUG("Sleep for " << msecs << " millisecs"); - timer_condition_.WaitFor(auto_lock, msecs); - } - continue; - } - SDL_LOG_INFO("Timeout for " - << (RequestInfo::HMIRequest == probably_expired->request_type() - ? "HMI" - : "Mobile") - << " request id: " << probably_expired->requestId() - << " connection_key: " << probably_expired->app_id() - << " is expired"); - const uint32_t experied_request_id = probably_expired->requestId(); - const uint32_t experied_app_id = probably_expired->app_id(); - - probably_expired->request()->onTimeOut(); - if (RequestInfo::HmiConnectionKey == probably_expired->app_id()) { - SDL_LOG_DEBUG("Erase HMI request: " << probably_expired->requestId()); - waiting_for_response_.RemoveRequest(probably_expired); - } - probably_expired = waiting_for_response_.FrontWithNotNullTimeout(); - if (probably_expired) { - if (experied_request_id == probably_expired->requestId() && - experied_app_id == probably_expired->app_id()) { - SDL_LOG_DEBUG("Expired request wasn't removed"); - break; - } - } - } - SDL_LOG_DEBUG( - "EXIT Waiting for response count : " << waiting_for_response_.Size()); -} - -RequestController::Worker::Worker(RequestController* requestController) - : request_controller_(requestController), stop_flag_(false) {} - -RequestController::Worker::~Worker() {} - -void RequestController::Worker::threadMain() { - SDL_LOG_AUTO_TRACE(); - AutoLock auto_lock(thread_lock_); - while (!stop_flag_) { - // Try to pick a request - AutoLock auto_lock(request_controller_->mobile_request_list_lock_); - - while ((request_controller_->pool_state_ != TPoolState::STOPPED) && - (request_controller_->mobile_request_list_.empty())) { - // Wait until there is a task in the queue - // Unlock mutex while wait, then lock it back when signaled - SDL_LOG_INFO("Unlocking and waiting"); - request_controller_->cond_var_.Wait(auto_lock); - SDL_LOG_INFO("Signaled and locking"); - } - - // If the thread was shutdown, return from here - if (request_controller_->pool_state_ == TPoolState::STOPPED) { - break; - } - - if (request_controller_->mobile_request_list_.empty()) { - SDL_LOG_WARN("Mobile request list is empty"); - break; - } - - RequestPtr request_ptr(request_controller_->mobile_request_list_.front()); - request_controller_->mobile_request_list_.pop_front(); - - bool init_res = request_ptr->Init(); // to setup specific - // default timeout - - const uint32_t timeout_in_mseconds = request_ptr->default_timeout(); - RequestInfoPtr request_info_ptr = - std::make_shared(request_ptr, timeout_in_mseconds); - - if (!request_controller_->waiting_for_response_.Add(request_info_ptr)) { - commands::CommandRequestImpl* cmd_request = - dynamic_cast(request_ptr.get()); - if (cmd_request != NULL) { - uint32_t corr_id = cmd_request->correlation_id(); - request_controller_->duplicate_message_count_lock_.Acquire(); - auto dup_it = - request_controller_->duplicate_message_count_.find(corr_id); - if (request_controller_->duplicate_message_count_.end() == dup_it) { - request_controller_->duplicate_message_count_[corr_id] = 0; - } - request_controller_->duplicate_message_count_[corr_id]++; - request_controller_->duplicate_message_count_lock_.Release(); - cmd_request->SendResponse( - false, mobile_apis::Result::INVALID_ID, "Duplicate correlation_id"); - } - continue; - } - SDL_LOG_DEBUG("timeout_in_mseconds " << timeout_in_mseconds); - - if (0 != timeout_in_mseconds) { - request_controller_->NotifyTimer(); - } else { - SDL_LOG_DEBUG( - "Default timeout was set to 0. " - "RequestController will not track timeout " - "of this request."); - } - - AutoUnlock unlock(auto_lock); - - // execute - if ((false == request_controller_->IsLowVoltage()) && - request_ptr->CheckPermissions() && init_res) { - SDL_LOG_DEBUG("Execute MobileRequest corr_id = " - << request_info_ptr->requestId() - << " with timeout: " << timeout_in_mseconds); - request_ptr->Run(); - } - } -} - -void RequestController::Worker::exitThreadMain() { - stop_flag_ = true; - // setup stop flag and whit while threadMain will be finished correctly - // FIXME (dchmerev@luxoft.com): There is no waiting -} - -void RequestController::NotifyTimer() { - SDL_LOG_AUTO_TRACE(); - timer_condition_.NotifyOne(); -} - -} // namespace request_controller -} // namespace application_manager diff --git a/src/components/application_manager/src/request_controller_impl.cc b/src/components/application_manager/src/request_controller_impl.cc new file mode 100644 index 0000000000..10f0f64b4e --- /dev/null +++ b/src/components/application_manager/src/request_controller_impl.cc @@ -0,0 +1,586 @@ +/* + * Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "utils/logger.h" + +#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_to_hmi.h" +#include "application_manager/request_controller_impl.h" + +#include "utils/timer_task_impl.h" + +namespace application_manager { + +namespace request_controller { + +using namespace sync_primitives; + +SDL_CREATE_LOG_VARIABLE("RequestController") + +RequestControllerImpl::RequestControllerImpl( + const RequestControlerSettings& settings, + RequestTimeoutHandler& request_timeout_handler) + : pool_state_(TPoolState::UNDEFINED) + , pool_size_(settings.thread_pool_size()) + , request_tracker_(settings) + , duplicate_message_count_() + , timer_("AM RequestCtrlTimer", + new timer::TimerTaskImpl( + this, &RequestControllerImpl::TimeoutThread)) + , timer_stop_flag_(false) + , is_low_voltage_(false) + , settings_(settings) + , request_timeout_handler_(request_timeout_handler) { + SDL_LOG_AUTO_TRACE(); + InitializeThreadpool(); + timer_.Start(0, timer::kSingleShot); +} + +RequestControllerImpl::~RequestControllerImpl() { + SDL_LOG_AUTO_TRACE(); + Stop(); +} + +void RequestControllerImpl::Stop() { + SDL_LOG_AUTO_TRACE(); + + { + sync_primitives::AutoLock auto_lock(timer_lock); + timer_stop_flag_ = true; + timer_condition_.Broadcast(); + } + + if (pool_state_ != TPoolState::STOPPED) { + DestroyThreadpool(); + } + + SDL_LOG_DEBUG("Stopping timeout tracker"); + timer_.Stop(); +} + +void RequestControllerImpl::InitializeThreadpool() { + SDL_LOG_AUTO_TRACE(); + + // TODO(DK): Consider lazy loading threads instead of creating all at once + pool_state_ = TPoolState::STARTED; + char name[50]; + for (uint32_t i = 0; i < pool_size_; ++i) { + snprintf(name, sizeof(name) / sizeof(name[0]), "AM Pool %u", i); + pool_.push_back(threads::CreateThread(name, new Worker(this))); + pool_[i]->Start(); + SDL_LOG_DEBUG("Request thread initialized: " << name); + } +} + +void RequestControllerImpl::DestroyThreadpool() { + SDL_LOG_AUTO_TRACE(); + { + AutoLock auto_lock(mobile_request_list_lock_); + pool_state_ = TPoolState::STOPPED; + SDL_LOG_DEBUG("Broadcasting STOP signal to all threads..."); + cond_var_.Broadcast(); // notify all threads we are shutting down + } + for (size_t i = 0; i < pool_.size(); ++i) { + threads::Thread* thread = pool_[i]; + thread->Stop(threads::Thread::kThreadSoftStop); + delete thread->GetDelegate(); + threads::DeleteThread(thread); + } + pool_.clear(); +} + +RequestControllerImpl::TResult RequestControllerImpl::CheckPosibilitytoAdd( + const RequestPtr request, const mobile_apis::HMILevel::eType level) { + SDL_LOG_AUTO_TRACE(); + if (!CheckPendingRequestsAmount(settings_.pending_requests_amount())) { + SDL_LOG_ERROR("Too many pending request"); + return RequestController::TResult::TOO_MANY_PENDING_REQUESTS; + } + + const TrackResult track_result = + request_tracker_.Track(request->connection_key(), level); + + if (TrackResult::kNoneLevelMaxRequestsExceeded == track_result) { + SDL_LOG_ERROR("Too many application requests in hmi level NONE"); + return RequestController::TResult::NONE_HMI_LEVEL_MANY_REQUESTS; + } + + if (TrackResult::kMaxRequestsExceeded == track_result) { + SDL_LOG_ERROR("Too many application requests"); + return RequestController::TResult::TOO_MANY_REQUESTS; + } + + if (IsLowVoltage()) { + SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active"); + return RequestController::TResult::INVALID_DATA; + } + + return TResult::SUCCESS; +} + +bool RequestControllerImpl::CheckPendingRequestsAmount( + const uint32_t pending_requests_amount) { + SDL_LOG_AUTO_TRACE(); + + if (pending_requests_amount > 0) { + const size_t pending_requests_size = mobile_request_list_.size(); + const bool available_to_add = + pending_requests_amount > pending_requests_size; + if (!available_to_add) { + SDL_LOG_WARN("Pending requests count " << pending_requests_size + << " exceed application limit " + << pending_requests_amount); + } + return available_to_add; + } + SDL_LOG_DEBUG("CheckPendingRequestsAmount disabled"); + return true; +} + +RequestController::TResult RequestControllerImpl::AddMobileRequest( + const RequestPtr request, const mobile_apis::HMILevel::eType& hmi_level) { + SDL_LOG_AUTO_TRACE(); + if (!request) { + SDL_LOG_ERROR("Null Pointer request"); + cond_var_.NotifyOne(); + return TResult::INVALID_DATA; + } + SDL_LOG_DEBUG("correlation_id : " << request->correlation_id() + << "connection_key : " + << request->connection_key()); + RequestController::TResult result = CheckPosibilitytoAdd(request, hmi_level); + if (TResult::SUCCESS == result) { + AutoLock auto_lock_list(mobile_request_list_lock_); + mobile_request_list_.push_back(request); + SDL_LOG_DEBUG("Waiting for execution: " << mobile_request_list_.size()); + // wake up one thread that is waiting for a task to be available + } + cond_var_.NotifyOne(); + return result; +} + +RequestController::TResult RequestControllerImpl::AddHMIRequest( + const RequestPtr request) { + SDL_LOG_AUTO_TRACE(); + + if (request.use_count() == 0) { + SDL_LOG_ERROR("HMI request pointer is invalid"); + return RequestController::TResult::INVALID_DATA; + } + SDL_LOG_DEBUG(" correlation_id : " << request->correlation_id()); + + const uint64_t timeout_in_mseconds = + static_cast(request->default_timeout()); + RequestInfoPtr request_info_ptr = + std::make_shared(request, timeout_in_mseconds); + + if (0 == timeout_in_mseconds) { + SDL_LOG_DEBUG( + "Default timeout was set to 0." + "RequestController will not track timeout of this request."); + } + + if (IsLowVoltage()) { + SDL_LOG_ERROR("Impossible to add request due to Low Voltage is active"); + return RequestController::TResult::INVALID_DATA; + } + + waiting_for_response_.Add(request_info_ptr); + SDL_LOG_DEBUG("Waiting for response count:" << waiting_for_response_.Size()); + + NotifyTimer(); + return RequestController::TResult::SUCCESS; +} + +void RequestControllerImpl::AddNotification(const RequestPtr ptr) { + SDL_LOG_AUTO_TRACE(); + + if (IsLowVoltage()) { + SDL_LOG_ERROR( + "Impossible to add notification due to Low Voltage is active"); + return; + } + notification_list_.push_back(ptr); +} + +void RequestControllerImpl::RemoveNotification( + const commands::Command* notification) { + SDL_LOG_AUTO_TRACE(); + std::list::iterator it = notification_list_.begin(); + for (; notification_list_.end() != it;) { + if (it->get() == notification) { + notification_list_.erase(it++); + SDL_LOG_DEBUG("Notification removed"); + return; + } else { + ++it; + } + } + SDL_LOG_DEBUG("Cannot find notification"); +} + +void RequestControllerImpl::TerminateRequest(const uint32_t correlation_id, + const uint32_t connection_key, + const int32_t function_id, + bool force_terminate) { + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("correlation_id = " + << correlation_id << " connection_key = " << connection_key + << " function_id = " << function_id + << " force_terminate = " << force_terminate); + + { + AutoLock auto_lock(duplicate_message_count_lock_); + auto dup_it = duplicate_message_count_.find(correlation_id); + if (duplicate_message_count_.end() != dup_it) { + --duplicate_message_count_[correlation_id]; + if (0 == duplicate_message_count_[correlation_id]) { + duplicate_message_count_.erase(dup_it); + } + SDL_LOG_DEBUG( + "Ignoring termination request due to duplicate correlation " + "ID being sent"); + return; + } + } + + RequestInfoPtr request = + waiting_for_response_.Find(connection_key, correlation_id); + if (!request) { + SDL_LOG_WARN("Request was not found in waiting_for_response"); + return; + } + if (request->request()->function_id() != function_id) { + SDL_LOG_ERROR("Request and response function_id's don't match"); + return; + } + if (force_terminate || request->request()->AllowedToTerminate()) { + waiting_for_response_.RemoveRequest(request); + if (RequestInfo::HMIRequest == request->request_type()) { + request_timeout_handler_.RemoveRequest(request->requestId()); + } + + } else { + SDL_LOG_WARN("Request was not terminated"); + } + NotifyTimer(); +} + +void RequestControllerImpl::OnMobileResponse( + const uint32_t mobile_correlation_id, + const uint32_t connection_key, + const int32_t function_id) { + SDL_LOG_AUTO_TRACE(); + TerminateRequest(mobile_correlation_id, connection_key, function_id); +} + +void RequestControllerImpl::OnHMIResponse(const uint32_t correlation_id, + const int32_t function_id) { + SDL_LOG_AUTO_TRACE(); + TerminateRequest(correlation_id, RequestInfo::kHmiConnectionKey, function_id); +} + +void RequestControllerImpl::TerminateWaitingForExecutionAppRequests( + const uint32_t app_id) { + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("app_id: " << app_id << "Waiting for execution" + << mobile_request_list_.size()); + AutoLock auto_lock(mobile_request_list_lock_); + std::list::iterator request_it = mobile_request_list_.begin(); + while (mobile_request_list_.end() != request_it) { + RequestPtr request = (*request_it); + if ((request.use_count() != 0) && (request->connection_key() == app_id)) { + mobile_request_list_.erase(request_it++); + } else { + ++request_it; + } + } + SDL_LOG_DEBUG("Waiting for execution " << mobile_request_list_.size()); +} + +void RequestControllerImpl::TerminateWaitingForResponseAppRequests( + const uint32_t app_id) { + SDL_LOG_AUTO_TRACE(); + waiting_for_response_.RemoveByConnectionKey(app_id); + SDL_LOG_DEBUG( + "Waiting for response count : " << waiting_for_response_.Size()); +} + +void RequestControllerImpl::TerminateAppRequests(const uint32_t app_id) { + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("app_id : " << app_id + << "Requests waiting for execution count : " + << mobile_request_list_.size() + << "Requests waiting for response count : " + << waiting_for_response_.Size()); + + TerminateWaitingForExecutionAppRequests(app_id); + TerminateWaitingForResponseAppRequests(app_id); + NotifyTimer(); +} + +void RequestControllerImpl::TerminateAllHMIRequests() { + SDL_LOG_AUTO_TRACE(); + TerminateWaitingForResponseAppRequests(RequestInfo::kHmiConnectionKey); +} + +void RequestControllerImpl::TerminateAllMobileRequests() { + SDL_LOG_AUTO_TRACE(); + + waiting_for_response_.RemoveMobileRequests(); + SDL_LOG_DEBUG("Mobile Requests waiting for response cleared"); + AutoLock waiting_execution_auto_lock(mobile_request_list_lock_); + mobile_request_list_.clear(); + SDL_LOG_DEBUG("Mobile Requests waiting for execution cleared"); + NotifyTimer(); +} + +void RequestControllerImpl::UpdateRequestTimeout(const uint32_t app_id, + const uint32_t correlation_id, + const uint32_t new_timeout) { + SDL_LOG_AUTO_TRACE(); + SDL_LOG_DEBUG("app_id : " << app_id + << " mobile_correlation_id : " << correlation_id + << " new_timeout : " << new_timeout); + + if (new_timeout == 0) { + SDL_LOG_DEBUG( + "New_timeout is NULL. RequestCtrl will " + "not manage this request any more"); + } + + RequestInfoPtr request_info = + waiting_for_response_.Find(app_id, correlation_id); + if (request_info) { + if (0 == request_info->timeout_msec()) { + SDL_LOG_INFO( + "Request with zero timeout is not updating, " + "manual control is assumed"); + return; + } + + waiting_for_response_.RemoveRequest(request_info); + request_info->updateTimeOut(new_timeout); + waiting_for_response_.Add(request_info); + NotifyTimer(); + SDL_LOG_INFO("Timeout updated for " + << " app_id: " << app_id << " correlation_id: " + << correlation_id << " new_timeout (ms): " << new_timeout); + } else { + SDL_LOG_ERROR("Can't find request with " + << " app_id: " << app_id + << " correlation_id: " << correlation_id); + } +} + +void RequestControllerImpl::OnLowVoltage() { + SDL_LOG_AUTO_TRACE(); + is_low_voltage_ = true; +} + +void RequestControllerImpl::OnWakeUp() { + SDL_LOG_AUTO_TRACE(); + TerminateAllHMIRequests(); + TerminateAllMobileRequests(); + is_low_voltage_ = false; + SDL_LOG_DEBUG("Terminate old requests done"); +} + +bool RequestControllerImpl::IsLowVoltage() { + SDL_LOG_TRACE("result: " << is_low_voltage_); + return is_low_voltage_; +} + +void RequestControllerImpl::TimeoutThread() { + SDL_LOG_AUTO_TRACE(); + + if (TPoolState::STOPPED == pool_state_) { + SDL_LOG_DEBUG("Thread pool has been stopped. Skipping timer restart"); + return; + } + + SDL_LOG_DEBUG( + "ENTER Waiting fore response count: " << waiting_for_response_.Size()); + sync_primitives::AutoLock auto_lock(timer_lock); + while (!timer_stop_flag_) { + RequestInfoPtr probably_expired = + waiting_for_response_.FrontWithNotNullTimeout(); + if (!probably_expired) { + timer_condition_.Wait(auto_lock); + continue; + } + if (!probably_expired->isExpired()) { + SDL_LOG_DEBUG("Timeout for " + << (RequestInfo::HMIRequest == + probably_expired->request_type() + ? "HMI" + : "Mobile") + << " request id: " << probably_expired->requestId() + << " connection_key: " << probably_expired->app_id() + << " NOT expired"); + const date_time::TimeDuration current_time = date_time::getCurrentTime(); + const date_time::TimeDuration end_time = probably_expired->end_time(); + if (current_time < end_time) { + const uint32_t msecs = + static_cast(date_time::getmSecs(end_time - current_time)); + SDL_LOG_DEBUG("Sleep for " << msecs << " millisecs"); + timer_condition_.WaitFor(auto_lock, msecs); + } + continue; + } + SDL_LOG_INFO("Timeout for " + << (RequestInfo::HMIRequest == probably_expired->request_type() + ? "HMI" + : "Mobile") + << " request id: " << probably_expired->requestId() + << " connection_key: " << probably_expired->app_id() + << " is expired"); + const uint32_t expired_request_id = probably_expired->requestId(); + const uint32_t expired_app_id = probably_expired->app_id(); + + probably_expired->request()->onTimeOut(); + if (RequestInfo::kHmiConnectionKey == probably_expired->app_id()) { + SDL_LOG_DEBUG("Erase HMI request: " << probably_expired->requestId()); + waiting_for_response_.RemoveRequest(probably_expired); + if (RequestInfo::HMIRequest == probably_expired->request_type()) { + request_timeout_handler_.RemoveRequest(expired_request_id); + } + } + probably_expired = waiting_for_response_.FrontWithNotNullTimeout(); + if (probably_expired) { + if (expired_request_id == probably_expired->requestId() && + expired_app_id == probably_expired->app_id()) { + SDL_LOG_DEBUG("Expired request wasn't removed"); + break; + } + } + } + SDL_LOG_DEBUG( + "EXIT Waiting for response count : " << waiting_for_response_.Size()); +} + +RequestControllerImpl::Worker::Worker(RequestControllerImpl* request_controller) + : request_controller_(request_controller), stop_flag_(false) {} + +RequestControllerImpl::Worker::~Worker() {} + +void RequestControllerImpl::Worker::threadMain() { + SDL_LOG_AUTO_TRACE(); + AutoLock auto_lock(thread_lock_); + while (!stop_flag_) { + // Try to pick a request + AutoLock auto_lock(request_controller_->mobile_request_list_lock_); + + while ((request_controller_->pool_state_ != TPoolState::STOPPED) && + (request_controller_->mobile_request_list_.empty())) { + // Wait until there is a task in the queue + // Unlock mutex while wait, then lock it back when signaled + SDL_LOG_INFO("Unlocking and waiting"); + request_controller_->cond_var_.Wait(auto_lock); + SDL_LOG_INFO("Signaled and locking"); + } + + // If the thread was shutdown, return from here + if (request_controller_->pool_state_ == TPoolState::STOPPED) { + break; + } + + if (request_controller_->mobile_request_list_.empty()) { + SDL_LOG_WARN("Mobile request list is empty"); + break; + } + + RequestPtr request_ptr(request_controller_->mobile_request_list_.front()); + request_controller_->mobile_request_list_.pop_front(); + + bool init_res = request_ptr->Init(); // to setup specific + // default timeout + + const uint32_t timeout_in_mseconds = request_ptr->default_timeout(); + RequestInfoPtr request_info_ptr = + std::make_shared(request_ptr, timeout_in_mseconds); + + if (!request_controller_->waiting_for_response_.Add(request_info_ptr)) { + commands::CommandRequestImpl* cmd_request = + dynamic_cast(request_ptr.get()); + if (cmd_request != NULL) { + uint32_t corr_id = cmd_request->correlation_id(); + request_controller_->duplicate_message_count_lock_.Acquire(); + auto dup_it = + request_controller_->duplicate_message_count_.find(corr_id); + if (request_controller_->duplicate_message_count_.end() == dup_it) { + request_controller_->duplicate_message_count_[corr_id] = 0; + } + request_controller_->duplicate_message_count_[corr_id]++; + request_controller_->duplicate_message_count_lock_.Release(); + cmd_request->SendResponse( + false, mobile_apis::Result::INVALID_ID, "Duplicate correlation_id"); + } + continue; + } + SDL_LOG_DEBUG("timeout_in_mseconds " << timeout_in_mseconds); + + if (0 != timeout_in_mseconds) { + request_controller_->NotifyTimer(); + } else { + SDL_LOG_DEBUG( + "Default timeout was set to 0. " + "RequestController will not track timeout " + "of this request."); + } + + AutoUnlock unlock(auto_lock); + + // execute + if ((false == request_controller_->IsLowVoltage()) && + request_ptr->CheckPermissions() && init_res) { + SDL_LOG_DEBUG("Execute MobileRequest corr_id = " + << request_info_ptr->requestId() + << " with timeout: " << timeout_in_mseconds); + request_ptr->Run(); + } + } +} + +void RequestControllerImpl::Worker::exitThreadMain() { + stop_flag_ = true; + // setup stop flag and whit while threadMain will be finished correctly + // FIXME (dchmerev@luxoft.com): There is no waiting +} + +void RequestControllerImpl::NotifyTimer() { + SDL_LOG_AUTO_TRACE(); + timer_condition_.NotifyOne(); +} + +} // namespace request_controller +} // namespace application_manager diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index b1c1d68eaa..6770e839b3 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -42,12 +42,12 @@ namespace request_controller { SDL_CREATE_LOG_VARIABLE("RequestController") -uint32_t RequestInfo::HmiConnectionKey = 0; +constexpr uint32_t RequestInfo::kHmiConnectionKey; HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec) : RequestInfo(request, HMIRequest, timeout_msec) { correlation_id_ = request_->correlation_id(); - app_id_ = RequestInfo::HmiConnectionKey; + app_id_ = RequestInfo::kHmiConnectionKey; } HMIRequestInfo::HMIRequestInfo(RequestPtr request, @@ -55,7 +55,7 @@ HMIRequestInfo::HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec) : RequestInfo(request, HMIRequest, start_time, timeout_msec) { correlation_id_ = request_->correlation_id(); - app_id_ = RequestInfo::HmiConnectionKey; + app_id_ = RequestInfo::kHmiConnectionKey; } MobileRequestInfo::MobileRequestInfo(RequestPtr request, @@ -132,13 +132,13 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) { << request_info->requestId()); sync_primitives::AutoLock lock(pending_requests_lock_); CheckSetSizes(); - const std::pair& insert_resilt = + const std::pair& insert_result = hash_sorted_pending_requests_.insert(request_info); - if (insert_resilt.second == true) { - const std::pair& insert_resilt = + if (insert_result.second == true) { + const std::pair& insert_result = time_sorted_pending_requests_.insert(request_info); - DCHECK(insert_resilt.second); - if (!insert_resilt.second) { + DCHECK(insert_result.second); + if (!insert_result.second) { return false; } CheckSetSizes(); @@ -153,7 +153,7 @@ bool RequestInfoSet::Add(RequestInfoPtr request_info) { } RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key, - const uint32_t correlation_id) { + const uint32_t correlation_id) const { RequestInfoPtr result; // Request info for searching in request info set by log_n time @@ -259,7 +259,7 @@ uint32_t RequestInfoSet::RemoveByConnectionKey(uint32_t connection_key) { uint32_t RequestInfoSet::RemoveMobileRequests() { SDL_LOG_AUTO_TRACE(); return RemoveRequests(AppIdCompararator(AppIdCompararator::NotEqual, - RequestInfo::HmiConnectionKey)); + RequestInfo::kHmiConnectionKey)); } const size_t RequestInfoSet::Size() { diff --git a/src/components/application_manager/src/request_timeout_handler_impl.cc b/src/components/application_manager/src/request_timeout_handler_impl.cc new file mode 100644 index 0000000000..f246693d56 --- /dev/null +++ b/src/components/application_manager/src/request_timeout_handler_impl.cc @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2020, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/request_timeout_handler_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/request_info.h" +#include "utils/logger.h" + +SDL_CREATE_LOG_VARIABLE("RequestTimeoutHandler") + +namespace application_manager { +namespace request_controller { + +RequestTimeoutHandlerImpl::RequestTimeoutHandlerImpl( + ApplicationManager& application_manager) + : EventObserver(application_manager.event_dispatcher()) + , application_manager_(application_manager) { + subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout); +} + +void RequestTimeoutHandlerImpl::AddRequest(const uint32_t hmi_correlation_id, + const Request& request) { + requests_.insert(std::make_pair(hmi_correlation_id, request)); +} + +void RequestTimeoutHandlerImpl::RemoveRequest( + const uint32_t hmi_correlation_id) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock lock(requests_lock_); + auto it = requests_.find(hmi_correlation_id); + if (it != requests_.end()) { + requests_.erase(it); + }; +} + +bool RequestTimeoutHandlerImpl::IsTimeoutUpdateRequired( + const Request& request, + const uint32_t timeout, + const hmi_apis::FunctionID::eType method_name) { + if (0 == timeout) { + SDL_LOG_WARN("Zero timeout ignored"); + return false; + } + + if (static_cast(request.hmi_function_id_) != + method_name) { + SDL_LOG_WARN("Method name does not match the hmi function id"); + return false; + } + + return true; +} + +void RequestTimeoutHandlerImpl::on_event(const event_engine::Event& event) { + SDL_LOG_AUTO_TRACE(); + const auto event_id = event.id(); + if (hmi_apis::FunctionID::BasicCommunication_OnResetTimeout == event_id) { + const smart_objects::SmartObject& message = event.smart_object(); + const auto method_name = StringToEnum( + message[strings::msg_params][strings::method_name].asString()); + + if (hmi_apis::FunctionID::INVALID_ENUM == method_name) { + SDL_LOG_WARN( + "Wrong method name received: " + << message[strings::msg_params][strings::method_name].asString()); + return; + } + uint32_t timeout = application_manager_.get_settings().default_timeout(); + if (message[strings::msg_params].keyExists(strings::reset_period)) { + timeout = message[strings::msg_params][strings::reset_period].asUInt(); + } + const auto hmi_corr_id = + message[strings::msg_params][strings::request_id].asUInt(); + auto it = requests_.find(hmi_corr_id); + if (it != requests_.end()) { + const auto& request = it->second; + if (IsTimeoutUpdateRequired(request, timeout, method_name)) { + // Add compensation time + timeout += + application_manager_.get_settings().default_timeout_compensation(); + application_manager_.UpdateRequestTimeout( + request.connection_key_, request.mob_correlation_id_, timeout); + application_manager_.UpdateRequestTimeout( + RequestInfo::kHmiConnectionKey, hmi_corr_id, timeout); + } + } else { + SDL_LOG_WARN("Timeout reset failed by " << hmi_corr_id + << ", no such mobile command"); + } + } +} +} // namespace request_controller +} // namespace application_manager diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index 6cb03705ab..67ff7cb6f0 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -36,6 +36,7 @@ #include "application_manager/app_service_manager.h" #include "application_manager/command_factory.h" #include "application_manager/commands/command.h" +#include "application_manager/commands/command_impl.h" #include "application_manager/plugin_manager/plugin_keys.h" namespace application_manager { @@ -225,11 +226,11 @@ bool RPCServiceImpl::ManageMobileCommand( return true; } if (message_type == mobile_apis::messageType::notification) { - request_ctrl_.addNotification(command); + request_ctrl_.AddNotification(command); if (command->Init() && command->CheckPermissions()) { command->Run(); if (command->CleanUp()) { - request_ctrl_.removeNotification(command.get()); + request_ctrl_.RemoveNotification(command.get()); } // If CleanUp returned false notification should remove it self. } @@ -260,11 +261,11 @@ bool RPCServiceImpl::ManageMobileCommand( // commands will be launched from request_ctrl const request_controller::RequestController::TResult result = - request_ctrl_.addMobileRequest(command, app_hmi_level); + request_ctrl_.AddMobileRequest(command, app_hmi_level); - if (result == request_controller::RequestController::SUCCESS) { + if (result == request_controller::RequestController::TResult::SUCCESS) { SDL_LOG_DEBUG("Perform request"); - } else if (result == request_controller::RequestController:: + } else if (result == request_controller::RequestController::TResult:: TOO_MANY_PENDING_REQUESTS) { SDL_LOG_ERROR("RET Unable top perform request: " << "TOO_MANY_PENDING_REQUESTS"); @@ -283,8 +284,8 @@ bool RPCServiceImpl::ManageMobileCommand( SendMessageToMobile(response); return false; - } else if (result == - request_controller::RequestController::TOO_MANY_REQUESTS) { + } else if (result == request_controller::RequestController::TResult:: + TOO_MANY_REQUESTS) { SDL_LOG_ERROR("RET Unable to perform request: " << "TOO_MANY_REQUESTS"); @@ -303,7 +304,7 @@ bool RPCServiceImpl::ManageMobileCommand( app_ptr->usage_report().RecordRemovalsForBadBehavior(); } return false; - } else if (result == request_controller::RequestController:: + } else if (result == request_controller::RequestController::TResult:: NONE_HMI_LEVEL_MANY_REQUESTS) { SDL_LOG_ERROR("RET Unable to perform request: " << "REQUEST_WHILE_IN_NONE_HMI_LEVEL"); @@ -391,7 +392,7 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message, if (kRequest == message_type) { SDL_LOG_DEBUG("ManageHMICommand"); command->set_warning_info(warning_info); - request_ctrl_.addHMIRequest(command); + request_ctrl_.AddHMIRequest(command); } if (command->Init()) { diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc index b7c40987ad..1490f9f5b1 100644 --- a/src/components/application_manager/src/smart_object_keys.cc +++ b/src/components/application_manager/src/smart_object_keys.cc @@ -461,6 +461,10 @@ const char* const rect = "rect"; const char* const x = "x"; const char* const y = "y"; const char* const preferred_fps = "preferredFPS"; + +// OnResetTimeout +const char* const request_id = "requestID"; +const char* const reset_period = "resetPeriod"; } // namespace strings namespace hmi_interface { diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt index cdaa770155..596d11cfa9 100755 --- a/src/components/application_manager/test/CMakeLists.txt +++ b/src/components/application_manager/test/CMakeLists.txt @@ -72,6 +72,7 @@ set(testSources ${AM_TEST_DIR}/application_helper_test.cc ${AM_TEST_DIR}/rpc_service_impl_test.cc ${AM_TEST_DIR}/command_holder_test.cc + ${AM_TEST_DIR}/request_timeout_handler_test.cc ) set(testSourcesMockHmi diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc index 734a7d91b8..b7b0801167 100644 --- a/src/components/application_manager/test/commands/command_impl_test.cc +++ b/src/components/application_manager/test/commands/command_impl_test.cc @@ -150,7 +150,9 @@ TEST_F(CommandImplTest, GetMethods_SUCCESS) { (*msg)[strings::params][strings::function_id] = kFunctionId; (*msg)[strings::params][strings::connection_key] = kConnectionKey; - EXPECT_EQ(kDefaultTimeout_, command->default_timeout()); + const uint32_t expected_timeout = + kDefaultTimeout_ + kDefaultTimeoutCompensation_; + EXPECT_EQ(expected_timeout, command->default_timeout()); EXPECT_EQ(kCorrelationId, command->correlation_id()); EXPECT_EQ(kConnectionKey, command->connection_key()); EXPECT_EQ(kFunctionId, command->function_id()); diff --git a/src/components/application_manager/test/help_prompt_manager_test.cc b/src/components/application_manager/test/help_prompt_manager_test.cc index caff56f675..d9fb0b82d9 100644 --- a/src/components/application_manager/test/help_prompt_manager_test.cc +++ b/src/components/application_manager/test/help_prompt_manager_test.cc @@ -57,6 +57,7 @@ const uint32_t kAppId = 10u; const uint32_t kCmdId = 1u; const std::string kPolicyAppId = "fake_app_id"; const uint32_t kTimeout = 10000u; +const uint32_t kTimeoutCompensation = 1000u; const std::string kText = "one"; const uint32_t kPosition = 1u; const std::string kFirstVrCommand = "first"; @@ -168,6 +169,8 @@ void HelpPromptManagerTest::SetUp() { .WillByDefault(ReturnRef(mock_event_dispatcher_)); ON_CALL(app_mngr_settings_, default_timeout()) .WillByDefault(ReturnRef(kTimeout)); + ON_CALL(app_mngr_settings_, default_timeout_compensation()) + .WillByDefault(ReturnRef(kTimeoutCompensation)); ON_CALL(app_mngr_settings_, app_icons_folder()) .WillByDefault(ReturnRef(kDirectoryName)); ON_CALL(app_mngr_settings_, app_storage_folder()) diff --git a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h index 3a44d7b3ff..b252d37181 100644 --- a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h @@ -38,6 +38,7 @@ #include "gtest/gtest.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/mock_request_timeout_handler.h" #include "application_manager/smart_object_keys.h" #include "application_manager/test/include/application_manager/commands/commands_test.h" #include "application_manager/test/include/application_manager/mock_event_dispatcher.h" @@ -59,6 +60,7 @@ namespace am = ::application_manager; using am::commands::Command; using am::commands::CommandRequestImpl; using am::event_engine::Event; +using test::components::application_manager_test::MockRequestTimeoutHandler; class CallRun { public: @@ -112,14 +114,17 @@ class CommandRequestTest : public CommandsTest { } MockEventDisp event_dispatcher_; + MockRequestTimeoutHandler mock_request_timeout_handler_; protected: CommandRequestTest() : CommandsTest() {} - virtual void InitCommand(const uint32_t& default_timeout) OVERRIDE { + void InitCommand(const uint32_t& default_timeout) OVERRIDE { CommandsTest::InitCommand(default_timeout); ON_CALL(CommandsTest::app_mngr_, event_dispatcher()) .WillByDefault(ReturnRef(event_dispatcher_)); + ON_CALL(CommandsTest::app_mngr_, get_request_timeout_handler()) + .WillByDefault(ReturnRef(mock_request_timeout_handler_)); } }; diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h index 18afa01a88..2087ef8f28 100644 --- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h @@ -146,7 +146,7 @@ class CommandsTest : public ::testing::Test { mock_policy_handler_); } - enum { kDefaultTimeout_ = 100 }; + enum { kDefaultTimeout_ = 100, kDefaultTimeoutCompensation_ = 10 }; MockAppManager app_mngr_; MockRPCService mock_rpc_service_; @@ -160,16 +160,25 @@ class CommandsTest : public ::testing::Test { protected: virtual void InitCommand(const uint32_t& timeout) { + this->InitCommand(timeout, kDefaultTimeoutCompensation_); + } + + virtual void InitCommand(const uint32_t timeout, + const uint32_t compensation) { timeout_ = timeout; + timeout_compensation_ = compensation; ON_CALL(app_mngr_, get_settings()) .WillByDefault(ReturnRef(app_mngr_settings_)); ON_CALL(app_mngr_settings_, default_timeout()) .WillByDefault(ReturnRef(timeout_)); + ON_CALL(app_mngr_settings_, default_timeout_compensation()) + .WillByDefault(ReturnRef(timeout_compensation_)); } CommandsTest() : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) - , timeout_(0) { + , timeout_(0) + , timeout_compensation_(0) { ON_CALL(app_mngr_, hmi_interfaces()) .WillByDefault(ReturnRef(mock_hmi_interfaces_)); ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) @@ -254,6 +263,7 @@ class CommandsTest : public ::testing::Test { private: uint32_t timeout_; + uint32_t timeout_compensation_; }; MATCHER_P(MobileResultCodeIs, result_code, "") { diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc index d2dc8f3528..4b36647a11 100644 --- a/src/components/application_manager/test/message_helper/message_helper_test.cc +++ b/src/components/application_manager/test/message_helper/message_helper_test.cc @@ -37,7 +37,6 @@ #include "gmock/gmock.h" #include "utils/macro.h" -#include "application_manager/commands/command_impl.h" #include "application_manager/event_engine/event_dispatcher.h" #include "application_manager/mock_application.h" #include "application_manager/mock_application_manager.h" @@ -53,6 +52,7 @@ #include "utils/custom_string.h" #include "utils/lock.h" +#include "application_manager/commands/command_impl.h" #include "policy/policy_table/types.h" #include "rpc_base/rpc_base_json_inl.h" @@ -650,7 +650,6 @@ class MessageHelperTest : public ::testing::Test { const StringArray function_id_strings; const StringArray events_id_strings; const StringArray hmi_level_strings; - const size_t delta_from_functions_id; }; diff --git a/src/components/application_manager/test/request_controller/request_controller_test.cc b/src/components/application_manager/test/request_controller/request_controller_test.cc index 992bf8e303..ccb7788b3d 100644 --- a/src/components/application_manager/test/request_controller/request_controller_test.cc +++ b/src/components/application_manager/test/request_controller/request_controller_test.cc @@ -33,7 +33,7 @@ #include #include "application_manager/mock_request.h" -#include "application_manager/request_controller.h" +#include "application_manager/request_controller_impl.h" #include "application_manager/request_info.h" #include "gtest/gtest.h" @@ -43,8 +43,11 @@ #include "smart_objects/smart_object.h" #include "application_manager/event_engine/event_dispatcher.h" +#include "application_manager/mock_application_manager.h" + #include "application_manager/mock_application_manager.h" #include "application_manager/mock_request_controller_settings.h" +#include "application_manager/mock_request_timeout_handler.h" #include "application_manager/policies/policy_handler.h" #include "application_manager/resumption/resume_ctrl.h" #include "application_manager/state_controller.h" @@ -56,7 +59,9 @@ namespace components { namespace request_controller_test { using ::application_manager::request_controller::RequestController; +using ::application_manager::request_controller::RequestControllerImpl; using ::application_manager::request_controller::RequestInfo; +using test::components::application_manager_test::MockRequestTimeoutHandler; using ::testing::_; using ::testing::NiceMock; @@ -65,7 +70,7 @@ using ::testing::ReturnRef; typedef NiceMock MRequest; typedef std::shared_ptr RequestPtr; -typedef std::shared_ptr RequestControllerSPtr; +typedef std::shared_ptr RequestControllerSPtr; namespace { const size_t kNumberOfRequests = 10u; @@ -103,8 +108,8 @@ class RequestControllerTestClass : public ::testing::Test { RequestControllerTestClass() { ON_CALL(mock_request_controller_settings_, thread_pool_size()) .WillByDefault(Return(kThreadPoolSize)); - request_ctrl_ = - std::make_shared(mock_request_controller_settings_); + request_ctrl_ = std::make_shared( + mock_request_controller_settings_, mock_request_timeout_handler_); } RequestPtr GetMockRequest( @@ -126,10 +131,10 @@ class RequestControllerTestClass : public ::testing::Test { const mobile_apis::HMILevel::eType& hmi_level = mobile_apis::HMILevel::INVALID_ENUM) { if (RequestInfo::RequestType::HMIRequest == request_type) { - return request_ctrl_->addHMIRequest(request); + return request_ctrl_->AddHMIRequest(request); } CallSettings(settings); - return request_ctrl_->addMobileRequest(request, hmi_level); + return request_ctrl_->AddMobileRequest(request, hmi_level); } void CallSettings(const TestSettings& settings) const { @@ -154,6 +159,7 @@ class RequestControllerTestClass : public ::testing::Test { NiceMock mock_request_controller_settings_; + MockRequestTimeoutHandler mock_request_timeout_handler_; RequestControllerSPtr request_ctrl_; RequestPtr empty_mock_request_; const TestSettings default_settings_; @@ -169,7 +175,7 @@ TEST_F(RequestControllerTestClass, .Times(1) .WillRepeatedly(NotifyTestAsyncWaiter(waiter_valid)); - EXPECT_EQ(RequestController::SUCCESS, + EXPECT_EQ(RequestController::TResult::SUCCESS, AddRequest(default_settings_, request_valid, RequestInfo::RequestType::MobileRequest, @@ -185,7 +191,7 @@ TEST_F(RequestControllerTestClass, ON_CALL(*request_dup_corr_id, Run()) .WillByDefault(NotifyTestAsyncWaiter(waiter_dup)); - EXPECT_EQ(RequestController::SUCCESS, + EXPECT_EQ(RequestController::TResult::SUCCESS, AddRequest(default_settings_, request_dup_corr_id, RequestInfo::RequestType::MobileRequest, @@ -200,7 +206,7 @@ TEST_F(RequestControllerTestClass, // app_hmi_level_none_time_scale_max_requests_ equals 0 // (in the default settings they setted to 0) for (size_t i = 0; i < kMaxRequestAmount; ++i) { - EXPECT_EQ(RequestController::SUCCESS, + EXPECT_EQ(RequestController::TResult::SUCCESS, AddRequest(default_settings_, GetMockRequest(i), RequestInfo::RequestType::MobileRequest, @@ -247,7 +253,7 @@ TEST_F(RequestControllerTestClass, IsLowVoltage_SetOnWakeUp_FALSE) { } TEST_F(RequestControllerTestClass, AddMobileRequest_SetValidData_SUCCESS) { - EXPECT_EQ(RequestController::SUCCESS, + EXPECT_EQ(RequestController::TResult::SUCCESS, AddRequest(default_settings_, GetMockRequest(), RequestInfo::RequestType::MobileRequest, @@ -256,7 +262,7 @@ TEST_F(RequestControllerTestClass, AddMobileRequest_SetValidData_SUCCESS) { TEST_F(RequestControllerTestClass, AddMobileRequest_SetInvalidData_INVALID_DATA) { - EXPECT_EQ(RequestController::INVALID_DATA, + EXPECT_EQ(RequestController::TResult::INVALID_DATA, AddRequest(default_settings_, empty_mock_request_, RequestInfo::RequestType::MobileRequest, @@ -264,14 +270,14 @@ TEST_F(RequestControllerTestClass, } TEST_F(RequestControllerTestClass, AddHMIRequest_AddRequest_SUCCESS) { - EXPECT_EQ(RequestController::SUCCESS, + EXPECT_EQ(RequestController::TResult::SUCCESS, AddRequest(default_settings_, GetMockRequest(), RequestInfo::RequestType::HMIRequest)); } TEST_F(RequestControllerTestClass, AddHMIRequest_AddInvalidData_INVALID_DATA) { - EXPECT_EQ(RequestController::INVALID_DATA, + EXPECT_EQ(RequestController::TResult::INVALID_DATA, AddRequest(default_settings_, empty_mock_request_, RequestInfo::RequestType::HMIRequest)); @@ -283,7 +289,7 @@ TEST_F(RequestControllerTestClass, OnTimer_SUCCESS) { kDefaultCorrelationID, kDefaultConnectionKey, request_timeout); auto waiter = TestAsyncWaiter::createInstance(); - EXPECT_EQ(RequestController::SUCCESS, + EXPECT_EQ(RequestController::TResult::SUCCESS, AddRequest(default_settings_, mock_request, RequestInfo::RequestType::MobileRequest)); diff --git a/src/components/application_manager/test/request_timeout_handler_test.cc b/src/components/application_manager/test/request_timeout_handler_test.cc new file mode 100644 index 0000000000..c045a653aa --- /dev/null +++ b/src/components/application_manager/test/request_timeout_handler_test.cc @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2020, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/request_timeout_handler_impl.h" + +#include +#include + +#include "gtest/gtest.h" + +#include "application_manager/commands/command_request_test.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/mock_message_helper.h" +#include "application_manager/mock_request_controller.h" +#include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/request_info.h" +#include "sdl_rpc_plugin/commands/hmi/on_reset_timeout_notification.h" +#include "sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h" +#include "sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h" + +namespace test { +namespace components { +namespace request_timeout_handler_test { + +using application_manager::event_engine::Event; +using ::testing::_; +using ::testing::Mock; +using ::testing::Return; +using ::testing::ReturnRef; +using namespace application_manager::commands; +using namespace application_manager::strings; +using namespace application_manager::request_controller; +using application_manager_test::MockRequestController; +using sdl_rpc_plugin::commands::SubscribeWayPointsRequest; +using sdl_rpc_plugin::commands::UnsubscribeWayPointsRequest; + +namespace { +const uint32_t kDefaultTimeout = 10000u; +const uint32_t kDefaultTimeoutCompensation = 1000u; +const uint32_t kTimeout = 13000u; +const uint32_t kRequestId = 22; +const std::string kMethodNameSubscribeWayPoints = + "Navigation.SubscribeWayPoints"; +const std::string kMethodNameUnsubscribeWayPoints = + "Navigation.UnsubscribeWayPoints"; +const uint32_t kConnectionKey = 3u; +} // namespace + +class RequestTimeoutHandlerTest + : public commands_test::CommandRequestTest< + commands_test::CommandsTestMocks::kIsNice> { + public: + RequestTimeoutHandlerTest() + : mock_message_helper_( + application_manager::MockMessageHelper::message_helper_mock()) {} + + protected: + void SetUp() OVERRIDE { + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + ON_CALL(app_mngr_, get_request_controller()) + .WillByDefault(ReturnRef(mock_request_controller_)); + request_timeout_handler_ = + std::make_shared(app_mngr_); + Mock::VerifyAndClearExpectations(&mock_message_helper_); + } + + void TearDown() OVERRIDE { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + } + + template + std::unique_ptr CreateCommand() { + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, default_timeout()) + .WillByDefault(ReturnRef(kDefaultTimeout)); + ON_CALL(app_mngr_settings_, default_timeout_compensation()) + .WillByDefault(ReturnRef(kDefaultTimeoutCompensation)); + + std::shared_ptr msg = + std::make_shared( + smart_objects::SmartType_Null); + + std::unique_ptr command(new Command(msg, + app_mngr_, + mock_rpc_service_, + mock_hmi_capabilities_, + mock_policy_handler_)); + return command; + } + + application_manager::MockMessageHelper* mock_message_helper_; + MockRequestController mock_request_controller_; + std::shared_ptr request_timeout_handler_; + testing::NiceMock + mock_hmi_capabilities_; + policy_test::MockPolicyHandlerInterface mock_policy_handler_; +}; + +TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_SUCCESS) { + // RequestTimeoutHandler works with all the commands. + // But just for testing, only SubscribeWayPointsRequest was chosen in current + // test. + std::unique_ptr command = + CreateCommand(); + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app))) + .WillByDefault(Return(false)); + ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints()) + .WillByDefault(Return(false)); + ON_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillByDefault(Return(kRequestId)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + + Event event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout); + smart_objects::SmartObject notification_msg; + notification_msg[msg_params][reset_period] = kTimeout; + notification_msg[msg_params][request_id] = kRequestId; + notification_msg[msg_params][method_name] = kMethodNameSubscribeWayPoints; + event.set_smart_object(notification_msg); + + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, default_timeout()) + .WillByDefault(ReturnRef(kDefaultTimeout)); + ON_CALL(app_mngr_settings_, default_timeout_compensation()) + .WillByDefault(ReturnRef(kDefaultTimeoutCompensation)); + + EXPECT_CALL(app_mngr_, get_request_timeout_handler()) + .WillOnce(ReturnRef(*request_timeout_handler_)); + + EXPECT_CALL(app_mngr_, + UpdateRequestTimeout(mock_app->app_id(), + command->correlation_id(), + kTimeout + kDefaultTimeoutCompensation)); + EXPECT_CALL(app_mngr_, + UpdateRequestTimeout(RequestInfo::kHmiConnectionKey, + kRequestId, + kTimeout + kDefaultTimeoutCompensation)); + + ASSERT_TRUE(command->Init()); + command->Run(); + request_timeout_handler_->on_event(event); +} + +TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_MissedResetPeriod) { + // RequestTimeoutHandler works with all the commands. + // But just for testing, only SubscribeWayPointsRequest was chosen in current + // test. + + std::unique_ptr command = + CreateCommand(); + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app))) + .WillByDefault(Return(false)); + ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints()) + .WillByDefault(Return(false)); + ON_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillByDefault(Return(kRequestId)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + + Event event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout); + smart_objects::SmartObject notification_msg; + notification_msg[msg_params][request_id] = kRequestId; + notification_msg[msg_params][method_name] = kMethodNameSubscribeWayPoints; + event.set_smart_object(notification_msg); + + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, default_timeout()) + .WillByDefault(ReturnRef(kDefaultTimeout)); + ON_CALL(app_mngr_settings_, default_timeout_compensation()) + .WillByDefault(ReturnRef(kDefaultTimeoutCompensation)); + + EXPECT_CALL(app_mngr_, get_request_timeout_handler()) + .WillOnce(ReturnRef(*request_timeout_handler_)); + EXPECT_CALL( + app_mngr_, + UpdateRequestTimeout(mock_app->app_id(), + command->correlation_id(), + kDefaultTimeout + kDefaultTimeoutCompensation)); + EXPECT_CALL( + app_mngr_, + UpdateRequestTimeout(RequestInfo::kHmiConnectionKey, + kRequestId, + kDefaultTimeout + kDefaultTimeoutCompensation)); + + ASSERT_TRUE(command->Init()); + command->Run(); + request_timeout_handler_->on_event(event); +} + +TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidRequestId) { + // RequestTimeoutHandler works with all the commands. + // But just for testing, only SubscribeWayPointsRequest was chosen in + // current test. + std::unique_ptr command = + CreateCommand(); + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app))) + .WillByDefault(Return(false)); + ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints()) + .WillByDefault(Return(false)); + ON_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillByDefault(Return(kRequestId)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + + Event event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout); + smart_objects::SmartObject notification_msg; + notification_msg[msg_params][reset_period] = kTimeout; + notification_msg[msg_params][method_name] = kMethodNameSubscribeWayPoints; + notification_msg[msg_params][request_id] = 0u; + event.set_smart_object(notification_msg); + + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, default_timeout()) + .WillByDefault(ReturnRef(kDefaultTimeout)); + ON_CALL(app_mngr_settings_, default_timeout_compensation()) + .WillByDefault(ReturnRef(kDefaultTimeoutCompensation)); + + EXPECT_CALL(app_mngr_, get_request_timeout_handler()) + .WillOnce(ReturnRef(*request_timeout_handler_)); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); + + ASSERT_TRUE(command->Init()); + command->Run(); + request_timeout_handler_->on_event(event); +} + +TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidMethodName) { + // RequestTimeoutHandler works with all the commands. + // But just for testing, only SubscribeWayPointsRequest was chosen in + // current test. + std::unique_ptr command = + CreateCommand(); + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(Ref(*mock_app))) + .WillByDefault(Return(false)); + ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints()) + .WillByDefault(Return(false)); + ON_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillByDefault(Return(kRequestId)); + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + + Event event(hmi_apis::FunctionID::BasicCommunication_OnResetTimeout); + smart_objects::SmartObject notification_msg; + notification_msg[msg_params][reset_period] = kTimeout; + notification_msg[msg_params][method_name] = " "; + notification_msg[msg_params][request_id] = kRequestId; + event.set_smart_object(notification_msg); + + ON_CALL(app_mngr_, get_settings()) + .WillByDefault(ReturnRef(app_mngr_settings_)); + ON_CALL(app_mngr_settings_, default_timeout()) + .WillByDefault(ReturnRef(kDefaultTimeout)); + ON_CALL(app_mngr_settings_, default_timeout_compensation()) + .WillByDefault(ReturnRef(kDefaultTimeoutCompensation)); + + EXPECT_CALL(app_mngr_, get_request_timeout_handler()) + .WillOnce(ReturnRef(*request_timeout_handler_)); + EXPECT_CALL(app_mngr_, UpdateRequestTimeout(_, _, _)).Times(0); + + ASSERT_TRUE(command->Init()); + command->Run(); + request_timeout_handler_->on_event(event); +} +} // namespace request_timeout_handler_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/rpc_service_impl_test.cc b/src/components/application_manager/test/rpc_service_impl_test.cc index 0a7cff031d..76f1f05342 100644 --- a/src/components/application_manager/test/rpc_service_impl_test.cc +++ b/src/components/application_manager/test/rpc_service_impl_test.cc @@ -46,11 +46,13 @@ #include "application_manager/mock_message_helper.h" #include "application_manager/mock_request.h" #include "application_manager/mock_request_controller_settings.h" +#include "application_manager/mock_request_timeout_handler.h" #include "application_manager/mock_rpc_plugin.h" #include "application_manager/mock_rpc_plugin_manager.h" #include "application_manager/mock_rpc_protection_manager.h" #include "application_manager/plugin_manager/plugin_keys.h" #include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/request_controller_impl.h" #include "connection_handler/mock_connection_handler.h" #include "hmi_message_handler/mock_hmi_message_handler.h" #include "include/test/protocol_handler/mock_protocol_handler.h" @@ -66,6 +68,7 @@ using test::components::protocol_handler_test::MockProtocolHandler; typedef smart_objects::SmartObjectSPtr MessageSharedPtr; typedef utils::Optional PluginOpt; using test::components::application_manager_test::MockAppServiceManager; +using test::components::application_manager_test::MockRequestTimeoutHandler; using ::testing::_; using ::testing::NiceMock; using ::testing::Return; @@ -86,7 +89,8 @@ const int32_t kConnectionSessionsCount = 2; class RPCServiceImplTest : public ::testing::Test { public: RPCServiceImplTest() - : request_controller_(mock_request_controler_) + : request_controller_(mock_request_controler_, + mock_request_timeout_handler_) , mock_rpc_protection_manager_( std::make_shared< testing::NiceMock >()) @@ -145,7 +149,7 @@ class RPCServiceImplTest : public ::testing::Test { testing::NiceMock mock_app_mngr_; testing::NiceMock mock_request_controler_; testing::NiceMock mock_protocol_handler_; - am::request_controller::RequestController request_controller_; + am::request_controller::RequestControllerImpl request_controller_; testing::NiceMock mock_hmi_handler_; testing::NiceMock mock_command_holder_; std::shared_ptr mock_rpc_protection_manager_; @@ -157,6 +161,7 @@ class RPCServiceImplTest : public ::testing::Test { mock_rpc_plugin_manager_; testing::NiceMock mock_rpc_plugin_; testing::NiceMock mock_command_factory_; + MockRequestTimeoutHandler mock_request_timeout_handler_; }; TEST_F(RPCServiceImplTest, ManageMobileCommand_MessageIsNullPtr_False) { diff --git a/src/components/application_manager/test/zero_request_amount_test.cc b/src/components/application_manager/test/zero_request_amount_test.cc index 0166c036c1..4f943176c0 100644 --- a/src/components/application_manager/test/zero_request_amount_test.cc +++ b/src/components/application_manager/test/zero_request_amount_test.cc @@ -99,19 +99,19 @@ TEST(RequestControlTest, ZeroValuePendingRequestsAmount) { RequestController request_ctrl_; commands::Command* reg = RegisterApplication(); - request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL); + request_ctrl_.AddMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL); for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) { correlation_id = i; commands::Command* testCommand = PutFileCommand(correlation_id, connection_key); - result = request_ctrl_.addMobileRequest(testCommand, + result = request_ctrl_.AddMobileRequest(testCommand, mobile_apis::HMILevel::HMI_FULL); EXPECT_EQ(RequestController::SUCCESS, result); } commands::Command* unreg = UnregisterApplication(); - request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL); + request_ctrl_.AddMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL); } TEST(RequestControlTest, ZeroValueAppRequestsTimeScale) { @@ -124,19 +124,19 @@ TEST(RequestControlTest, ZeroValueAppRequestsTimeScale) { RequestController request_ctrl_; commands::Command* reg = RegisterApplication(); - request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL); + request_ctrl_.AddMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL); for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) { correlation_id = i; commands::Command* testCommand = PutFileCommand(correlation_id, connection_key); - result = request_ctrl_.addMobileRequest(testCommand, + result = request_ctrl_.AddMobileRequest(testCommand, mobile_apis::HMILevel::HMI_FULL); EXPECT_EQ(RequestController::SUCCESS, result); } commands::Command* unreg = UnregisterApplication(); - request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL); + request_ctrl_.AddMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL); } TEST(RequestControlTest, ZeroValueAppTimeScaleMaxRequests) { @@ -149,19 +149,19 @@ TEST(RequestControlTest, ZeroValueAppTimeScaleMaxRequests) { RequestController request_ctrl_; commands::Command* reg = RegisterApplication(); - request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL); + request_ctrl_.AddMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL); for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) { correlation_id = i; commands::Command* testCommand = PutFileCommand(correlation_id, connection_key); - result = request_ctrl_.addMobileRequest(testCommand, + result = request_ctrl_.AddMobileRequest(testCommand, mobile_apis::HMILevel::HMI_FULL); EXPECT_EQ(RequestController::SUCCESS, result); } commands::Command* unreg = UnregisterApplication(); - request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL); + request_ctrl_.AddMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL); } } // namespace application_manager_test diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index 48ffd30ff3..bb7762721f 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -249,6 +249,12 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, */ const uint32_t& default_timeout() const; + /** + * @brief Default timeout compensation for waiting some extra time for + * response to mobile app + */ + const uint32_t& default_timeout_compensation() const; + /** * @brief Default timeout for waiting for resuming */ @@ -1012,6 +1018,7 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, bool is_redecoding_enabled_; uint32_t max_cmd_id_; uint32_t default_timeout_; + uint32_t default_timeout_compensation_; uint32_t app_resuming_timeout_; uint32_t app_resumption_save_persistent_data_timeout_; std::string vr_help_title_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index c12deb44c8..ad624a22a9 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -181,6 +181,7 @@ const char* kDeleteFileRequestKey = "DeleteFileRequest"; const char* kListFilesRequestKey = "ListFilesRequest"; const char* kListFilesResponseSizeKey = "ListFilesResponseSize"; const char* kDefaultTimeoutKey = "DefaultTimeout"; +const char* kDefaultTimeoutCompensationKey = "DefaultTimeoutCompensation"; const char* kAppResumingTimeoutKey = "ApplicationResumingTimeout"; const char* kAppSavePersistentDataTimeoutKey = "AppSavePersistentDataTimeout"; const char* kResumptionDelayBeforeIgnKey = "ResumptionDelayBeforeIgn"; @@ -359,6 +360,7 @@ const uint32_t kDefaultPutFileRequestInNone = 5; const uint32_t kDefaultDeleteFileRequestInNone = 5; const uint32_t kDefaultListFilesRequestInNone = 5; const uint32_t kDefaultTimeout = 10000; +const uint32_t kDefaultTimeoutCompensation = 1000; const uint32_t kDefaultAppResumingTimeout = 3000; const uint32_t kDefaultAppSavePersistentDataTimeout = 10000; const uint32_t kDefaultResumptionDelayBeforeIgn = 30; @@ -482,6 +484,7 @@ Profile::Profile() , is_redecoding_enabled_(false) , max_cmd_id_(kDefaultMaxCmdId) , default_timeout_(kDefaultTimeout) + , default_timeout_compensation_(kDefaultTimeoutCompensation) , app_resuming_timeout_(kDefaultAppResumingTimeout) , app_resumption_save_persistent_data_timeout_( kDefaultAppSavePersistentDataTimeout) @@ -685,6 +688,10 @@ const uint32_t& Profile::default_timeout() const { return default_timeout_; } +const uint32_t& Profile::default_timeout_compensation() const { + return default_timeout_compensation_; +} + const uint32_t& Profile::app_resuming_timeout() const { return app_resuming_timeout_; } @@ -1725,6 +1732,16 @@ void Profile::UpdateValues() { LOG_UPDATED_VALUE(default_timeout_, kDefaultTimeoutKey, kMainSection); + // Default timeout compensation + ReadUIntValue(&default_timeout_compensation_, + kDefaultTimeoutCompensation, + kMainSection, + kDefaultTimeoutCompensationKey); + + LOG_UPDATED_VALUE(default_timeout_compensation_, + kDefaultTimeoutCompensationKey, + kMainSection); + // Application resuming timeout ReadUIntValue(&app_resuming_timeout_, kDefaultAppResumingTimeout, diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index ef4da3e2d8..708bf8b048 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -48,6 +48,8 @@ #include "application_manager/application_manager_settings.h" #include "application_manager/hmi_interfaces.h" #include "application_manager/plugin_manager/rpc_plugin_manager.h" +#include "application_manager/request_controller.h" +#include "application_manager/request_timeout_handler.h" #include "application_manager/state_controller.h" #include "policy/policy_types.h" @@ -87,7 +89,10 @@ class RPCService; namespace rpc_handler { class RPCHandler; } - +namespace request_controller { +class RequestTimeoutHandler; +class RequestController; +} // namespace request_controller class Application; class AppServiceManager; class StateControllerImpl; @@ -495,6 +500,10 @@ class ApplicationManager { virtual rpc_service::RPCService& GetRPCService() const = 0; virtual rpc_handler::RPCHandler& GetRPCHandler() const = 0; + virtual request_controller::RequestTimeoutHandler& + get_request_timeout_handler() const = 0; + virtual request_controller::RequestController& get_request_controller() + const = 0; virtual bool is_stopping() const = 0; virtual bool is_audio_pass_thru_active() const = 0; @@ -717,7 +726,7 @@ class ApplicationManager { * @param mobile_correlation_id Correlation ID of the mobile request * @param new_timeout_value New timeout in milliseconds to be set */ - virtual void updateRequestTimeout(uint32_t connection_key, + virtual void UpdateRequestTimeout(uint32_t connection_key, uint32_t mobile_correlation_id, uint32_t new_timeout_value) = 0; diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h index 02cd79aa8e..c7ab634ad0 100644 --- a/src/components/include/application_manager/application_manager_settings.h +++ b/src/components/include/application_manager/application_manager_settings.h @@ -63,6 +63,7 @@ class ApplicationManagerSettings : public RequestControlerSettings, virtual uint16_t tts_global_properties_timeout() const = 0; virtual uint16_t max_supported_protocol_version() const = 0; virtual const uint32_t& default_timeout() const = 0; + virtual const uint32_t& default_timeout_compensation() const = 0; virtual const uint32_t& max_cmd_id() const = 0; virtual bool launch_hmi() const = 0; virtual const uint32_t& delete_file_in_none() const = 0; diff --git a/src/components/include/application_manager/request_controller.h b/src/components/include/application_manager/request_controller.h new file mode 100644 index 0000000000..287493926b --- /dev/null +++ b/src/components/include/application_manager/request_controller.h @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2020, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_ +#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_ + +#include "application_manager/commands/command.h" + +#include + +namespace application_manager { +namespace request_controller { + +typedef std::shared_ptr RequestPtr; +/** + * @brief RequestController class is used to control currently active mobile + * requests. + */ +class RequestController { + public: + /** + * @brief Result code for addRequest + */ + enum class TResult { + SUCCESS = 0, + TOO_MANY_REQUESTS, + TOO_MANY_PENDING_REQUESTS, + NONE_HMI_LEVEL_MANY_REQUESTS, + INVALID_DATA + }; + + /** + * @brief Thread pool state + */ + enum class TPoolState { + UNDEFINED = 0, + STARTED, + STOPPED, + }; + + /** + * @brief Class destructor + */ + virtual ~RequestController() {} + + /** + * @brief Stop request controller internal activities + */ + virtual void Stop() = 0; + + /** + * @brief Initialize thread pool + */ + virtual void InitializeThreadpool() = 0; + + /** + * @brief Destroy thread pool + */ + virtual void DestroyThreadpool() = 0; + + /** + * @brief Check if max request amount wasn't exceed and adds request to queue. + * @param request Active request to mobile + * @param hmi_level Current application hmi_level + * @return Result code + */ + virtual TResult AddMobileRequest( + const RequestPtr request, + const mobile_apis::HMILevel::eType& hmi_level) = 0; + + /** + * @brief Store HMI request until response or timeout won't remove it + * @param request Active request to hmi + * @return Result code + */ + virtual TResult AddHMIRequest(const RequestPtr request) = 0; + + /** + * @brief Add notification to collection + * @param ptr Reference to shared pointer that point on hmi notification + */ + virtual void AddNotification(const RequestPtr ptr) = 0; + + /** + * @brief Removes request from queue + * @param correlation_id Active request correlation ID, + * @param connection_key Active request connection key (0 for HMI requests) + * @param function_id Active request function id + * @param force_terminate if true, request controller will terminate + * even if not allowed by request + */ + virtual void TerminateRequest(const uint32_t correlation_id, + const uint32_t connection_key, + const int32_t function_id, + const bool force_terminate = false) = 0; + + /** + * @brief Removes request from queue + * @param mobile_correlation_id Active mobile request correlation ID + * @param connection_key Active request connection key (0 for HMI requests) + * @param function_id Active request function ID + */ + virtual void OnMobileResponse(const uint32_t mobile_correlation_id, + const uint32_t connection_key, + const int32_t function_id) = 0; + + /** + * @brief Removes request from queue + * @param mobile_correlation_id Active mobile request correlation ID + * @param function_id Active request function ID + */ + virtual void OnHMIResponse(const uint32_t correlation_id, + const int32_t function_id) = 0; + + /** + * @ Add notification to collection + * @param notification Pointer that points to hmi notification + */ + virtual void RemoveNotification(const commands::Command* notification) = 0; + + /** + * @brief Removes all requests from queue for specified application + * @param app_id Mobile application ID (app_id) + */ + virtual void TerminateAppRequests(const uint32_t app_id) = 0; + + /** + * @brief Terminates all requests from HMI + */ + virtual void TerminateAllHMIRequests() = 0; + + /** + * @brief Terminates all requests from Mobile + */ + virtual void TerminateAllMobileRequests() = 0; + + /** + * @brief Updates request timeout + * @param app_id Connection key of application + * @param mobile_correlation_id Correlation ID of the mobile request + * @param new_timeout_value New timeout to be set in milliseconds + */ + virtual void UpdateRequestTimeout(const uint32_t app_id, + const uint32_t mobile_correlation_id, + const uint32_t new_timeout) = 0; + /** + * @brief Function Should be called when Low Voltage is occured + */ + virtual void OnLowVoltage() = 0; + + /** + * @brief Function Should be called when WakeUp occures after Low Voltage + */ + virtual void OnWakeUp() = 0; + + /** + * @return true if low voltage state is active + */ + virtual bool IsLowVoltage() = 0; +}; + +} // namespace request_controller +} // namespace application_manager + +#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_H_ diff --git a/src/components/include/application_manager/request_timeout_handler.h b/src/components/include/application_manager/request_timeout_handler.h new file mode 100644 index 0000000000..ef646d8a94 --- /dev/null +++ b/src/components/include/application_manager/request_timeout_handler.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2020, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_H_ +#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_H_ + +#include + +namespace application_manager { +namespace request_controller { + +/* + * @brief Structure for active mobile request + * that is waiting for a response from the HMI. + * Used for OnResetTimeout logic. + */ +struct Request { + Request(const uint32_t mob_correlation_id, + const uint32_t connection_key, + const uint32_t hmi_function_id) + : mob_correlation_id_(mob_correlation_id) + , connection_key_(connection_key) + , hmi_function_id_(hmi_function_id) {} + + uint32_t mob_correlation_id_; + uint32_t connection_key_; + uint32_t hmi_function_id_; +}; + +/** + * @brief The RequestTimeoutHandler class + * handles OnResetTimeout notification from HMI, + * reset timeout for mobile request + */ +class RequestTimeoutHandler { + public: + /** + * @brief AddRequest adds request that waits for response + * @param hmi_correlation_id hmi correlation id + * @param request active mobile request + */ + virtual void AddRequest(const uint32_t hmi_correlation_id, + const Request& request) = 0; + /** + * @brief RemoveRequest removes processed request + * @param hmi_correlation_id hmi correlation id + */ + virtual void RemoveRequest(const uint32_t hmi_correlation_id) = 0; + + virtual ~RequestTimeoutHandler() {} +}; + +} // namespace request_controller +} // namespace application_manager + +#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_TIMEOUT_HANDLER_H_ diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 50fb168411..525197cb49 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -188,6 +188,12 @@ class MockApplicationManager : public application_manager::ApplicationManager { application_manager::rpc_service::RPCService&()); MOCK_CONST_METHOD0(GetRPCHandler, application_manager::rpc_handler::RPCHandler&()); + MOCK_CONST_METHOD0( + get_request_timeout_handler, + application_manager::request_controller::RequestTimeoutHandler&()); + MOCK_CONST_METHOD0( + get_request_controller, + application_manager::request_controller::RequestController&()); MOCK_CONST_METHOD0(is_stopping, bool()); MOCK_CONST_METHOD0(is_audio_pass_thru_active, bool()); MOCK_METHOD0(GetNextHMICorrelationID, uint32_t()); @@ -262,7 +268,7 @@ class MockApplicationManager : public application_manager::ApplicationManager { void(const connection_handler::DeviceHandle)); MOCK_METHOD4(UnregisterApplication, void(const uint32_t&, mobile_apis::Result::eType, bool, bool)); - MOCK_METHOD3(updateRequestTimeout, + MOCK_METHOD3(UpdateRequestTimeout, void(uint32_t connection_key, uint32_t mobile_correlation_id, uint32_t new_timeout_value)); diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h index 9a70a374a7..b30fc09830 100644 --- a/src/components/include/test/application_manager/mock_application_manager_settings.h +++ b/src/components/include/test/application_manager/mock_application_manager_settings.h @@ -70,6 +70,7 @@ class MockApplicationManagerSettings MOCK_CONST_METHOD0(tts_global_properties_timeout, uint16_t()); MOCK_CONST_METHOD0(max_supported_protocol_version, uint16_t()); MOCK_CONST_METHOD0(default_timeout, const uint32_t&()); + MOCK_CONST_METHOD0(default_timeout_compensation, const uint32_t&()); MOCK_CONST_METHOD0(max_cmd_id, const uint32_t&()); MOCK_CONST_METHOD0(launch_hmi, bool()); MOCK_CONST_METHOD0(delete_file_in_none, const uint32_t&()); diff --git a/src/components/include/test/application_manager/mock_request_controller.h b/src/components/include/test/application_manager/mock_request_controller.h new file mode 100644 index 0000000000..5ed726b301 --- /dev/null +++ b/src/components/include/test/application_manager/mock_request_controller.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2020, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_CONTROLLER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_CONTROLLER_H_ + +#include "application_manager/request_controller.h" + +namespace test { +namespace components { +namespace application_manager_test { + +class MockRequestController + : public application_manager::request_controller::RequestController { + public: + MOCK_METHOD0(Stop, void()); + MOCK_METHOD0(InitializeThreadpool, void()); + MOCK_METHOD0(DestroyThreadpool, void()); + MOCK_METHOD2( + AddMobileRequest, + TResult(const application_manager::request_controller::RequestPtr request, + const mobile_apis::HMILevel::eType& hmi_level)); + MOCK_METHOD1(AddHMIRequest, + TResult(const application_manager::request_controller::RequestPtr + request)); + MOCK_METHOD1( + AddNotification, + void(const application_manager::request_controller::RequestPtr request)); + MOCK_METHOD4(TerminateRequest, + void(const uint32_t correlation_id, + const uint32_t connection_key, + const int32_t function_id, + bool force_terminate)); + MOCK_METHOD3(OnMobileResponse, + void(const uint32_t mobile_correlation_id, + const uint32_t connection_key, + const int32_t function_id)); + MOCK_METHOD2(OnHMIResponse, + void(const uint32_t correlation_id, const int32_t function_id)); + MOCK_METHOD1( + RemoveNotification, + void(const application_manager::commands::Command* notification)); + MOCK_METHOD1(TerminateAppRequests, void(const uint32_t app_id)); + MOCK_METHOD0(TerminateAllHMIRequests, void()); + MOCK_METHOD0(TerminateAllMobileRequests, void()); + MOCK_METHOD3(UpdateRequestTimeout, + void(const uint32_t app_id, + const uint32_t mobile_correlation_id, + const uint32_t new_timeout)); + MOCK_METHOD0(OnLowVoltage, void()); + MOCK_METHOD0(OnWakeUp, void()); + MOCK_METHOD0(IsLowVoltage, bool()); +}; +} // namespace application_manager_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_CONTROLLER_H_ diff --git a/src/components/include/test/application_manager/mock_request_timeout_handler.h b/src/components/include/test/application_manager/mock_request_timeout_handler.h new file mode 100644 index 0000000000..b1492a9812 --- /dev/null +++ b/src/components/include/test/application_manager/mock_request_timeout_handler.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_TIMEOUT_HANDLER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_TIMEOUT_HANDLER_H_ + +#include "application_manager/request_timeout_handler.h" +#include "gmock/gmock.h" + +namespace test { +namespace components { +namespace application_manager_test { + +class MockRequestTimeoutHandler + : public application_manager::request_controller::RequestTimeoutHandler { + public: + MOCK_METHOD2( + AddRequest, + void(const uint32_t hmi_correlation_id, + const application_manager::request_controller::Request& request)); + MOCK_METHOD1(RemoveRequest, void(const uint32_t hmi_correlation_id)); +}; + +} // namespace application_manager_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_REQUEST_TIMEOUT_HANDLER_H_ diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index b185b88ada..9b09f239fe 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -4783,6 +4783,27 @@ + + + HMI must send this notification to SDL for method instance for which timeout needs to be reset + + + + Id between HMI and SDL which SDL used to send the request for method in question, for which timeout needs to be reset. + + + + + Name of the function for which timeout needs to be reset + + + + + Timeout period in milliseconds, for the method for which timeout needs to be reset. + If omitted, timeout would be reset by defaultTimeout specified in smartDeviceLink.ini + + + @@ -5317,18 +5338,6 @@ - - - Sender: HMI->SDL. HMI must send this notification every 10 sec. in case the 'methodName' - results long processing on HMI - - - Id of application that concerns the 'methodName'. - - - The name of the method, the renew of timeout is required for - - @@ -6028,15 +6037,6 @@ Provides the result of operation. - - HMI must provide SDL with notifications specific to the current Turn-By-Turn client status on the module - - Id of application that invoked notifcation. - - - Currently used method name on which was triggered action - - Issued by SDL to notify HMI about capturing mic data should be started diff --git a/tools/rpc_spec b/tools/rpc_spec index 44f0a419c6..12c2d1dacc 160000 --- a/tools/rpc_spec +++ b/tools/rpc_spec @@ -1 +1 @@ -Subproject commit 44f0a419c6a43815bc095134712eab4fef352ad7 +Subproject commit 12c2d1dacc4315be22bbc1f5e655f4464d9fae44 -- cgit v1.2.1 From 036b1851c93bb89375e82786e4a7bd1b3848b89c Mon Sep 17 00:00:00 2001 From: collin Date: Thu, 12 Aug 2021 14:25:51 -0400 Subject: Squashed commit of the following: commit ce9fc4455093d4914dfec55a6e5003da3c28fc83 Author: Andrii Kalinich Date: Thu Aug 5 18:50:33 2021 -0400 Update CUSTOM_BUTTON logic commit 237562b555dc78322f6c6dd5b9c83ded0226998d Author: Andrii Kalinich Date: Thu Aug 5 09:10:59 2021 -0400 fixup! Address Livio comments commit 16142947000f2ed54279306468a6c4cb1594805f Author: Andrii Kalinich Date: Wed Aug 4 17:17:17 2021 -0400 Address Livio comments commit daa1060833441f38a7219d8a852c6d44e852e76e Author: Andrii Kalinich Date: Tue Jul 27 20:15:06 2021 -0400 Address Livio comments commit a327f0694db958a1925b6526e8d25ce9c86bd735 Author: Olha Vorobiova Date: Tue Jul 20 16:40:27 2021 +0300 Add unit tests for subscribe and unsubscribe button commit dce94e5d84698f5d85bddbc8b5324518d4c1f9f4 Merge: f78f0c82ea 82703c98bb Author: Andrii Kalinich (GitHub) Date: Fri Jul 16 19:12:45 2021 -0400 Merge pull request #206 from LuxoftSDL/impl/sdl_0192_fix_resumption_of_button_subscriptions Separate subscription processing logic for mobile requests and resumption commit 82703c98bb2b68c11bfc642bc976d7b29be416c8 Author: Andrii Kalinich Date: Fri Jul 16 15:07:15 2021 -0400 Return on_event() back to HMI subscription request commit f78f0c82ea495376298dae5efda25dde05a7ec7b Merge: 94c770b314 e7e1ebf3ce Author: Andrii Kalinich (GitHub) Date: Fri Jul 16 19:00:15 2021 -0400 Merge pull request #205 from LuxoftSDL/fix/sdl_0192_fix_custom_button_subscription_logic Fix CUSTOM_BUTTON subscription logic commit e7e1ebf3ce7b49139f3ddfb77046a642d049294e Author: Andrii Kalinich Date: Fri Jul 16 13:02:46 2021 -0400 Fix affected unit tests commit d156a9f0067a61b32323b1e0eae680e488780045 Author: Yana Chernysheva Date: Fri Jul 16 16:09:27 2021 +0300 Separate subscription processing for mobile requests and resumption commit 9e461d05d2843dedb4a3e3945d907d6e8a376311 Author: Andrii Kalinich Date: Fri Jul 16 01:31:05 2021 -0400 Fix CUSTOM_BUTTON subscription logic Was removed subscription to custom button by default. Also, added check if app is actually subscribed to CUSTOM_BUTTON like for all other buttons. commit 94c770b314659a33555d81bd47e4c76325c322eb Author: Yana Chernysheva Date: Wed Jul 14 15:32:40 2021 +0300 Revert expired button requests if response was received after timeout commit de6c7aac0650d6ac823cd3e6cc0ff4ff9d96eef9 Merge: 0343ea4e9f eaec9b47a5 Author: Yana Chernysheva Date: Thu Jul 15 15:23:10 2021 +0300 Merge branch 'develop' into feature/sdl_0192_button_subscription_response_from_hmi commit 0343ea4e9f2ef844aa096f76b85719f66eb6db36 Author: Yana Chernysheva Date: Mon Jul 5 14:46:21 2021 +0300 Add shared base class for mobile button notifications commit 3d7d670476634bf687271dd5a5ebc95b907cab05 Author: Yana Chernysheva Date: Fri Jul 9 16:13:21 2021 +0300 Unify approach to result codes processing commit e5dfa88fbddd3ec71c05e3e49f68379470e24233 Author: Yana Chernysheva Date: Thu Jul 8 11:40:13 2021 +0300 Remove OnButtonSubscription notification commit 06dc97859063cfc8a654365db3396a8752cb4f9b Author: Yana Chernysheva Date: Wed Jul 7 13:39:12 2021 +0300 Resume button subscriptions commit 4cf9954b46c0496356200ce0d2c4a96ace5e0b6d Author: Vadym Luchko (GitHub) <76956836+VadymLuchko@users.noreply.github.com> Date: Fri Jul 9 14:09:43 2021 +0300 unsubscribe buttons implementation (#197) commit 13045471a9de73b8a37d081efbbe31b1552aa159 Author: Yana Chernysheva Date: Wed Jun 30 17:16:30 2021 +0300 Add SubscribeButtonRequest and SubscribeButtonResponse classes --- .../include/application_manager/application.h | 3 + .../application_manager/application_manager_impl.h | 16 ++ .../commands/button_notification_to_mobile.h | 109 ++++++++++ .../application_manager/commands/command_impl.h | 27 +++ .../commands/command_request_impl.h | 18 -- .../commands/request_from_hmi.h | 6 - .../include/application_manager/message_helper.h | 76 +++---- .../resumption/resumption_data_processor_impl.h | 11 ++ .../as_get_app_service_data_request_from_hmi.cc | 7 +- ...orm_app_service_interaction_request_from_hmi.cc | 3 +- .../mobile/get_app_service_data_request.cc | 2 +- .../perform_app_service_interaction_request.cc | 2 +- .../hmi/on_button_subscription_notification.h | 83 -------- .../commands/hmi/subscribe_button_request.h | 87 ++++++++ .../commands/hmi/subscribe_button_response.h | 78 ++++++++ .../commands/hmi/unsubscribe_button_request.h | 75 +++++++ .../commands/hmi/unsubscribe_button_response.h | 69 +++++++ .../commands/mobile/on_button_event_notification.h | 12 +- .../commands/mobile/on_button_press_notification.h | 12 +- .../commands/mobile/subscribe_button_request.h | 12 +- .../commands/mobile/unsubscribe_button_request.h | 25 +-- .../hmi/on_button_subscription_notification.cc | 68 ------- .../src/commands/hmi/subscribe_button_request.cc | 164 +++++++++++++++ .../src/commands/hmi/subscribe_button_response.cc | 97 +++++++++ .../src/commands/hmi/unsubscribe_button_request.cc | 125 ++++++++++++ .../commands/hmi/unsubscribe_button_response.cc | 98 +++++++++ .../src/commands/mobile/create_window_request.cc | 3 +- .../delete_interaction_choice_set_request.cc | 2 +- .../src/commands/mobile/delete_window_request.cc | 3 +- .../mobile/on_button_event_notification.cc | 144 ++------------ .../mobile/on_button_press_notification.cc | 153 ++------------ .../mobile/register_app_interface_request.cc | 8 +- .../commands/mobile/subscribe_button_request.cc | 80 ++++++-- .../commands/mobile/unsubscribe_button_request.cc | 72 +++++-- .../sdl_rpc_plugin/src/hmi_command_factory.cc | 22 ++- .../test/commands/hmi/dummy_hmi_commands_test.cc | 12 +- .../test/commands/hmi/hmi_notifications_test.cc | 2 - .../commands/hmi/subscribe_button_request_test.cc | 213 ++++++++++++++++++++ .../commands/hmi/subscribe_button_response_test.cc | 145 ++++++++++++++ .../hmi/unsubscribe_button_request_test.cc | 180 +++++++++++++++++ .../hmi/unsubscribe_button_response_test.cc | 145 ++++++++++++++ .../mobile/on_button_notification_commands_test.cc | 50 ++++- .../mobile/register_app_interface_request_test.cc | 30 +-- .../mobile/subscribe_button_request_test.cc | 71 +++---- .../mobile/unsubscribe_button_request_test.cc | 27 --- .../application_manager/src/application_impl.cc | 3 +- .../src/application_manager_impl.cc | 37 ++++ .../src/commands/button_notification_to_mobile.cc | 219 +++++++++++++++++++++ .../src/commands/command_impl.cc | 38 ++++ .../src/commands/command_request_impl.cc | 42 +--- .../src/commands/request_from_hmi.cc | 37 ---- .../src/commands/request_to_hmi.cc | 34 +--- .../src/helpers/application_helper.cc | 14 +- .../application_manager/src/hmi_interfaces_impl.cc | 4 +- .../src/message_helper/message_helper.cc | 187 +++++++++--------- .../resumption/resumption_data_processor_impl.cc | 67 ++++--- .../test/application_helper_test.cc | 9 - .../test/application_impl_test.cc | 6 +- .../application_manager/mock_message_helper.h | 31 +-- .../test/mock_message_helper.cc | 39 ++-- .../test/resumption/resume_ctrl_test.cc | 14 +- .../application_manager/application_manager.h | 34 ++++ .../application_manager/mock_application_manager.h | 9 + src/components/interfaces/HMI_API.xml | 30 +-- 64 files changed, 2501 insertions(+), 1000 deletions(-) create mode 100644 src/components/application_manager/include/application_manager/commands/button_notification_to_mobile.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_response.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_response.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_response.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc create mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc create mode 100644 src/components/application_manager/src/commands/button_notification_to_mobile.cc diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index 2d7006e19a..86b26f24ef 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -46,6 +46,7 @@ #include "application_manager/hmi_state.h" #include "application_manager/message.h" #include "connection_handler/device.h" +#include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" #include "protocol_handler/protocol_handler.h" #include "smart_objects/smart_object.h" @@ -106,6 +107,8 @@ struct AppFile { mobile_apis::FileType::eType file_type; }; typedef std::map AppFilesMap; +typedef std::map + ButtonSubscriptionsMap; class InitialApplicationData { public: virtual ~InitialApplicationData() {} 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 09f2c7d4df..c64ae2bbd2 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 @@ -120,6 +120,9 @@ enum VRTTSSessionChanging { kVRSessionChanging = 0, kTTSSessionChanging }; typedef std::map > ServiceStreamingStatusMap; +typedef std::map + ExpiredButtonRequestsMap; + struct CommandParametersPermissions; typedef std::map DeviceTypes; @@ -1542,6 +1545,16 @@ class ApplicationManagerImpl static std::vector ConvertRejectedParamList( const std::vector& input); + void AddExpiredButtonRequest( + const uint32_t app_id, + const int32_t corr_id, + const hmi_apis::Common_ButtonName::eType button_name) OVERRIDE; + + utils::Optional GetExpiredButtonRequestData( + const int32_t corr_id) const OVERRIDE; + + void DeleteExpiredButtonRequest(const int32_t corr_id) OVERRIDE; + private: const ApplicationManagerSettings& settings_; /** @@ -1705,6 +1718,9 @@ class ApplicationManagerImpl ServiceStreamingStatusMap streaming_application_services_; sync_primitives::Lock streaming_services_lock_; + mutable sync_primitives::Lock expired_button_requests_lock_; + mutable ExpiredButtonRequestsMap expired_button_requests_; + #ifdef BUILD_TESTS public: /** diff --git a/src/components/application_manager/include/application_manager/commands/button_notification_to_mobile.h b/src/components/application_manager/include/application_manager/commands/button_notification_to_mobile.h new file mode 100644 index 0000000000..66a2683133 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/button_notification_to_mobile.h @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_BUTTON_NOTIFICATION_TO_MOBILE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_BUTTON_NOTIFICATION_TO_MOBILE_H_ + +#include "application_manager/application.h" +#include "command_notification_impl.h" +#include "interfaces/MOBILE_API.h" + +namespace application_manager { +namespace commands { +namespace app_mngr = application_manager; + +/** + * @brief Class is intended to encapsulate shared button notification logic in + * base class. Entities defined in this file do not conform to any version of + * HMI or mobile API, and exist only to remove duplication in OnButtonPress and + * OnButtonEvent notifications. + **/ +class ButtonNotificationToMobile + : public app_mngr::commands::CommandNotificationImpl { + public: + /** + * @brief ButtonNotificationToMobile class constructor + **/ + ButtonNotificationToMobile( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + + /** + * @brief ButtonNotificationToMobile class destructor + **/ + ~ButtonNotificationToMobile(); + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + protected: + virtual void SendButtonNotification(app_mngr::ApplicationSharedPtr app) = 0; + + /** + * @brief HandleCustomButton handle event for custom buttons + * @param app pointer to application data. + **/ + void HandleCustomButton(app_mngr::ApplicationSharedPtr app); + + /** + * @brief HandleOKButton handle event for OK button + * @param app pointer to application data. + **/ + void HandleOKButton(app_mngr::ApplicationSharedPtr app); + + /** + * @brief HandleMediaButton handle event for media buttons + * @param app pointer to application data. + **/ + void HandleMediaButton(app_mngr::ApplicationSharedPtr app); + + /** + * @brief DoesParamExist check whether param is exists in msg_params + * @param param_name name of parameter to find + **/ + bool DoesParamExist(const std::string& param_name) const; + + /** + * @brief SubscribedApps get subscribed apps for btn id received in message + * @return Return applications list subscribed to current button + **/ + std::vector SubscribedApps() const; +}; +} // namespace commands +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_BUTTON_NOTIFICATION_TO_MOBILE_H_ diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 1b4db7e888..6105f7c5d6 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -69,6 +69,23 @@ struct CommandParametersPermissions { }; namespace commands { + +/** + * @brief Checks Mobile result code for single RPC + * @param result_code contains result code from response to Mobile + * @return true if result code complies to successful result codes, + * false otherwise. + */ +bool IsMobileResultSuccess(const mobile_apis::Result::eType result_code); + +/** + * @brief Checks HMI result code for single RPC + * @param result_code contains result code from HMI response + * @return true if result code complies to successful result codes, + * false otherwise. + */ +bool IsHMIResultSuccess(const hmi_apis::Common_Result::eType result_code); + /** * @brief Class is intended to encapsulate RPC as an object **/ @@ -183,6 +200,16 @@ class CommandImpl : public Command { */ bool CheckSyntax(const std::string& str, bool allow_empty_line = false) const; + /** + * @brief Checks HMI result code for single RPC + * @param result_code contains result code from HMI response + * @param interface to check availability + * @return true if result code complies to successful result codes, + * false otherwise. + */ + bool IsHMIResultSuccess(hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const; + // members static const int32_t hmi_protocol_type_; static const int32_t mobile_protocol_type_; diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index 727863d16d..e2c95a085b 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -206,24 +206,6 @@ class CommandRequestImpl : public CommandImpl, mobile_apis::Result::eType GetMobileResultCode( const hmi_apis::Common_Result::eType& hmi_code) const; - /** - * @brief Checks Mobile result code for single RPC - * @param result_code contains result code from response to Mobile - * @return true if result code complies to successful result codes, - * false otherwise. - */ - static bool IsMobileResultSuccess( - const mobile_apis::Result::eType result_code); - - /** - * @brief Checks HMI result code for single RPC - * @param result_code contains result code from HMI response - * @return true if result code complies to successful result codes, - * false otherwise. - */ - static bool IsHMIResultSuccess( - const hmi_apis::Common_Result::eType result_code); - protected: /** * @brief Checks message permissions and parameters according to policy table diff --git a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h index 4464056175..0e03b31e74 100644 --- a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h @@ -106,12 +106,6 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { const uint32_t hmi_correlation_id, const hmi_apis::FunctionID::eType& function_id); - protected: - bool IsMobileResultSuccess(mobile_apis::Result::eType result_code) const; - - bool IsHMIResultSuccess(hmi_apis::Common_Result::eType result_code, - HmiInterfaces::InterfaceID interface) const; - private: /** * @brief Fills common parameters for SO diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 2adef91c2e..88200d6593 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -273,52 +273,46 @@ class MessageHelper { const std::string& path_to_icon, uint32_t app_id); /** - * @brief Sends button subscription notification - * @param app_id Application ID - * @param button Enum with button name - * @param is_subscribed true if subscribed, false otherwise + * @brief Creates button subscription requests for buttons + * that application is subscribed on + * @param app application to be subscribed for button + * @param button_subscriptions collection of subscribed buttons + * @param function_id function ID * @param app_mngr reference to application manager + * @return list of all buttons subscription requests ready to be sent to hmi + * @note for every button separate request is created in the list */ - static void SendOnButtonSubscriptionNotification( - const uint32_t app_id, - const hmi_apis::Common_ButtonName::eType button, - const bool is_subscribed, + static smart_objects::SmartObjectList + CreateButtonSubscriptionsHandlingRequestsList( + ApplicationConstSharedPtr app, + const ButtonSubscriptions& button_subscriptions, + const hmi_apis::FunctionID::eType function_id, ApplicationManager& app_mngr); /** - * @brief Creates button subscription notification - * @param app_id Application ID - * @param button Enum with button name - * @param is_subscribed true if subscribed, false otherwise - * @return notification message in SmartObject format - */ - static smart_objects::SmartObjectSPtr CreateOnButtonSubscriptionNotification( - const uint32_t app_id, - const hmi_apis::Common_ButtonName::eType button, - const bool is_subscribed); - - /** - * @brief Sends button subscription notifications for all buttons - * that application is subscribed on + * @brief Creates button subscription request to mobile * @param app shared pointer to application instance - * @param app_mngr reference to application manager + * @param source_message source message + * @return Smart object with fulfilled request */ - static void SendAllOnButtonSubscriptionNotificationsForApp( - ApplicationConstSharedPtr app, ApplicationManager& app_mngr); + static smart_objects::SmartObjectSPtr CreateButtonNotificationToMobile( + ApplicationSharedPtr app, + const smart_objects::SmartObject& source_message); /** - * @brief Creates button subscription notifications for buttons - * that application is subscribed on - * @param app shared pointer to application instance + * @brief Creates button subscription request to hmi + * @param app_id id of application for which request should be created + * @param button_name button to be subscribed + * @param function_id function ID * @param app_mngr reference to application manager - * @param button_subscriptions collection of subscribed buttons - * @return list of notification messages in SmartObject format + * @return Smart object with fulfilled request */ - static smart_objects::SmartObjectList - CreateOnButtonSubscriptionNotificationsForApp( - ApplicationConstSharedPtr app, - ApplicationManager& app_mngr, - const ButtonSubscriptions& button_subscriptions); + static smart_objects::SmartObjectSPtr + CreateButtonSubscriptionHandlingRequestToHmi( + const uint32_t app_id, + const hmi_apis::Common_ButtonName::eType button_name, + const hmi_apis::FunctionID::eType function_id, + ApplicationManager& app_mngr); static void SendAppDataToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_man); @@ -992,18 +986,6 @@ class MessageHelper { static void SendResetPropertiesRequest(ApplicationSharedPtr application, ApplicationManager& app_mngr); - /** - * @brief SendUnsubscribeButtonNotification sends notification to HMI to - * remove button subscription for application - * @param button Button type - * @param application Application to unsubscribe - * @param app_mngr Application manager - */ - static void SendUnsubscribeButtonNotification( - mobile_apis::ButtonName::eType button, - ApplicationSharedPtr application, - ApplicationManager& app_mngr); - /** * @brief Sends HMI status notification to mobile * @param application application with changed HMI status diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h index c2040852ca..edb3581737 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h @@ -367,6 +367,17 @@ class ResumptionDataProcessorImpl const smart_objects::SmartObject& request, const smart_objects::SmartObject& response) const; + /** + * @brief Checks whether SubscribeButton response successful or not and + * subscribes application if successful + * @param app_id application id + * @param request reference to request SO + * @param response reference to response SO + */ + void ProcessSubscribeButtonResponse( + const uint32_t app_id, + const smart_objects::SmartObject& request, + const smart_objects::SmartObject& response); app_mngr::ApplicationManager& application_manager_; /** diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc index 989c606085..25f389abd0 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc @@ -240,8 +240,8 @@ void ASGetAppServiceDataRequestFromHMI::on_event( hmi_apis::Common_Result::eType result = static_cast( event_message[strings::params][hmi_response::code].asInt()); - bool success = - IsHMIResultSuccess(result, HmiInterfaces::HMI_INTERFACE_AppService); + bool success = CommandImpl::IsHMIResultSuccess( + result, HmiInterfaces::HMI_INTERFACE_AppService); if (ValidateResponse(msg_params)) { SendResponse(success, correlation_id(), @@ -263,7 +263,8 @@ void ASGetAppServiceDataRequestFromHMI::on_event( msg_params[strings::result_code].asInt()); hmi_apis::Common_Result::eType result = MessageHelper::MobileToHMIResult(mobile_result); - bool success = IsMobileResultSuccess(mobile_result); + bool success = + application_manager::commands::IsMobileResultSuccess(mobile_result); if (ValidateResponse(msg_params)) { SendResponse(success, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index f5a1aac05c..315d06b85f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -140,7 +140,8 @@ void ASPerformAppServiceInteractionRequestFromHMI::on_event( msg_params[strings::result_code].asInt()); hmi_apis::Common_Result::eType result = MessageHelper::MobileToHMIResult(mobile_result); - bool success = IsMobileResultSuccess(mobile_result); + bool success = + application_manager::commands::IsMobileResultSuccess(mobile_result); SendResponse(success, correlation_id(), hmi_apis::FunctionID::AppService_PerformAppServiceInteraction, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index 719856625d..b0063a327f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -96,7 +96,7 @@ void GetAppServiceDataRequest::on_event( mobile_apis::Result::eType result = static_cast( msg_params[strings::result_code].asInt()); - bool success = IsMobileResultSuccess(result); + bool success = application_manager::commands::IsMobileResultSuccess(result); if (success) { HandleSubscribe(); } diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index c303e6d99f..64110a8e23 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -181,7 +181,7 @@ void PerformAppServiceInteractionRequest::on_event( : NULL; mobile_apis::Result::eType result = static_cast( msg_params[strings::result_code].asInt()); - bool success = IsMobileResultSuccess(result); + bool success = application_manager::commands::IsMobileResultSuccess(result); SendResponse(success, result, info, &msg_params); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h deleted file mode 100644 index 0a0a8c3c5d..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_SUBSCRIPTION_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_SUBSCRIPTION_NOTIFICATION_H_ - -#include "application_manager/commands/notification_to_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -namespace hmi { - -/** - * @brief OnButtonSubscriptionNotification command class - **/ -class OnButtonSubscriptionNotification - : public app_mngr::commands::NotificationToHMI { - public: - /** - * @brief OnButtonSubscriptionNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnButtonSubscriptionNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnButtonSubscriptionNotification class destructor - **/ - virtual ~OnButtonSubscriptionNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnButtonSubscriptionNotification); -}; - -} // namespace hmi - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BUTTON_SUBSCRIPTION_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h new file mode 100644 index 0000000000..f3e08d0a23 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_REQUEST_H_ + +#include "application_manager/commands/request_to_hmi.h" +#include "application_manager/event_engine/event.h" +#include "utils/macro.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { +namespace hmi { +/** + * @brief SubscribeButtonRequest command class + **/ +class SubscribeButtonRequest : public app_mngr::commands::RequestToHMI, + public app_mngr::event_engine::EventObserver { + public: + /** + * @brief SubscribeButtonRequest class constructor + * @param message Incoming SmartObject message + **/ + SubscribeButtonRequest(const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + /** + * @brief SubscribeButtonRequest class destructor + **/ + ~SubscribeButtonRequest(); + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + void onTimeOut() OVERRIDE; + + void on_event(const application_manager::event_engine::Event& event) OVERRIDE; + + private: + app_mngr::ApplicationSharedPtr GetApplicationPtr(); + + DISALLOW_COPY_AND_ASSIGN(SubscribeButtonRequest); + + hmi_apis::Common_ButtonName::eType button_name_; +}; + +} // namespace hmi +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_response.h new file mode 100644 index 0000000000..14c9753d0c --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_response.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_RESPONSE_H_ + +#include "application_manager/application_manager.h" +#include "application_manager/commands/response_from_hmi.h" +#include "utils/macro.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { +namespace hmi { +/** + * @brief SubscribeButtonResponse command class + **/ +class SubscribeButtonResponse : public app_mngr::commands::ResponseFromHMI { + public: + /** + * @brief SubscribeButtonResponse class constructor + * @param message Incoming SmartObject message + **/ + SubscribeButtonResponse(const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + /** + * @brief SubscribeButtonResponse class destructor + **/ + ~SubscribeButtonResponse(); + + /** + * @brief Execute command + **/ + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(SubscribeButtonResponse); +}; + +} // namespace hmi +} // namespace commands +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_SUBSCRIBE_BUTTON_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h new file mode 100644 index 0000000000..b377a536cb --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_ + +#include "application_manager/commands/request_to_hmi.h" +#include "application_manager/event_engine/event.h" +#include "utils/macro.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +namespace hmi { + +class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI, + public app_mngr::event_engine::EventObserver { + public: + UnsubscribeButtonRequest(const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + ~UnsubscribeButtonRequest(); + + void Run() OVERRIDE; + + void onTimeOut() OVERRIDE; + + void on_event(const application_manager::event_engine::Event& event) OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UnsubscribeButtonRequest); + + hmi_apis::Common_ButtonName::eType button_name_; +}; + +} // namespace hmi +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_ \ No newline at end of file diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h new file mode 100644 index 0000000000..5697fa0584 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_RESPONSE_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_RESPONSE_H_ + +#include "application_manager/application_manager.h" +#include "application_manager/commands/response_from_hmi.h" +#include "utils/macro.h" + +namespace sdl_rpc_plugin { +namespace app_mngr = application_manager; + +namespace commands { + +namespace hmi { + +class UnsubscribeButtonResponse : public app_mngr::commands::ResponseFromHMI { + public: + UnsubscribeButtonResponse(const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle); + + ~UnsubscribeButtonResponse(); + + void Run() OVERRIDE; + + private: + DISALLOW_COPY_AND_ASSIGN(UnsubscribeButtonResponse); +}; + +} // namespace hmi + +} // namespace commands + +} // namespace sdl_rpc_plugin + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_RESPONSE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h index afde9bac92..f1ca0f546c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_event_notification.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_EVENT_NOTIFICATION_H_ #include "application_manager/application.h" +#include "application_manager/commands/button_notification_to_mobile.h" #include "application_manager/commands/command_notification_impl.h" #include "utils/macro.h" @@ -50,7 +51,7 @@ namespace mobile { * to mobile device that some button was pressed on HMI. **/ class OnButtonEventNotification - : public app_mngr::commands::CommandNotificationImpl { + : public app_mngr::commands::ButtonNotificationToMobile { public: /** * @brief OnButtonEventNotification class constructor @@ -68,18 +69,13 @@ class OnButtonEventNotification **/ virtual ~OnButtonEventNotification(); - /** - * @brief Execute command - **/ - virtual void Run(); - - private: + protected: /* * @brief Sends button event notification to mobile device * * @param app Application to receive notification */ - void SendButtonEvent(app_mngr::ApplicationConstSharedPtr app); + void SendButtonNotification(app_mngr::ApplicationSharedPtr app) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(OnButtonEventNotification); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h index 57fda49be7..89f5d48f1a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/on_button_press_notification.h @@ -35,6 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ON_BUTTON_PRESS_NOTIFICATION_H_ #include "application_manager/application.h" +#include "application_manager/commands/button_notification_to_mobile.h" #include "application_manager/commands/command_notification_impl.h" #include "utils/macro.h" @@ -50,7 +51,7 @@ namespace mobile { * to mobile device that some button was pressed on HMI. **/ class OnButtonPressNotification - : public app_mngr::commands::CommandNotificationImpl { + : public app_mngr::commands::ButtonNotificationToMobile { public: /** * @brief OnButtonPressNotification class constructor @@ -66,12 +67,7 @@ class OnButtonPressNotification /** * @brief OnButtonEventCommand class destructor **/ - virtual ~OnButtonPressNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); + ~OnButtonPressNotification(); private: /* @@ -79,7 +75,7 @@ class OnButtonPressNotification * * @param app Application to receive notification */ - void SendButtonPress(app_mngr::ApplicationConstSharedPtr app); + void SendButtonNotification(app_mngr::ApplicationSharedPtr app) OVERRIDE; DISALLOW_COPY_AND_ASSIGN(OnButtonPressNotification); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h index 2b9887daad..ecb390095e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h @@ -74,6 +74,12 @@ class SubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl { */ bool Init() FINAL; + /** + * @brief Interface method that is called whenever new event received + * @param event The received event + */ + void on_event(const app_mngr::event_engine::Event& event) FINAL; + private: /** * @brief Checks if button subscription allowed. In case non-media @@ -88,12 +94,6 @@ class SubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl { bool IsSubscriptionAllowed(app_mngr::ApplicationSharedPtr app, const mobile_apis::ButtonName::eType btn_id); - /** - * @brief Sends ButtonSubscription notification - * to notify HMI that app subscribed on the button. - */ - void SendSubscribeButtonNotification(); - DISALLOW_COPY_AND_ASSIGN(SubscribeButtonRequest); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h index 51c10642cf..5adecb4d7a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h @@ -42,44 +42,23 @@ namespace app_mngr = application_manager; namespace commands { -/** - * @brief UnsubscribeButtonRequest command class - **/ class UnsubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl { public: - /** - * @brief UnsubscribeButtonRequest class constructor - * - * @param message Incoming SmartObject message - **/ UnsubscribeButtonRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler); - /** - * @brief UnsubscribeButtonRequest class destructor - **/ ~UnsubscribeButtonRequest() FINAL; - /** - * @brief Execute command - **/ void Run() FINAL; - /** - * @brief Init sets hash update mode for request - */ bool Init() FINAL; - private: - /** - * @brief Sends ButtonSubscription notification - * to notify HMI that app unsubscribed from the button. - */ - void SendUnsubscribeButtonNotification(); + void on_event(const app_mngr::event_engine::Event& event) FINAL; + private: DISALLOW_COPY_AND_ASSIGN(UnsubscribeButtonRequest); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc deleted file mode 100644 index c8d36407b8..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_button_subscription_notification.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -namespace hmi { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnButtonSubscriptionNotification::OnButtonSubscriptionNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationToHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnButtonSubscriptionNotification::~OnButtonSubscriptionNotification() {} - -void OnButtonSubscriptionNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - SendNotification(); -} - -} // namespace hmi - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc new file mode 100644 index 0000000000..b1699534bc --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/subscribe_button_request.h" +#include "application_manager/message_helper.h" +#include "application_manager/resumption/resume_ctrl.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { + +SDL_CREATE_LOG_VARIABLE("Commands") + +namespace hmi { + +SubscribeButtonRequest::SubscribeButtonRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) + , EventObserver(application_manager.event_dispatcher()) { + hmi_apis::Common_ButtonName::eType button_name = + static_cast( + (*message_)[app_mngr::strings::msg_params] + [app_mngr::strings::button_name] + .asInt()); + + button_name_ = button_name; +} + +SubscribeButtonRequest::~SubscribeButtonRequest() {} + +app_mngr::ApplicationSharedPtr SubscribeButtonRequest::GetApplicationPtr() { + const uint32_t app_id = + (*message_)[strings::msg_params][strings::app_id].asUInt(); + + return application_manager_.application_by_hmi_app(app_id); +} + +void SubscribeButtonRequest::Run() { + SDL_LOG_AUTO_TRACE(); + + // Specific case when app subscribes to CUSTOM_BUTTON upon registration and no + // explicit mobile request exist when response arrives. In this case event + // should be catched by HMI request itself. + if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == button_name_) { + ApplicationSharedPtr app = GetApplicationPtr(); + if (app) { + // Application should also be subscribed to CUSTOM_BUTTON even before + // response is received + app->SubscribeToButton(mobile_apis::ButtonName::CUSTOM_BUTTON); + } + + subscribe_on_event(hmi_apis::FunctionID::Buttons_SubscribeButton, + correlation_id()); + } + + SendRequest(); +} + +void SubscribeButtonRequest::on_event(const event_engine::Event& event) { + SDL_LOG_AUTO_TRACE(); + using namespace helpers; + + if (hmi_apis::FunctionID::Buttons_SubscribeButton != event.id()) { + SDL_LOG_ERROR("Unexpected event id received: " << event.id()); + return; + } + + unsubscribe_from_event(hmi_apis::FunctionID::Buttons_SubscribeButton); + + const smart_objects::SmartObject& message = event.smart_object(); + ApplicationSharedPtr app = GetApplicationPtr(); + + if (!app) { + SDL_LOG_ERROR("NULL pointer."); + return; + } + + const auto hmi_result = static_cast( + message[strings::params][hmi_response::code].asInt()); + + if (CommandImpl::IsHMIResultSuccess(hmi_result, + HmiInterfaces::HMI_INTERFACE_Buttons)) { + SDL_LOG_DEBUG("Subscription to " + << button_name_ << " was successful. Subscribing internally"); + app->SubscribeToButton( + static_cast(button_name_)); + } else if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == button_name_) { + // SDL should revert subscription in a specific case related to custom + // button because it was subscribed when the request is sent to HMI + SDL_LOG_ERROR( + "Subscription to custom button was failed. Revert the internal " + "subscription"); + app->UnsubscribeFromButton( + static_cast(button_name_)); + } +} + +void SubscribeButtonRequest::onTimeOut() { + SDL_LOG_AUTO_TRACE(); + + application_manager_.AddExpiredButtonRequest( + application_id(), correlation_id(), button_name_); + + if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == button_name_) { + ApplicationSharedPtr app = GetApplicationPtr(); + + if (app) { + // SDL should revert subscription in a specific case related to custom + // button because it was subscribed when the request is sent to HMI + SDL_LOG_ERROR( + "Subscription to custom button was timed out. Revert the internal " + "subscription"); + app->UnsubscribeFromButton( + static_cast(button_name_)); + } + } + + auto& resume_ctrl = application_manager_.resume_controller(); + resume_ctrl.HandleOnTimeOut( + correlation_id(), + static_cast(function_id())); +} + +} // namespace hmi +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_response.cc new file mode 100644 index 0000000000..202cde29c6 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_response.cc @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "sdl_rpc_plugin/commands/hmi/subscribe_button_response.h" +#include "application_manager/event_engine/event.h" +#include "application_manager/message_helper.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +SDL_CREATE_LOG_VARIABLE("Commands") + +namespace hmi { +SubscribeButtonResponse::SubscribeButtonResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +SubscribeButtonResponse::~SubscribeButtonResponse() {} + +void SubscribeButtonResponse::Run() { + SDL_LOG_AUTO_TRACE(); + + hmi_apis::Common_Result::eType hmi_result = + static_cast( + (*message_) + .getElement(strings::params) + .getElement(hmi_response::code) + .asInt()); + + const auto expired_request_data = + application_manager_.GetExpiredButtonRequestData(correlation_id()); + if (expired_request_data) { + const uint32_t app_id = (*expired_request_data).app_id_; + const auto button_name = (*expired_request_data).button_name_; + application_manager_.DeleteExpiredButtonRequest(correlation_id()); + + if (!CommandImpl::IsHMIResultSuccess( + hmi_result, HmiInterfaces::HMI_INTERFACE_Buttons)) { + return; + } + + smart_objects::SmartObjectSPtr msg = + MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi( + app_id, + button_name, + hmi_apis::FunctionID::Buttons_UnsubscribeButton, + application_manager_); + + rpc_service_.SendMessageToHMI(msg); + return; + } + + event_engine::Event event(hmi_apis::FunctionID::Buttons_SubscribeButton); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace hmi +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc new file mode 100644 index 0000000000..dbebf79018 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h" +#include "application_manager/event_engine/event_dispatcher_impl.h" +#include "application_manager/message_helper.h" +#include "application_manager/resumption/resume_ctrl.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; + +namespace commands { +SDL_CREATE_LOG_VARIABLE("Commands") + +namespace hmi { + +UnsubscribeButtonRequest::UnsubscribeButtonRequest( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : RequestToHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) + , EventObserver(application_manager.event_dispatcher()) { + hmi_apis::Common_ButtonName::eType button_name = + static_cast( + (*message_)[app_mngr::strings::msg_params] + [app_mngr::strings::button_name] + .asInt()); + + button_name_ = button_name; +} + +UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {} + +void UnsubscribeButtonRequest::Run() { + SDL_LOG_AUTO_TRACE(); + + subscribe_on_event(hmi_apis::FunctionID::Buttons_UnsubscribeButton, + correlation_id()); + SendRequest(); +} + +void UnsubscribeButtonRequest::onTimeOut() { + SDL_LOG_AUTO_TRACE(); + + application_manager_.AddExpiredButtonRequest( + application_id(), correlation_id(), button_name_); + + auto& resume_ctrl = application_manager_.resume_controller(); + resume_ctrl.HandleOnTimeOut( + correlation_id(), + static_cast(function_id())); +} + +void UnsubscribeButtonRequest::on_event(const event_engine::Event& event) { + SDL_LOG_AUTO_TRACE(); + + if (hmi_apis::FunctionID::Buttons_UnsubscribeButton != event.id()) { + SDL_LOG_ERROR("Unexpected event id received: " << event.id()); + return; + } + + unsubscribe_from_event(hmi_apis::FunctionID::Buttons_UnsubscribeButton); + + ApplicationSharedPtr app = + application_manager_.application_by_hmi_app(application_id()); + + const smart_objects::SmartObject& message = event.smart_object(); + + if (!app) { + SDL_LOG_ERROR("NULL pointer."); + return; + } + + hmi_apis::Common_Result::eType hmi_result = + static_cast( + message[strings::params][hmi_response::code].asInt()); + + if (CommandImpl::IsHMIResultSuccess(hmi_result, + HmiInterfaces::HMI_INTERFACE_Buttons)) { + const mobile_apis::ButtonName::eType btn_id = + static_cast( + (*message_)[strings::msg_params][strings::button_name].asInt()); + app->UnsubscribeFromButton( + static_cast(btn_id)); + } +} + +} // namespace hmi +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_response.cc new file mode 100644 index 0000000000..68b3663ca7 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_response.cc @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include "sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h" +#include "application_manager/event_engine/event.h" +#include "application_manager/message_helper.h" + +namespace sdl_rpc_plugin { +using namespace application_manager; +namespace commands { + +SDL_CREATE_LOG_VARIABLE("Commands") + +namespace hmi { + +UnsubscribeButtonResponse::UnsubscribeButtonResponse( + const application_manager::commands::MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handle) + : ResponseFromHMI(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handle) {} + +UnsubscribeButtonResponse::~UnsubscribeButtonResponse() {} + +void UnsubscribeButtonResponse::Run() { + SDL_LOG_AUTO_TRACE(); + + hmi_apis::Common_Result::eType hmi_result = + static_cast( + (*message_) + .getElement(strings::params) + .getElement(hmi_response::code) + .asInt()); + + const auto expired_request_data = + application_manager_.GetExpiredButtonRequestData(correlation_id()); + if (expired_request_data) { + const uint32_t app_id = (*expired_request_data).app_id_; + const auto button_name = (*expired_request_data).button_name_; + application_manager_.DeleteExpiredButtonRequest(correlation_id()); + + if (!CommandImpl::IsHMIResultSuccess( + hmi_result, HmiInterfaces::HMI_INTERFACE_Buttons)) { + return; + } + + smart_objects::SmartObjectSPtr msg = + MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi( + app_id, + button_name, + hmi_apis::FunctionID::Buttons_SubscribeButton, + application_manager_); + + rpc_service_.SendMessageToHMI(msg); + return; + } + + event_engine::Event event(hmi_apis::FunctionID::Buttons_UnsubscribeButton); + event.set_smart_object(*message_); + event.raise(application_manager_.event_dispatcher()); +} + +} // namespace hmi +} // namespace commands +} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc index 2a0ca4ddb3..8febbf4f60 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc @@ -218,7 +218,8 @@ void CreateWindowRequest::on_event(const event_engine::Event& event) { static_cast( response_message[strings::params][hmi_response::code].asInt())); - const bool is_success = IsMobileResultSuccess(result_code); + const bool is_success = + app_mngr::commands::IsMobileResultSuccess(result_code); std::string response_info; GetInfo(response_message, response_info); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc index 05347435d7..b675042d16 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -204,7 +204,7 @@ void DeleteInteractionChoiceSetRequest:: continue; } - if (!IsHMIResultSuccess(code)) { + if (!application_manager::commands::IsHMIResultSuccess(code)) { result_code = code; } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc index 214a9c2bab..6f36f99c6c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc @@ -134,7 +134,8 @@ void DeleteWindowRequest::on_event(const event_engine::Event& event) { static_cast( response_message[strings::params][hmi_response::code].asInt())); - const bool is_success = IsMobileResultSuccess(result_code); + const bool is_success = + app_mngr::commands::IsMobileResultSuccess(result_code); std::string response_info; GetInfo(response_message, response_info); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc index 14787d0a08..234c33214c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc @@ -34,6 +34,7 @@ #include "sdl_rpc_plugin/commands/mobile/on_button_event_notification.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" namespace sdl_rpc_plugin { @@ -51,146 +52,23 @@ OnButtonEventNotification::OnButtonEventNotification( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandNotificationImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : ButtonNotificationToMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} OnButtonEventNotification::~OnButtonEventNotification() {} -void OnButtonEventNotification::Run() { +void OnButtonEventNotification::SendButtonNotification( + ApplicationSharedPtr app) { SDL_LOG_AUTO_TRACE(); - const uint32_t btn_id = static_cast( - (*message_)[strings::msg_params][hmi_response::button_name].asInt()); - - const bool is_app_id_exists = - (*message_)[strings::msg_params].keyExists(strings::app_id); - ApplicationSharedPtr app; - - // CUSTOM_BUTTON notification - if (static_cast(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { - // app_id is mandatory for CUSTOM_BUTTON notification - if (!is_app_id_exists) { - SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonEvent without app_id."); - return; - } - - app = application_manager_.application( - (*message_)[strings::msg_params][strings::app_id].asUInt()); - - // custom_button_id is mandatory for CUSTOM_BUTTON notification - if (false == (*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { - SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonEvent without custom_button_id."); - return; - } - - if (!app) { - SDL_LOG_ERROR("Application doesn't exist."); - return; - } - - uint32_t custom_btn_id = 0; - custom_btn_id = - (*message_)[strings::msg_params][hmi_response::custom_button_id] - .asUInt(); - - if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { - SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id."); - return; - } - - const auto window_id = app->GetSoftButtonWindowID(custom_btn_id); - (*message_)[strings::msg_params][strings::window_id] = window_id; - const auto window_hmi_level = app->hmi_level(window_id); - if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) { - SDL_LOG_WARN( - "CUSTOM_BUTTON OnButtonEvent notification is not allowed in " - "NONE hmi level"); - return; - } - - SendButtonEvent(app); - return; - } - - const std::vector& subscribed_apps = - application_manager_.applications_by_button(btn_id); - - std::vector::const_iterator it = - subscribed_apps.begin(); - for (; subscribed_apps.end() != it; ++it) { - ApplicationSharedPtr subscribed_app = *it; - if (!subscribed_app) { - SDL_LOG_WARN("Null pointer to subscribed app."); - continue; - } - - // Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode - const mobile_apis::HMILevel::eType app_hmi_level = - subscribed_app->hmi_level( - mobile_apis::PredefinedWindows::DEFAULT_WINDOW); - if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && - (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { - SDL_LOG_WARN("OnButtonEvent notification is allowed only" - << "in FULL or LIMITED hmi level"); - continue; - } - // if OK button and "app_id" absent send notification only in HMI_FULL mode - // otherwise send to subscribed apps in limited - if (is_app_id_exists || hmi_apis::Common_ButtonName::OK != btn_id || - subscribed_app->IsFullscreen()) { - SendButtonEvent(subscribed_app); - } - } -} - -void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { - if (!app) { - SDL_LOG_ERROR("OnButtonEvent NULL pointer"); - return; - } - - smart_objects::SmartObjectSPtr on_btn_event = - std::make_shared(); - - if (!on_btn_event) { - SDL_LOG_ERROR("OnButtonEvent NULL pointer"); - return; - } - - (*on_btn_event)[strings::params][strings::connection_key] = app->app_id(); - - (*on_btn_event)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnButtonEventID); - - mobile_apis::ButtonName::eType btn_id = - static_cast( - (*message_)[strings::msg_params][hmi_response::button_name].asInt()); - - if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE && - app->msg_version() < utils::rpc_version_5) { - btn_id = mobile_apis::ButtonName::OK; - } - - (*on_btn_event)[strings::msg_params][strings::button_name] = btn_id; - (*on_btn_event)[strings::msg_params][strings::button_event_mode] = - (*message_)[strings::msg_params][hmi_response::button_mode]; - - if ((*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { - (*on_btn_event)[strings::msg_params][strings::custom_button_id] = - (*message_)[strings::msg_params][strings::custom_button_id]; - } + (*message_)[strings::params][strings::function_id] = + mobile_apis::FunctionID::eType::OnButtonEventID; - if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { - (*on_btn_event)[strings::msg_params][strings::window_id] = - (*message_)[strings::msg_params][strings::window_id]; - } + message_ = MessageHelper::CreateButtonNotificationToMobile(app, *message_); - message_ = on_btn_event; SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc index 4444f0d156..90bf618c35 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc @@ -34,6 +34,7 @@ #include "sdl_rpc_plugin/commands/mobile/on_button_press_notification.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" #include "utils/semantic_version.h" @@ -52,155 +53,23 @@ OnButtonPressNotification::OnButtonPressNotification( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandNotificationImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : ButtonNotificationToMobile(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} OnButtonPressNotification::~OnButtonPressNotification() {} -void OnButtonPressNotification::Run() { +void OnButtonPressNotification::SendButtonNotification( + ApplicationSharedPtr app) { SDL_LOG_AUTO_TRACE(); - const uint32_t btn_id = static_cast( - (*message_)[strings::msg_params][hmi_response::button_name].asInt()); - - const bool is_app_id_exists = - (*message_)[strings::msg_params].keyExists(strings::app_id); - ApplicationSharedPtr app; - if (is_app_id_exists) { - app = application_manager_.application( - (*message_)[strings::msg_params][strings::app_id].asUInt()); - } - - // CUSTOM_BUTTON notification - if (static_cast(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { - // app_id is mandatory for CUSTOM_BUTTON notification - if (!is_app_id_exists) { - SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonPress without app_id."); - return; - } - - // custom_button_id is mandatory for CUSTOM_BUTTON notification - if (false == (*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { - SDL_LOG_ERROR("CUSTOM_BUTTON OnButtonPress without custom_button_id."); - return; - } - - if (!app) { - SDL_LOG_ERROR("Application doesn't exist."); - return; - } - - uint32_t custom_btn_id = 0; - custom_btn_id = - (*message_)[strings::msg_params][hmi_response::custom_button_id] - .asUInt(); - - if (false == app->IsSubscribedToSoftButton(custom_btn_id)) { - SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id."); - return; - } - - // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode - const auto window_id = app->GetSoftButtonWindowID(custom_btn_id); - app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); - (*message_)[strings::msg_params][strings::window_id] = window_id; - const auto window_hmi_level = app->hmi_level(window_id); - if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) { - SDL_LOG_WARN( - "CUSTOM_BUTTON OnButtonPress notification is not allowed in " - "NONE hmi level"); - return; - } - - SendButtonPress(app); - return; - } - - const std::vector& subscribed_apps = - application_manager_.applications_by_button(btn_id); - - std::vector::const_iterator it = - subscribed_apps.begin(); - for (; subscribed_apps.end() != it; ++it) { - ApplicationSharedPtr subscribed_app = *it; - if (!subscribed_app) { - SDL_LOG_WARN("Null pointer to subscribed app."); - continue; - } - - // Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode - const mobile_apis::HMILevel::eType app_hmi_level = - subscribed_app->hmi_level( - mobile_apis::PredefinedWindows::DEFAULT_WINDOW); - if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) && - (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) { - SDL_LOG_WARN("OnButtonPress notification is allowed only " - << "in FULL or LIMITED hmi level"); - continue; - } - // if "appID" is present, send it to named app only if its FULL or - // LIMITED - if (app.use_count() != 0) { - if (app->app_id() == subscribed_app->app_id()) { - SendButtonPress(subscribed_app); - } - } else if (hmi_apis::Common_ButtonName::OK != btn_id || - subscribed_app->IsFullscreen()) { - // if No "appID" and OK button - send it FULL apps only. - // if not OK button, send to LIMITED subscribed apps - SendButtonPress(subscribed_app); - } - } -} - -void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { - if (!app) { - SDL_LOG_ERROR("OnButtonPress NULL pointer"); - return; - } - - smart_objects::SmartObjectSPtr on_btn_press = - std::make_shared(); - - if (!on_btn_press) { - SDL_LOG_ERROR("OnButtonPress NULL pointer"); - return; - } - - (*on_btn_press)[strings::params][strings::connection_key] = app->app_id(); - - (*on_btn_press)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnButtonPressID); - - mobile_apis::ButtonName::eType btn_id = - static_cast( - (*message_)[strings::msg_params][hmi_response::button_name].asInt()); - - if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE && - app->msg_version() < utils::rpc_version_5) { - btn_id = mobile_apis::ButtonName::OK; - } - - (*on_btn_press)[strings::msg_params][strings::button_name] = btn_id; - (*on_btn_press)[strings::msg_params][strings::button_press_mode] = - (*message_)[strings::msg_params][hmi_response::button_mode]; - - if ((*message_)[strings::msg_params].keyExists( - hmi_response::custom_button_id)) { - (*on_btn_press)[strings::msg_params][strings::custom_button_id] = - (*message_)[strings::msg_params][strings::custom_button_id]; - } + (*message_)[strings::params][strings::function_id] = + mobile_apis::FunctionID::eType::OnButtonPressID; - if ((*message_)[strings::msg_params].keyExists(strings::window_id)) { - (*on_btn_press)[strings::msg_params][strings::window_id] = - (*message_)[strings::msg_params][strings::window_id]; - } + message_ = MessageHelper::CreateButtonNotificationToMobile(app, *message_); - message_ = on_btn_press; SendNotification(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index c095081f2a..a43603294a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -1462,13 +1462,13 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam( } void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() { + SDL_LOG_AUTO_TRACE(); using namespace smart_objects; SmartObject msg_params = SmartObject(SmartType_Map); msg_params[strings::app_id] = connection_key(); - msg_params[strings::name] = hmi_apis::Common_ButtonName::CUSTOM_BUTTON; - msg_params[strings::is_suscribed] = true; - CreateHMINotification(hmi_apis::FunctionID::Buttons_OnButtonSubscription, - msg_params); + msg_params[strings::button_name] = hmi_apis::Common_ButtonName::CUSTOM_BUTTON; + SendHMIRequest( + hmi_apis::FunctionID::Buttons_SubscribeButton, &msg_params, false); } bool RegisterAppInterfaceRequest::IsApplicationSwitched() { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc index 42cb3c60c9..723a1ececa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc @@ -32,6 +32,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/subscribe_button_request.h" +#include "application_manager/message_helper.h" #include "utils/semantic_version.h" namespace sdl_rpc_plugin { @@ -104,11 +105,11 @@ void SubscribeButtonRequest::Run() { return; } - app->SubscribeToButton(static_cast(btn_id)); - SendSubscribeButtonNotification(); - - const bool is_succeeded = true; - SendResponse(is_succeeded, mobile_apis::Result::SUCCESS); + (*message_)[str::msg_params][str::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Buttons); + SendHMIRequest(hmi_apis::FunctionID::Buttons_SubscribeButton, + &(*message_)[app_mngr::strings::msg_params], + true); } bool SubscribeButtonRequest::Init() { @@ -116,6 +117,59 @@ bool SubscribeButtonRequest::Init() { return true; } +void SubscribeButtonRequest::on_event(const event_engine::Event& event) { + SDL_LOG_AUTO_TRACE(); + + const smart_objects::SmartObject& message = event.smart_object(); + + if (hmi_apis::FunctionID::Buttons_SubscribeButton != event.id()) { + SDL_LOG_ERROR("Received unknown event."); + return; + } + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Buttons); + ApplicationSharedPtr app = + application_manager_.application(CommandRequestImpl::connection_key()); + + if (!app) { + SDL_LOG_ERROR("NULL pointer."); + return; + } + + hmi_apis::Common_Result::eType hmi_result = + static_cast( + message[strings::params][hmi_response::code].asInt()); + std::string response_info; + GetInfo(message, response_info); + const bool result = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_Buttons); + + if (result) { + const auto btn_id = static_cast( + (*message_)[str::msg_params][str::button_name].asInt()); + app->SubscribeToButton(btn_id); + } + mobile_apis::Result::eType result_code = + MessageHelper::HMIToMobileResult(hmi_result); + + SendResponse(result, + result_code, + response_info.empty() ? nullptr : response_info.c_str(), + &(message[strings::msg_params])); +} + +bool IsPresetButton(const mobile_apis::ButtonName::eType btn_id) { + return (mobile_apis::ButtonName::PRESET_0 == btn_id) || + (mobile_apis::ButtonName::PRESET_1 == btn_id) || + (mobile_apis::ButtonName::PRESET_2 == btn_id) || + (mobile_apis::ButtonName::PRESET_3 == btn_id) || + (mobile_apis::ButtonName::PRESET_4 == btn_id) || + (mobile_apis::ButtonName::PRESET_5 == btn_id) || + (mobile_apis::ButtonName::PRESET_6 == btn_id) || + (mobile_apis::ButtonName::PRESET_7 == btn_id) || + (mobile_apis::ButtonName::PRESET_8 == btn_id) || + (mobile_apis::ButtonName::PRESET_9 == btn_id); +} + bool SubscribeButtonRequest::IsSubscriptionAllowed( ApplicationSharedPtr app, mobile_apis::ButtonName::eType btn_id) { if (!app->is_media_application() && @@ -123,7 +177,8 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed( (mobile_apis::ButtonName::SEEKLEFT == btn_id) || (mobile_apis::ButtonName::SEEKRIGHT == btn_id) || (mobile_apis::ButtonName::TUNEUP == btn_id) || - (mobile_apis::ButtonName::TUNEDOWN == btn_id))) { + (mobile_apis::ButtonName::TUNEDOWN == btn_id) || + IsPresetButton(btn_id))) { return false; } @@ -149,19 +204,6 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed( return true; } -void SubscribeButtonRequest::SendSubscribeButtonNotification() { - using namespace smart_objects; - using namespace hmi_apis; - - // send OnButtonSubscription notification - SmartObject msg_params = SmartObject(SmartType_Map); - msg_params[strings::app_id] = connection_key(); - msg_params[strings::name] = static_cast( - (*message_)[strings::msg_params][strings::button_name].asUInt()); - msg_params[strings::is_suscribed] = true; - CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); -} - } // namespace commands } // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc index 69f85568eb..09de35773a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc @@ -1,6 +1,5 @@ /* - - Copyright (c) 2018, Ford Motor Company + Copyright (c) 2021, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -34,6 +33,8 @@ #include "sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h" #include "application_manager/application_impl.h" +#include "application_manager/message_helper.h" +#include "utils/helpers.h" #include "utils/semantic_version.h" namespace sdl_rpc_plugin { @@ -93,15 +94,59 @@ void UnsubscribeButtonRequest::Run() { return; } - if (!app->UnsubscribeFromButton( - static_cast(btn_id))) { - SDL_LOG_ERROR("App doesn't subscribe to button " << btn_id); + if (!app->IsSubscribedToButton(btn_id)) { + SDL_LOG_ERROR("App is not subscribed to button " << btn_id); + SendResponse(false, mobile_apis::Result::IGNORED); + return; + } + + if (mobile_apis::ButtonName::CUSTOM_BUTTON == btn_id) { + SDL_LOG_ERROR("App cannot unsubscribe from CUSTOM_BUTTON"); SendResponse(false, mobile_apis::Result::IGNORED); return; } - SendUnsubscribeButtonNotification(); - SendResponse(true, mobile_apis::Result::SUCCESS); + (*message_)[str::msg_params][str::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Buttons); + SendHMIRequest(hmi_apis::FunctionID::Buttons_UnsubscribeButton, + &(*message_)[app_mngr::strings::msg_params], + true); +} + +void UnsubscribeButtonRequest::on_event(const event_engine::Event& event) { + SDL_LOG_AUTO_TRACE(); + using namespace helpers; + + const smart_objects::SmartObject& message = event.smart_object(); + + if (hmi_apis::FunctionID::Buttons_UnsubscribeButton != event.id()) { + SDL_LOG_ERROR("Received unknown event."); + return; + } + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Buttons); + ApplicationSharedPtr app = + application_manager_.application(CommandRequestImpl::connection_key()); + + if (!app) { + SDL_LOG_ERROR("NULL pointer."); + return; + } + + hmi_apis::Common_Result::eType hmi_result = + static_cast( + message[strings::params][hmi_response::code].asInt()); + std::string response_info; + GetInfo(message, response_info); + const bool result = PrepareResultForMobileResponse( + hmi_result, HmiInterfaces::HMI_INTERFACE_Buttons); + + mobile_apis::Result::eType result_code = + MessageHelper::HMIToMobileResult(hmi_result); + + SendResponse(result, + result_code, + response_info.empty() ? nullptr : response_info.c_str(), + &(message[strings::msg_params])); } bool UnsubscribeButtonRequest::Init() { @@ -109,19 +154,6 @@ bool UnsubscribeButtonRequest::Init() { return true; } -void UnsubscribeButtonRequest::SendUnsubscribeButtonNotification() { - using namespace smart_objects; - using namespace hmi_apis; - - // send OnButtonSubscription notification - SmartObject msg_params = SmartObject(SmartType_Map); - msg_params[strings::app_id] = connection_key(); - msg_params[strings::name] = static_cast( - (*message_)[strings::msg_params][strings::button_name].asInt()); - msg_params[strings::is_suscribed] = false; - CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); -} - } // namespace commands } // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc index 954ddb4e57..c66e0b6950 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc @@ -77,6 +77,8 @@ #include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h" #include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_request.h" #include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h" +#include "sdl_rpc_plugin/commands/hmi/subscribe_button_request.h" +#include "sdl_rpc_plugin/commands/hmi/subscribe_button_response.h" #include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h" #include "sdl_rpc_plugin/commands/hmi/tts_change_registration_response.h" #include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h" @@ -137,6 +139,8 @@ #include "sdl_rpc_plugin/commands/hmi/ui_slider_response.h" #include "sdl_rpc_plugin/commands/hmi/ui_subtle_alert_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_subtle_alert_response.h" +#include "sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h" +#include "sdl_rpc_plugin/commands/hmi/unsubscribe_button_response.h" #include "sdl_rpc_plugin/commands/hmi/update_app_list_request.h" #include "sdl_rpc_plugin/commands/hmi/update_app_list_response.h" #include "sdl_rpc_plugin/commands/hmi/update_device_list_request.h" @@ -207,7 +211,6 @@ #include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h" @@ -680,6 +683,19 @@ CommandCreator& HMICommandFactory::get_creator_factory( : factory .GetCreator(); } + case hmi_apis::FunctionID::Buttons_SubscribeButton: { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator() + : factory.GetCreator(); + } + + case hmi_apis::FunctionID::Buttons_UnsubscribeButton: { + return hmi_apis::messageType::request == message_type + ? factory.GetCreator() + : factory + .GetCreator(); + } + case hmi_apis::FunctionID::SDL_OnAllowSDLFunctionality: { return factory .GetCreator(); @@ -761,10 +777,6 @@ CommandCreator& HMICommandFactory::get_creator_factory( case hmi_apis::FunctionID::Buttons_OnButtonPress: { return factory.GetCreator(); } - case hmi_apis::FunctionID::Buttons_OnButtonSubscription: { - return factory - .GetCreator(); - } case hmi_apis::FunctionID::Navigation_OnTBTClientState: { return factory.GetCreator(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc index 5e485adb7f..2a0eda2b10 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -97,7 +97,6 @@ #include "hmi/on_audio_data_streaming_notification.h" #include "hmi/on_button_event_notification.h" #include "hmi/on_button_press_notification.h" -#include "hmi/on_button_subscription_notification.h" #include "hmi/on_device_chosen_notification.h" #include "hmi/on_device_state_changed_notification.h" #include "hmi/on_driver_distraction_notification.h" @@ -148,6 +147,8 @@ #include "hmi/sdl_get_user_friendly_message_response.h" #include "hmi/sdl_policy_update.h" #include "hmi/sdl_policy_update_response.h" +#include "hmi/subscribe_button_request.h" +#include "hmi/subscribe_button_response.h" #include "hmi/tts_change_registration_request.h" #include "hmi/tts_change_registration_response.h" #include "hmi/tts_get_capabilities_request.h" @@ -206,6 +207,8 @@ #include "hmi/ui_slider_response.h" #include "hmi/ui_subtle_alert_request.h" #include "hmi/ui_subtle_alert_response.h" +#include "hmi/unsubscribe_button_request.h" +#include "hmi/unsubscribe_button_response.h" #include "hmi/update_app_list_request.h" #include "hmi/update_app_list_response.h" #include "hmi/update_device_list_request.h" @@ -445,7 +448,6 @@ typedef Types + commands::UISubtleAlertRequest, + commands::hmi::UnsubscribeButtonRequest, + commands::hmi::UnsubscribeButtonResponse> HMICommandsListFifth; TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc index bb5008654a..82a5b536a8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc @@ -45,7 +45,6 @@ #include "sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h" @@ -338,7 +337,6 @@ class HMIOnNotificationsEventDispatcher typedef Types +#include +#include "application_manager/mock_event_dispatcher.h" + +#include "gtest/gtest.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace subscribe_button_request { + +using ::testing::_; +using ::testing::Return; +namespace am = ::application_manager; +namespace strings = am::strings; +using am::commands::RequestToHMI; +using am::event_engine::Event; +using sdl_rpc_plugin::commands::hmi::SubscribeButtonRequest; +using ::test::components::application_manager_test::MockApplication; +using ::test::components::event_engine_test::MockEventDispatcher; + +typedef std::shared_ptr MockAppPtr; +typedef std::shared_ptr RequestToHMIPtr; +typedef std::shared_ptr SubscribeButtonRequestPtr; + +namespace { +const uint32_t kCorrelationId = 2u; +const uint32_t kAppId = 1u; +const hmi_apis::Common_ButtonName::eType kCustomButtonName = + hmi_apis::Common_ButtonName::CUSTOM_BUTTON; +const hmi_apis::Common_ButtonName::eType kHmiButtonName = + hmi_apis::Common_ButtonName::SEEKLEFT; +const mobile_apis::ButtonName::eType kMobileButtonName = + mobile_apis::ButtonName::SEEKLEFT; +const mobile_apis::ButtonName::eType kMobileCustomButtonName = + mobile_apis::ButtonName::CUSTOM_BUTTON; +const hmi_apis::FunctionID::eType kFunctionID = + hmi_apis::FunctionID::Buttons_SubscribeButton; +} // namespace + +class HMISubscribeButtonRequestTest + : public CommandRequestTest { + protected: + MessageSharedPtr CreateCommandMsg() { + MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + (*command_msg)[strings::msg_params][strings::app_id] = kAppId; + (*command_msg)[strings::msg_params][strings::button_name] = kHmiButtonName; + (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId; + (*command_msg)[strings::params][strings::function_id] = kFunctionID; + + return command_msg; + } + + void InitCommand(const uint32_t& timeout) OVERRIDE { + mock_app_ = CreateMockApp(); + CommandRequestTest::InitCommand(timeout); + ON_CALL((*mock_app_), hmi_app_id()).WillByDefault(Return(kAppId)); + ON_CALL(app_mngr_, application_by_hmi_app(kAppId)) + .WillByDefault(Return(mock_app_)); + ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_)); + } + + MockAppPtr mock_app_; +}; + +TEST_F(HMISubscribeButtonRequestTest, Run_SendRequest_SUCCESS) { + MockEventDispatcher mock_event_dispatcher; + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher)); + + MessageSharedPtr command_msg = CreateCommandMsg(); + RequestToHMIPtr command(CreateCommand(command_msg)); + + EXPECT_CALL(mock_event_dispatcher, + add_observer(kFunctionID, kCorrelationId, _)) + .Times(0); + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); + ASSERT_TRUE(command->Init()); + + command->Run(); +} + +TEST_F(HMISubscribeButtonRequestTest, Run_SendRequest_CUSTOM_BUTTON_SUCCESS) { + MockEventDispatcher mock_event_dispatcher; + EXPECT_CALL(app_mngr_, event_dispatcher()) + .WillOnce(ReturnRef(mock_event_dispatcher)); + + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[strings::msg_params][strings::button_name] = kCustomButtonName; + RequestToHMIPtr command(CreateCommand(command_msg)); + + EXPECT_CALL(mock_event_dispatcher, + add_observer(kFunctionID, kCorrelationId, _)); + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); + + ASSERT_TRUE(command->Init()); + command->Run(); +} + +TEST_F(HMISubscribeButtonRequestTest, + onTimeOut_RequestIsExpired_HandleOnTimeout) { + MessageSharedPtr command_msg = CreateCommandMsg(); + RequestToHMIPtr command(CreateCommand(command_msg)); + + resumption_test::MockResumeCtrl mock_resume_ctrl; + ON_CALL(app_mngr_, resume_controller()) + .WillByDefault(ReturnRef(mock_resume_ctrl)); + EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(kCorrelationId, kFunctionID)); + + command->onTimeOut(); +} + +TEST_F(HMISubscribeButtonRequestTest, + OnEvent_SuccessfulResponse_ButtonSubscribed) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[strings::msg_params][strings::button_name] = kCustomButtonName; + + SubscribeButtonRequestPtr command = + CreateCommand(command_msg); + + MessageSharedPtr event_msg = CreateCommandMsg(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + + Event event(kFunctionID); + event.set_smart_object(*event_msg); + + EXPECT_CALL(*mock_app_, SubscribeToButton(kMobileCustomButtonName)) + .WillOnce(Return(true)); + + command->on_event(event); +} + +TEST_F(HMISubscribeButtonRequestTest, + OnEvent_UnsuccessfulResponse_ButtonNotSubscribed) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[strings::msg_params][strings::button_name] = kCustomButtonName; + + SubscribeButtonRequestPtr command = + CreateCommand(command_msg); + + MessageSharedPtr event_msg = CreateCommandMsg(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::GENERIC_ERROR; + + Event event(kFunctionID); + event.set_smart_object(*event_msg); + + EXPECT_CALL(*mock_app_, SubscribeToButton(kMobileCustomButtonName)).Times(0); + + command->on_event(event); +} + +TEST_F(HMISubscribeButtonRequestTest, onEvent_App_NULL) { + MessageSharedPtr command_msg = CreateCommandMsg(); + SubscribeButtonRequestPtr command = + CreateCommand(command_msg); + + MessageSharedPtr event_msg = CreateCommandMsg(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + + Event event(kFunctionID); + event.set_smart_object(*event_msg); + + MockAppPtr mock_app = NULL; + EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppId)) + .WillOnce(Return(mock_app)); + + EXPECT_CALL(*mock_app_, SubscribeToButton(kMobileButtonName)).Times(0); + + command->on_event(event); +} + +} // namespace subscribe_button_request +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc new file mode 100644 index 0000000000..ca4c2ee41b --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "application_manager/mock_event_dispatcher.h" +#include "gtest/gtest.h" +#include "hmi/subscribe_button_response.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace subscribe_button_response { + +namespace am = ::application_manager; +using application_manager::ExpiredButtonRequestData; +using application_manager::commands::ResponseFromHMI; +using sdl_rpc_plugin::commands::hmi::SubscribeButtonResponse; +using ::test::components::event_engine_test::MockEventDispatcher; +typedef std::shared_ptr ResponseFromHMIPtr; + +namespace { +const uint32_t kCorrelationId = 2u; +const uint32_t kAppId = 1u; +const hmi_apis::Common_ButtonName::eType kButtonName = + hmi_apis::Common_ButtonName::SEEKLEFT; +const hmi_apis::FunctionID::eType kFunctionID = + hmi_apis::FunctionID::Buttons_UnsubscribeButton; +} // namespace + +class HMISubscribeButtonResponseTest + : public CommandsTest { + public: + HMISubscribeButtonResponseTest() { + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + } + + MessageSharedPtr CreateCommandMsg() { + MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId; + (*command_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + + return command_msg; + } + + MockEventDispatcher event_dispatcher_; +}; + +TEST_F(HMISubscribeButtonResponseTest, + RUN_ProcessExpiredRequest_SendUnsubscribeRequestToHMI) { + MessageSharedPtr command_msg = CreateCommandMsg(); + ResponseFromHMIPtr command( + CreateCommand(command_msg)); + + ExpiredButtonRequestData expired_data; + expired_data.app_id_ = kAppId; + expired_data.button_name_ = kButtonName; + utils::Optional expired_data_opt = expired_data; + + ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId)) + .WillByDefault(Return(expired_data_opt)); + ON_CALL(mock_message_helper_, + CreateButtonSubscriptionHandlingRequestToHmi( + kAppId, kButtonName, kFunctionID, _)) + .WillByDefault(Return(command_msg)); + EXPECT_CALL(event_dispatcher_, raise_event(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); + + command->Run(); +} + +TEST_F( + HMISubscribeButtonResponseTest, + RUN_ProcessUnsuccessfulExpiredRequest_EventNotRaisedUnsubscribeRequestNotSent) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::GENERIC_ERROR; + + ResponseFromHMIPtr command( + CreateCommand(command_msg)); + + ExpiredButtonRequestData expired_data; + expired_data.app_id_ = kAppId; + expired_data.button_name_ = kButtonName; + utils::Optional expired_data_opt = expired_data; + + ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId)) + .WillByDefault(Return(expired_data_opt)); + EXPECT_CALL(event_dispatcher_, raise_event(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0); + + command->Run(); +} + +TEST_F(HMISubscribeButtonResponseTest, RUN_NoExpiredRequests_EventRaised) { + MessageSharedPtr command_msg = CreateCommandMsg(); + ResponseFromHMIPtr command( + CreateCommand(command_msg)); + + ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId)) + .WillByDefault(Return(utils::Optional::EMPTY)); + + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0); + EXPECT_CALL(event_dispatcher_, raise_event(_)); + + command->Run(); +} + +} // namespace subscribe_button_response +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc new file mode 100644 index 0000000000..3236987d14 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "hmi/unsubscribe_button_request.h" + +#include +#include + +#include "application_manager/mock_event_dispatcher.h" +#include "gtest/gtest.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace unsubscribe_button_request { + +using ::testing::_; +using ::testing::Return; +namespace am = ::application_manager; +namespace strings = am::strings; +using am::commands::RequestToHMI; +using am::event_engine::Event; +using sdl_rpc_plugin::commands::hmi::UnsubscribeButtonRequest; +using ::test::components::application_manager_test::MockApplication; + +typedef std::shared_ptr MockAppPtr; +typedef std::shared_ptr RequestToHMIPtr; +typedef std::shared_ptr UnsubscribeButtonRequestPtr; + +namespace { +const uint32_t kCorrelationId = 2u; +const uint32_t kAppId = 1u; +const hmi_apis::Common_ButtonName::eType kButtonName = + hmi_apis::Common_ButtonName::CUSTOM_BUTTON; +const hmi_apis::FunctionID::eType kFunctionID = + hmi_apis::FunctionID::Buttons_UnsubscribeButton; +const mobile_apis::ButtonName::eType kMobileCustomButtonName = + mobile_apis::ButtonName::CUSTOM_BUTTON; +} // namespace + +class HMIUnsubscribeButtonRequestTest + : public CommandRequestTest { + protected: + MessageSharedPtr CreateCommandMsg() { + MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + (*command_msg)[strings::msg_params][strings::app_id] = kAppId; + (*command_msg)[strings::msg_params][strings::button_name] = kButtonName; + (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId; + (*command_msg)[strings::params][strings::function_id] = kFunctionID; + + return command_msg; + } + + void InitCommand(const uint32_t& timeout) OVERRIDE { + mock_app_ = CreateMockApp(); + CommandRequestTest::InitCommand(timeout); + ON_CALL((*mock_app_), hmi_app_id()).WillByDefault(Return(kAppId)); + ON_CALL(app_mngr_, application_by_hmi_app(kAppId)) + .WillByDefault(Return(mock_app_)); + ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_)); + } + + MockAppPtr mock_app_; +}; + +TEST_F(HMIUnsubscribeButtonRequestTest, Run_SendRequest_SUCCESS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + RequestToHMIPtr command(CreateCommand(command_msg)); + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); + ASSERT_TRUE(command->Init()); + + command->Run(); +} + +TEST_F(HMIUnsubscribeButtonRequestTest, + onTimeOut_RequestIsExpired_HandleOnTimeout) { + MessageSharedPtr command_msg = CreateCommandMsg(); + RequestToHMIPtr command(CreateCommand(command_msg)); + + resumption_test::MockResumeCtrl mock_resume_ctrl; + ON_CALL(app_mngr_, resume_controller()) + .WillByDefault(ReturnRef(mock_resume_ctrl)); + EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); + + command->onTimeOut(); +} + +TEST_F(HMIUnsubscribeButtonRequestTest, + OnEvent_SuccessfulResponse_ButtonUnsubscribed) { + MessageSharedPtr command_msg = CreateCommandMsg(); + UnsubscribeButtonRequestPtr command = + CreateCommand(command_msg); + + MessageSharedPtr event_msg = CreateCommandMsg(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + Event event(kFunctionID); + event.set_smart_object(*event_msg); + + EXPECT_CALL(*mock_app_, UnsubscribeFromButton(kMobileCustomButtonName)) + .WillOnce(Return(true)); + + command->on_event(event); +} + +TEST_F(HMIUnsubscribeButtonRequestTest, + OnEvent_UnsuccessfulResponse_ButtonNotUnsubscribed) { + MessageSharedPtr command_msg = CreateCommandMsg(); + UnsubscribeButtonRequestPtr command = + CreateCommand(command_msg); + + MessageSharedPtr event_msg = CreateCommandMsg(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::GENERIC_ERROR; + Event event(kFunctionID); + event.set_smart_object(*event_msg); + + EXPECT_CALL(*mock_app_, UnsubscribeFromButton(kMobileCustomButtonName)) + .Times(0); + + command->on_event(event); +} + +TEST_F(HMIUnsubscribeButtonRequestTest, onEvent_App_NULL) { + MessageSharedPtr command_msg = CreateCommandMsg(); + UnsubscribeButtonRequestPtr command = + CreateCommand(command_msg); + + MessageSharedPtr event_msg = CreateCommandMsg(); + (*event_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + + Event event(kFunctionID); + event.set_smart_object(*event_msg); + + MockAppPtr mock_app = NULL; + EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppId)) + .WillOnce(Return(mock_app)); + + EXPECT_CALL(*mock_app_, UnsubscribeFromButton(kMobileCustomButtonName)) + .Times(0); + + command->on_event(event); +} + +} // namespace unsubscribe_button_request +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc new file mode 100644 index 0000000000..3d9572a743 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include "application_manager/mock_event_dispatcher.h" +#include "gtest/gtest.h" +#include "hmi/unsubscribe_button_response.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace unsubscribe_button_response { + +namespace am = ::application_manager; +using application_manager::ExpiredButtonRequestData; +using application_manager::commands::ResponseFromHMI; +using sdl_rpc_plugin::commands::hmi::UnsubscribeButtonResponse; +using ::test::components::event_engine_test::MockEventDispatcher; +typedef std::shared_ptr ResponseFromHMIPtr; + +namespace { +const uint32_t kCorrelationId = 2u; +const uint32_t kAppId = 1u; +const hmi_apis::Common_ButtonName::eType kButtonName = + hmi_apis::Common_ButtonName::SEEKLEFT; +const hmi_apis::FunctionID::eType kFunctionID = + hmi_apis::FunctionID::Buttons_SubscribeButton; +} // namespace + +class HMIUnsubscribeButtonResponseTest + : public CommandsTest { + public: + HMIUnsubscribeButtonResponseTest() { + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + } + + MessageSharedPtr CreateCommandMsg() { + MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId; + (*command_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::SUCCESS; + + return command_msg; + } + + MockEventDispatcher event_dispatcher_; +}; + +TEST_F(HMIUnsubscribeButtonResponseTest, + RUN_ProcessExpiredRequest_SendSubscribeRequestToHMI) { + MessageSharedPtr command_msg = CreateCommandMsg(); + + ResponseFromHMIPtr command( + CreateCommand(command_msg)); + + ExpiredButtonRequestData expired_data; + expired_data.app_id_ = kAppId; + expired_data.button_name_ = kButtonName; + utils::Optional expired_data_opt = expired_data; + + ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId)) + .WillByDefault(Return(expired_data_opt)); + ON_CALL(mock_message_helper_, + CreateButtonSubscriptionHandlingRequestToHmi( + kAppId, kButtonName, kFunctionID, _)) + .WillByDefault(Return(command_msg)); + EXPECT_CALL(event_dispatcher_, raise_event(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); + + command->Run(); +} + +TEST_F( + HMIUnsubscribeButtonResponseTest, + RUN_ProcessUnsuccessfulExpiredRequest_EventNotRaisedSubscribeRequestNotSent) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::GENERIC_ERROR; + + ResponseFromHMIPtr command( + CreateCommand(command_msg)); + + ExpiredButtonRequestData expired_data; + expired_data.app_id_ = kAppId; + expired_data.button_name_ = kButtonName; + utils::Optional expired_data_opt = expired_data; + + ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId)) + .WillByDefault(Return(expired_data_opt)); + EXPECT_CALL(event_dispatcher_, raise_event(_)).Times(0); + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0); + + command->Run(); +} + +TEST_F(HMIUnsubscribeButtonResponseTest, RUN_NoExpiredRequests_EventRaised) { + MessageSharedPtr command_msg = CreateCommandMsg(); + ResponseFromHMIPtr command( + CreateCommand(command_msg)); + + ON_CALL(app_mngr_, GetExpiredButtonRequestData(kCorrelationId)) + .WillByDefault(Return(utils::Optional::EMPTY)); + + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0); + EXPECT_CALL(event_dispatcher_, raise_event(_)); + command->Run(); +} + +} // namespace unsubscribe_button_response +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc index e4536ddeea..dbab9e1833 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc @@ -197,6 +197,9 @@ TYPED_TEST(OnButtonNotificationCommandsTest, typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app)); + EXPECT_CALL(*mock_app, + IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON)) + .WillOnce(Return(true)); EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId)) .WillOnce(Return(false)); @@ -215,6 +218,13 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) { (*notification_msg)[am::strings::msg_params] [am::hmi_response::custom_button_id] = kCustomButtonId; + auto mock_message_helper = am::MockMessageHelper::message_helper_mock(); + smart_objects::SmartObjectSPtr msg = + std::make_shared(); + (*msg)[strings::params][strings::function_id] = TestFixture::kFunctionId; + EXPECT_CALL(*mock_message_helper, CreateButtonNotificationToMobile(_, _)) + .WillRepeatedly(Return(msg)); + std::shared_ptr command( this->template CreateCommand(notification_msg)); @@ -222,6 +232,9 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) { ON_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL)); EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app)); + EXPECT_CALL(*mock_app, + IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON)) + .WillOnce(Return(true)); EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId)) .WillOnce(Return(true)); EXPECT_CALL(this->mock_rpc_service_, @@ -244,18 +257,30 @@ TYPED_TEST(OnButtonNotificationCommandsTest, (*notification_msg)[am::strings::msg_params] [am::hmi_response::custom_button_id] = kCustomButtonId; + auto mock_message_helper = am::MockMessageHelper::message_helper_mock(); + smart_objects::SmartObjectSPtr msg = + std::make_shared(); + EXPECT_CALL(*mock_message_helper, CreateButtonNotificationToMobile(_, _)) + .WillRepeatedly(Return(msg)); + std::shared_ptr command( this->template CreateCommand(notification_msg)); typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); - ON_CALL(*mock_app, hmi_level(kDefaultWindowId)) - .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND)); + + EXPECT_CALL(*mock_app, GetSoftButtonWindowID(kCustomButtonId)) + .WillOnce(Return(kDefaultWindowId)); + + EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) + .WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND)); + EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app)); + + EXPECT_CALL(*mock_app, + IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON)) + .WillOnce(Return(true)); EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId)) .WillOnce(Return(true)); - EXPECT_CALL(this->mock_rpc_service_, - SendMessageToMobile( - CheckNotificationMessage(TestFixture::kFunctionId), _)); command->Run(); } @@ -343,22 +368,27 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) { std::shared_ptr command( this->template CreateCommand(notification_msg)); - typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); - std::vector subscribed_apps_list; - subscribed_apps_list.push_back(mock_app); + auto mock_message_helper = am::MockMessageHelper::message_helper_mock(); + smart_objects::SmartObjectSPtr msg = + std::make_shared(); + (*msg)[strings::params][strings::function_id] = TestFixture::kFunctionId; + EXPECT_CALL(*mock_message_helper, CreateButtonNotificationToMobile(_, _)) + .WillRepeatedly(Return(msg)); + typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); + EXPECT_CALL(*mock_app, IsSubscribedToButton(kButtonName)) + .WillOnce(Return(true)); EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)) .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL)); ON_CALL(*mock_app, IsFullscreen()).WillByDefault(Return(true)); ON_CALL(this->app_mngr_, application(kAppId)).WillByDefault(Return(mock_app)); - EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName)) - .WillOnce(Return(subscribed_apps_list)); EXPECT_CALL(this->mock_rpc_service_, SendMessageToMobile( CheckNotificationMessage(TestFixture::kFunctionId), _)); + EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app)); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc index 99491873be..5d940c4f4c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc @@ -289,8 +289,7 @@ class RegisterAppInterfaceRequestTest EXPECT_CALL( mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), - _)) + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_SubscribeButton), _)) .Times(0); EXPECT_CALL( @@ -350,12 +349,6 @@ class RegisterAppInterfaceRequestTest hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), _)) .WillByDefault(Return(true)); - ON_CALL( - mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), - _)) - .WillByDefault(Return(true)); } void SetCommonPreconditionsToCheckWithPolicyData(MockAppPtr mock_app) { @@ -456,11 +449,22 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) { hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), _)) .WillOnce(Return(true)); + + ON_CALL(mock_hmi_interfaces_, + GetInterfaceState( + application_manager::HmiInterfaces::HMI_INTERFACE_Buttons)) + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); + + ON_CALL( + mock_hmi_interfaces_, + GetInterfaceFromFunction(hmi_apis::FunctionID::Buttons_SubscribeButton)) + .WillByDefault( + Return(application_manager::HmiInterfaces::HMI_INTERFACE_Buttons)); + EXPECT_CALL( mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), - _)) + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_SubscribeButton), _)) .WillOnce(Return(true)); application_manager::DisplayCapabilitiesBuilder builder(*mock_app); @@ -583,8 +587,7 @@ TEST_F(RegisterAppInterfaceRequestTest, EXPECT_CALL( mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), - _)) + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_SubscribeButton), _)) .WillOnce(Return(true)); EXPECT_CALL( mock_rpc_service_, @@ -848,8 +851,7 @@ TEST_F(RegisterAppInterfaceRequestTest, EXPECT_CALL( mock_rpc_service_, ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), - _)) + HMIResultCodeIs(hmi_apis::FunctionID::Buttons_SubscribeButton), _)) .WillOnce(Return(true)); EXPECT_CALL( mock_rpc_service_, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc index f3bfe12ab1..56e0766184 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc @@ -202,22 +202,19 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true))); - MessageSharedPtr mobile_result_msg; - EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true))); ASSERT_TRUE(command->Init()); command->Run(); - EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription, + EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton, static_cast( (*hmi_result_msg)[am::strings::params][am::strings::function_id] .asInt())); - EXPECT_EQ(mobile_apis::Result::SUCCESS, - static_cast( - (*mobile_result_msg)[am::strings::msg_params] - [am::strings::result_code] - .asInt())); + EXPECT_EQ( + hmi_apis::Common_ButtonName::eType::SEEKLEFT, + static_cast( + (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name] + .asInt())); } TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) { @@ -249,30 +246,30 @@ TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true))); - MessageSharedPtr mobile_result_msg; - EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true))); ASSERT_TRUE(command->Init()); command->Run(); - EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription, + EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton, static_cast( (*hmi_result_msg)[am::strings::params][am::strings::function_id] .asInt())); - EXPECT_EQ(mobile_apis::Result::SUCCESS, - static_cast( - (*mobile_result_msg)[am::strings::msg_params] - [am::strings::result_code] - .asInt())); + EXPECT_EQ( + hmi_apis::Common_ButtonName::eType::NAV_CENTER_LOCATION, + static_cast( + (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name] + .asInt())); } -TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) { - const mobile_apis::ButtonName::eType kButtonName = - mobile_apis::ButtonName::OK; +TEST_F(SubscribeButtonRequestTest, + Run_App_Version_4_5_and_OK_btn_Expect_PlayPause_btn_sent_to_HMI) { + const mobile_apis::ButtonName::eType button_ok = mobile_apis::ButtonName::OK; - MessageSharedPtr msg(CreateMessage()); - (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName; + const mobile_apis::ButtonName::eType button_play_pause = + mobile_apis::ButtonName::PLAY_PAUSE; + + MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map)); + (*msg)[am::strings::msg_params][am::strings::button_name] = button_ok; CommandPtr command(CreateCommand(msg)); MockAppPtr app(CreateMockApp()); @@ -284,41 +281,33 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) { .WillByDefault(Return(true)); MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map)); - (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName; - (*button_caps_ptr)[1][am::hmi_response::button_name] = - mobile_apis::ButtonName::PLAY_PAUSE; + (*button_caps_ptr)[0][am::hmi_response::button_name] = button_ok; + (*button_caps_ptr)[1][am::hmi_response::button_name] = button_play_pause; ON_CALL(mock_hmi_capabilities_, button_capabilities()) .WillByDefault(Return(button_caps_ptr)); - ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false)); + ON_CALL(*app, IsSubscribedToButton(button_play_pause)) + .WillByDefault(Return(false)); MessageSharedPtr hmi_result_msg; EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true))); - MessageSharedPtr mobile_result_msg; - EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true))); ASSERT_TRUE(command->Init()); command->Run(); - EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription, + EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton, static_cast( (*hmi_result_msg)[am::strings::params][am::strings::function_id] .asInt())); - EXPECT_EQ(hmi_apis::Common_ButtonName::PLAY_PAUSE, - static_cast( - (*hmi_result_msg)[am::strings::msg_params][am::strings::name] - .asInt())); - - EXPECT_EQ(mobile_apis::Result::SUCCESS, - static_cast( - (*mobile_result_msg)[am::strings::msg_params] - [am::strings::result_code] - .asInt())); + EXPECT_EQ( + hmi_apis::Common_ButtonName::PLAY_PAUSE, + static_cast( + (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name] + .asInt())); } } // namespace subscribe_button_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc index 5735610051..15795fa1e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc @@ -77,8 +77,6 @@ TEST_F(UnsubscribeButtonRequestTest, .WillOnce(Return(mock_app)); ON_CALL(*mock_app, msg_version()) .WillByDefault(ReturnRef(mock_semantic_version)); - EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId)) - .WillOnce(Return(false)); EXPECT_CALL( mock_rpc_service_, @@ -137,18 +135,6 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) { ON_CALL(*mock_app, msg_version()) .WillByDefault(ReturnRef(mock_semantic_version)); - EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId)) - .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), - _)); - EXPECT_CALL( - mock_rpc_service_, - ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); - - EXPECT_CALL(*mock_app, UpdateHash()); command->Init(); command->Run(); } @@ -181,19 +167,6 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS_Base_RPC_Version) { .WillByDefault(ReturnRef(mock_base_rpc_version)); ON_CALL(*mock_app, is_media_application()).WillByDefault(Return(true)); - EXPECT_CALL(*mock_app, - UnsubscribeFromButton(mobile_apis::ButtonName::PLAY_PAUSE)) - .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription), - _)); - EXPECT_CALL( - mock_rpc_service_, - ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); - - EXPECT_CALL(*mock_app, UpdateHash()); command->Init(); command->Run(); } diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 2952fd5481..a53141b5be 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -159,8 +159,7 @@ ApplicationImpl::ApplicationImpl( set_name(app_name); MarkUnregistered(); - // subscribe application to custom button by default - SubscribeToButton(mobile_apis::ButtonName::CUSTOM_BUTTON); + // load persistent files LoadPersistentFiles(); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index e78d6ee668..c3f3ef4bb3 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -3182,6 +3182,11 @@ void ApplicationManagerImpl::UnregisterAllApplications() { resume_controller().OnIgnitionOff(); } request_ctrl_->TerminateAllHMIRequests(); + + { + sync_primitives::AutoLock lock(expired_button_requests_lock_); + expired_button_requests_.clear(); + } } void ApplicationManagerImpl::RemoveAppsWaitingForRegistration( @@ -5024,4 +5029,36 @@ void ApplicationManagerImpl::ChangeAppsHMILevel( } } +void ApplicationManagerImpl::AddExpiredButtonRequest( + const uint32_t app_id, + const int32_t corr_id, + const hmi_apis::Common_ButtonName::eType button_name) { + SDL_LOG_AUTO_TRACE(); + + sync_primitives::AutoLock lock(expired_button_requests_lock_); + expired_button_requests_[corr_id] = {app_id, button_name}; +} + +utils::Optional +ApplicationManagerImpl::GetExpiredButtonRequestData( + const int32_t corr_id) const { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock lock(expired_button_requests_lock_); + + auto found_subscription = expired_button_requests_.find(corr_id); + if (found_subscription == expired_button_requests_.end()) { + return utils::Optional::EMPTY; + } + + return utils::Optional(found_subscription->second); +} + +void ApplicationManagerImpl::DeleteExpiredButtonRequest(const int32_t corr_id) { + SDL_LOG_AUTO_TRACE(); + + sync_primitives::AutoLock lock(expired_button_requests_lock_); + auto found_subscription = expired_button_requests_.find(corr_id); + expired_button_requests_.erase(found_subscription); +} + } // namespace application_manager diff --git a/src/components/application_manager/src/commands/button_notification_to_mobile.cc b/src/components/application_manager/src/commands/button_notification_to_mobile.cc new file mode 100644 index 0000000000..a94f4ef6ab --- /dev/null +++ b/src/components/application_manager/src/commands/button_notification_to_mobile.cc @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2021, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/button_notification_to_mobile.h" +#include "interfaces/MOBILE_API.h" +namespace application_manager { + +namespace commands { +namespace app_mngr = application_manager; + +SDL_CREATE_LOG_VARIABLE("ButtonNotificationToMobile") + +ButtonNotificationToMobile::ButtonNotificationToMobile( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandNotificationImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + +ButtonNotificationToMobile::~ButtonNotificationToMobile() {} + +bool ButtonNotificationToMobile::DoesParamExist( + const std::string& param_name) const { + SDL_LOG_AUTO_TRACE(); + using namespace application_manager::strings; + return (*message_)[msg_params].keyExists(param_name); +} + +void ButtonNotificationToMobile::HandleCustomButton( + app_mngr::ApplicationSharedPtr app) { + SDL_LOG_AUTO_TRACE(); + using namespace application_manager::strings; + + if (!app) { + SDL_LOG_ERROR("Application doesn't exist."); + return; + } + + // custom_button_id is mandatory for CUSTOM_BUTTON notification + if (!DoesParamExist(hmi_response::custom_button_id)) { + SDL_LOG_ERROR( + "CUSTOM_BUTTON mobile notification without custom_button_id."); + return; + } + + if (!app->IsSubscribedToButton(mobile_apis::ButtonName::CUSTOM_BUTTON)) { + SDL_LOG_ERROR("Application " << app->app_id() + << " is not subscribed on custom buttons"); + return; + } + + const uint32_t custom_btn_id = + (*message_)[msg_params][hmi_response::custom_button_id].asUInt(); + + if (!app->IsSubscribedToSoftButton(custom_btn_id)) { + SDL_LOG_ERROR("Application doesn't subscribed to this custom_button_id."); + return; + } + + const auto window_id = app->GetSoftButtonWindowID(custom_btn_id); + (*message_)[strings::msg_params][strings::window_id] = window_id; + + if (mobile_api::HMILevel::HMI_NONE == app->hmi_level(window_id)) { + SDL_LOG_WARN("CUSTOM_BUTTON mobile notification is allowed only " + << "in FULL, LIMITED or BACKGROUND hmi level"); + return; + } + + SendButtonNotification(app); + return; +} + +void ButtonNotificationToMobile::HandleOKButton( + app_mngr::ApplicationSharedPtr app) { + SDL_LOG_AUTO_TRACE(); + using namespace application_manager; + SDL_LOG_DEBUG("OK button received"); + + if (app) { + const auto btn_id = static_cast( + (*message_)[strings::msg_params][hmi_response::button_name].asInt()); + + if (app->IsSubscribedToButton(btn_id)) { + SendButtonNotification(app); + } else { + SDL_LOG_ERROR("Application " << app->app_id() + << " is not subscribed to button " + << btn_id); + } + + return; + } + + const auto subscribed_apps = SubscribedApps(); + const auto app_ptr = + std::find_if(subscribed_apps.begin(), + subscribed_apps.end(), + [](const ApplicationSharedPtr subscribed_app) { + return subscribed_app->IsFullscreen(); + }); + + if (app_ptr != subscribed_apps.end()) { + SDL_LOG_DEBUG("Sending button press for app in FULL with app id: " + << (*app_ptr)->app_id()); + SendButtonNotification(*app_ptr); + } else { + SDL_LOG_ERROR("No application found"); + } +} + +std::vector ButtonNotificationToMobile::SubscribedApps() + const { + const uint32_t btn_id = static_cast( + (*message_)[strings::msg_params][hmi_response::button_name].asInt()); + return application_manager_.applications_by_button(btn_id); +} + +void ButtonNotificationToMobile::HandleMediaButton( + app_mngr::ApplicationSharedPtr app) { + SDL_LOG_AUTO_TRACE(); + using namespace application_manager; + + if (app) { + const auto btn_id = static_cast( + (*message_)[strings::msg_params][hmi_response::button_name].asInt()); + + if (app->IsSubscribedToButton(btn_id)) { + SendButtonNotification(app); + } else { + SDL_LOG_ERROR("Application " << app->app_id() + << " is not subscribed to button " + << btn_id); + } + + return; + } + + const auto subscribed_apps = SubscribedApps(); + const auto app_ptr = + std::find_if(subscribed_apps.begin(), + subscribed_apps.end(), + [](const ApplicationSharedPtr subscribed_app) { + return helpers::Compare( + subscribed_app->hmi_level( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW), + mobile_api::HMILevel::HMI_FULL, + mobile_api::HMILevel::HMI_LIMITED); + }); + + if (app_ptr != subscribed_apps.end()) { + SendButtonNotification(*app_ptr); + } else { + SDL_LOG_ERROR("No application found"); + } +} + +void ButtonNotificationToMobile::Run() { + SDL_LOG_AUTO_TRACE(); + using namespace application_manager::strings; + + const uint32_t btn_id = static_cast( + (*message_)[msg_params][hmi_response::button_name].asInt()); + + SDL_LOG_DEBUG("Received button id: " << btn_id); + + ApplicationSharedPtr app; + + if (DoesParamExist(strings::app_id)) { + app = application_manager_.application( + (*message_)[msg_params][app_id].asUInt()); + } + + if (static_cast(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { + HandleCustomButton(app); + } else if (static_cast(mobile_apis::ButtonName::OK) == btn_id) { + HandleOKButton(app); + } else { + HandleMediaButton(app); + } +} + +} // namespace commands +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index c6ad7b79c1..8751823e85 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -71,6 +71,30 @@ namespace commands { SDL_CREATE_LOG_VARIABLE("Commands") +bool IsMobileResultSuccess(const mobile_apis::Result::eType result_code) { + using namespace helpers; + return Compare( + result_code, + mobile_apis::Result::SUCCESS, + mobile_apis::Result::WARNINGS, + mobile_apis::Result::WRONG_LANGUAGE, + mobile_apis::Result::RETRY, + mobile_apis::Result::SAVED, + mobile_apis::Result::TRUNCATED_DATA); +} + +bool IsHMIResultSuccess(const hmi_apis::Common_Result::eType result_code) { + using namespace helpers; + return Compare( + result_code, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::WRONG_LANGUAGE, + hmi_apis::Common_Result::RETRY, + hmi_apis::Common_Result::SAVED, + hmi_apis::Common_Result::TRUNCATED_DATA); +} + const int32_t CommandImpl::hmi_protocol_type_ = 1; const int32_t CommandImpl::mobile_protocol_type_ = 0; const int32_t CommandImpl::protocol_version_ = 3; @@ -545,5 +569,19 @@ bool CommandImpl::CheckSyntax(const std::string& str, return true; } +bool CommandImpl::IsHMIResultSuccess( + hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const { + SDL_LOG_AUTO_TRACE(); + if (application_manager::commands::IsHMIResultSuccess(result_code)) { + return true; + } + + const HmiInterfaces::InterfaceState state = + application_manager_.hmi_interfaces().GetInterfaceState(interface); + return hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code && + HmiInterfaces::STATE_NOT_AVAILABLE != state; +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 3b0c6bf98c..65fbf7e66f 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -161,7 +161,7 @@ ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result, interface_state = application_manager.hmi_interfaces().GetInterfaceState(hmi_interface); - is_ok = CommandRequestImpl::IsHMIResultSuccess(result_code); + is_ok = IsHMIResultSuccess(result_code); is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code; @@ -699,49 +699,11 @@ bool CommandRequestImpl::HasDisallowedParams() const { (!removed_parameters_permissions_.undefined_params.empty())); } -bool CommandRequestImpl::IsMobileResultSuccess( - const mobile_apis::Result::eType result_code) { - SDL_LOG_AUTO_TRACE(); - using namespace helpers; - return Compare( - result_code, - mobile_apis::Result::SUCCESS, - mobile_apis::Result::WARNINGS, - mobile_apis::Result::WRONG_LANGUAGE, - mobile_apis::Result::RETRY, - mobile_apis::Result::SAVED, - mobile_apis::Result::TRUNCATED_DATA); -} - -bool CommandRequestImpl::IsHMIResultSuccess( - const hmi_apis::Common_Result::eType result_code) { - SDL_LOG_AUTO_TRACE(); - using namespace helpers; - return Compare( - result_code, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED, - hmi_apis::Common_Result::TRUNCATED_DATA); -} - bool CommandRequestImpl::PrepareResultForMobileResponse( hmi_apis::Common_Result::eType result_code, HmiInterfaces::InterfaceID interface) const { SDL_LOG_AUTO_TRACE(); - if (IsHMIResultSuccess(result_code)) { - return true; - } - - const HmiInterfaces::InterfaceState state = - application_manager_.hmi_interfaces().GetInterfaceState(interface); - if ((hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code) && - (HmiInterfaces::STATE_NOT_AVAILABLE != state)) { - return true; - } - return false; + return IsHMIResultSuccess(result_code, interface); } bool CommandRequestImpl::PrepareResultForMobileResponse( diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc index 467001d8db..fca48854e2 100644 --- a/src/components/application_manager/src/commands/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/request_from_hmi.cc @@ -143,43 +143,6 @@ void RequestFromHMI::FillCommonParametersOfSO( (message)[strings::params][strings::correlation_id] = correlation_id; } -bool RequestFromHMI::IsMobileResultSuccess( - mobile_apis::Result::eType result_code) const { - SDL_LOG_AUTO_TRACE(); - using namespace helpers; - return Compare( - result_code, - mobile_apis::Result::SUCCESS, - mobile_apis::Result::WARNINGS, - mobile_apis::Result::WRONG_LANGUAGE, - mobile_apis::Result::RETRY, - mobile_apis::Result::SAVED); -} - -bool RequestFromHMI::IsHMIResultSuccess( - hmi_apis::Common_Result::eType result_code, - HmiInterfaces::InterfaceID interface) const { - SDL_LOG_AUTO_TRACE(); - using namespace helpers; - if (Compare( - result_code, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED)) { - return true; - } - - const HmiInterfaces::InterfaceState state = - application_manager_.hmi_interfaces().GetInterfaceState(interface); - if ((hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code) && - (HmiInterfaces::STATE_NOT_AVAILABLE != state)) { - return true; - } - return false; -} - void RequestFromHMI::SendProviderRequest( const mobile_apis::FunctionID::eType& mobile_function_id, const hmi_apis::FunctionID::eType& hmi_function_id, diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc index 35ac71c8bd..3c411b1605 100644 --- a/src/components/application_manager/src/commands/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/request_to_hmi.cc @@ -80,26 +80,6 @@ bool CheckAvailabilityHMIInterfaces(ApplicationManager& application_manager, return HmiInterfaces::STATE_NOT_AVAILABLE != state; } -bool IsResponseCodeSuccess( - const smart_objects::SmartObject& response_from_hmi) { - auto response_code = static_cast( - response_from_hmi[strings::params][hmi_response::code].asInt()); - - using helpers::Compare; - using helpers::EQ; - using helpers::ONE; - - const bool is_result_success = - Compare( - response_code, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED); - return is_result_success; -} - bool ChangeInterfaceState(ApplicationManager& application_manager, const smart_objects::SmartObject& response_from_hmi, HmiInterfaces::InterfaceID interface) { @@ -113,12 +93,14 @@ bool ChangeInterfaceState(ApplicationManager& application_manager, return false; } - // Process response with result - if (response_from_hmi[strings::params].keyExists(hmi_response::code) && - !IsResponseCodeSuccess(response_from_hmi)) { - application_manager.hmi_interfaces().SetInterfaceState( - interface, HmiInterfaces::STATE_NOT_AVAILABLE); - return false; + if (response_from_hmi[strings::params].keyExists(hmi_response::code)) { + auto response_code = static_cast( + response_from_hmi[strings::params][hmi_response::code].asInt()); + if (!IsHMIResultSuccess(response_code)) { + application_manager.hmi_interfaces().SetInterfaceState( + interface, HmiInterfaces::STATE_NOT_AVAILABLE); + return false; + } } application_manager.hmi_interfaces().SetInterfaceState( diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc index 863d85a7f0..09b8eed6fe 100644 --- a/src/components/application_manager/src/helpers/application_helper.cc +++ b/src/components/application_manager/src/helpers/application_helper.cc @@ -95,13 +95,19 @@ void DeleteGlobalProperties(ApplicationSharedPtr app, void DeleteButtonSubscriptions(ApplicationSharedPtr app, ApplicationManager& app_manager) { ButtonSubscriptions buttons = app->SubscribedButtons().GetData(); - for (auto button : buttons) { - if (mobile_apis::ButtonName::CUSTOM_BUTTON == button) { + const auto hmi_button = + static_cast(button); + if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == hmi_button) { continue; } - MessageHelper::SendUnsubscribeButtonNotification(button, app, app_manager); - app->UnsubscribeFromButton(button); + smart_objects::SmartObjectSPtr unsubscribe_request = + MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi( + app->app_id(), + hmi_button, + hmi_apis::FunctionID::Buttons_UnsubscribeButton, + app_manager); + app_manager.GetRPCService().ManageHMICommand(unsubscribe_request); } } diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc index 7365e5e081..205585959b 100644 --- a/src/components/application_manager/src/hmi_interfaces_impl.cc +++ b/src/components/application_manager/src/hmi_interfaces_impl.cc @@ -43,8 +43,8 @@ generate_function_to_interface_convert_map() { convert_map[Buttons_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_Buttons; convert_map[Buttons_OnButtonEvent] = HmiInterfaces::HMI_INTERFACE_Buttons; convert_map[Buttons_OnButtonPress] = HmiInterfaces::HMI_INTERFACE_Buttons; - convert_map[Buttons_OnButtonSubscription] = - HmiInterfaces::HMI_INTERFACE_Buttons; + convert_map[Buttons_SubscribeButton] = HmiInterfaces::HMI_INTERFACE_Buttons; + convert_map[Buttons_UnsubscribeButton] = HmiInterfaces::HMI_INTERFACE_Buttons; convert_map[BasicCommunication_OnReady] = HmiInterfaces::HMI_INTERFACE_BasicCommunication; convert_map[BasicCommunication_OnStartDeviceDiscovery] = diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index dde580adeb..decdabb55c 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -819,31 +819,6 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application, } } -void MessageHelper::SendUnsubscribeButtonNotification( - mobile_apis::ButtonName::eType button, - ApplicationSharedPtr application, - ApplicationManager& app_mngr) { - using namespace smart_objects; - using namespace hmi_apis; - - SmartObject msg_params = SmartObject(SmartType_Map); - msg_params[strings::app_id] = application->app_id(); - msg_params[strings::name] = button; - msg_params[strings::is_suscribed] = false; - - SmartObjectSPtr message = CreateMessageForHMI( - hmi_apis::messageType::notification, app_mngr.GetNextHMICorrelationID()); - DCHECK(message); - - SmartObject& object = *message; - object[strings::params][strings::function_id] = - hmi_apis::FunctionID::Buttons_OnButtonSubscription; - - object[strings::msg_params] = msg_params; - - app_mngr.GetRPCService().ManageHMICommand(message); -} - const VehicleData& MessageHelper::vehicle_data() { return vehicle_data_; } @@ -1098,104 +1073,119 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon( return set_icon; } -void MessageHelper::SendOnButtonSubscriptionNotification( - uint32_t app_id, - hmi_apis::Common_ButtonName::eType button, - bool is_subscribed, - ApplicationManager& app_mngr) { - using namespace smart_objects; - using namespace hmi_apis; +smart_objects::SmartObjectSPtr MessageHelper::CreateButtonNotificationToMobile( + ApplicationSharedPtr app, + const smart_objects::SmartObject& source_message) { SDL_LOG_AUTO_TRACE(); - SmartObjectSPtr notification_ptr = - std::make_shared(SmartType_Map); - if (!notification_ptr) { - SDL_LOG_ERROR("Memory allocation failed."); - return; + if (!app) { + SDL_LOG_ERROR("application NULL pointer"); + return std::make_shared( + smart_objects::SmartType_Null); } - SmartObject& notification = *notification_ptr; - SmartObject msg_params = SmartObject(SmartType_Map); - msg_params[strings::app_id] = app_id; - msg_params[strings::name] = button; - msg_params[strings::is_suscribed] = is_subscribed; + smart_objects::SmartObjectSPtr msg = + std::make_shared( + smart_objects::SmartType_Map); - notification[strings::params][strings::message_type] = - static_cast(application_manager::MessageType::kNotification); - notification[strings::params][strings::protocol_version] = - commands::CommandImpl::protocol_version_; - notification[strings::params][strings::protocol_type] = - commands::CommandImpl::hmi_protocol_type_; - notification[strings::params][strings::function_id] = - hmi_apis::FunctionID::Buttons_OnButtonSubscription; - notification[strings::msg_params] = msg_params; + smart_objects::SmartObject& ref = *msg; + ref[strings::params][strings::connection_key] = app->app_id(); + + const auto function_id = static_cast( + source_message[strings::params][strings::function_id].asInt()); + ref[strings::params][strings::function_id] = function_id; + + mobile_apis::ButtonName::eType btn_id = mobile_apis::ButtonName::INVALID_ENUM; - if (!app_mngr.GetRPCService().ManageHMICommand(notification_ptr)) { - SDL_LOG_ERROR("Unable to send HMI notification"); + if (source_message[strings::msg_params].keyExists( + hmi_response::button_name)) { + btn_id = static_cast( + source_message[strings::msg_params][hmi_response::button_name].asInt()); + + } else if (source_message[strings::msg_params].keyExists( + strings::button_name)) { + btn_id = static_cast( + source_message[strings::msg_params][strings::button_name].asInt()); } -} -void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp( - ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - using namespace smart_objects; - using namespace hmi_apis; - using namespace mobile_apis; - SDL_LOG_AUTO_TRACE(); + if (btn_id == mobile_apis::ButtonName::PLAY_PAUSE && + app->msg_version() <= utils::base_rpc_version) { + btn_id = mobile_apis::ButtonName::OK; + } - if (app.use_count() == 0) { - SDL_LOG_ERROR("Invalid application pointer "); - return; + ref[strings::msg_params][strings::button_name] = btn_id; + + auto get_mode_code = [&source_message]( + const std::string& hmi_param_name, + const std::string& mobile_param_name) -> int64_t { + if (source_message[strings::msg_params].keyExists(hmi_param_name)) { + return source_message[strings::msg_params][hmi_param_name].asInt(); + } + + if (source_message[strings::msg_params].keyExists(mobile_param_name)) { + return source_message[strings::msg_params][mobile_param_name].asInt(); + } + + return -1; + }; + + if (mobile_apis::FunctionID::eType::OnButtonPressID == function_id) { + const auto press_mode = static_cast( + get_mode_code(hmi_response::button_mode, strings::button_press_mode)); + ref[strings::msg_params][strings::button_press_mode] = press_mode; } - const ButtonSubscriptions subscriptions = app->SubscribedButtons().GetData(); - ButtonSubscriptions::iterator it = subscriptions.begin(); - for (; subscriptions.end() != it; ++it) { - SendOnButtonSubscriptionNotification( - app->hmi_app_id(), - static_cast(*it), - true, - app_mngr); + if (mobile_apis::FunctionID::eType::OnButtonEventID == function_id) { + const auto press_mode = static_cast( + get_mode_code(hmi_response::button_mode, strings::button_event_mode)); + ref[strings::msg_params][strings::button_event_mode] = press_mode; } + + if (source_message[strings::msg_params].keyExists( + hmi_response::custom_button_id)) { + ref[strings::msg_params][strings::custom_button_id] = + source_message[strings::msg_params][strings::custom_button_id]; + } + + if (source_message[strings::msg_params].keyExists(strings::window_id)) { + ref[strings::msg_params][strings::window_id] = + source_message[strings::msg_params][strings::window_id]; + } + + return msg; } smart_objects::SmartObjectSPtr -MessageHelper::CreateOnButtonSubscriptionNotification( - uint32_t app_id, - hmi_apis::Common_ButtonName::eType button, - bool is_subscribed) { +MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi( + const uint32_t app_id, + const hmi_apis::Common_ButtonName::eType button_name, + const hmi_apis::FunctionID::eType function_id, + application_manager::ApplicationManager& app_mngr) { using namespace smart_objects; - using namespace hmi_apis; SDL_LOG_AUTO_TRACE(); - SmartObjectSPtr notification_ptr = - std::make_shared(SmartType_Map); - SmartObject& notification = *notification_ptr; + + SmartObjectSPtr request_ptr = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + + SmartObject& request = *request_ptr; SmartObject msg_params = SmartObject(SmartType_Map); msg_params[strings::app_id] = app_id; - msg_params[strings::name] = button; - msg_params[strings::is_suscribed] = is_subscribed; - notification[strings::params][strings::message_type] = - static_cast(application_manager::MessageType::kNotification); - notification[strings::params][strings::protocol_version] = - commands::CommandImpl::protocol_version_; - notification[strings::params][strings::protocol_type] = - commands::CommandImpl::hmi_protocol_type_; - notification[strings::params][strings::function_id] = - hmi_apis::FunctionID::Buttons_OnButtonSubscription; - notification[strings::msg_params] = msg_params; - return notification_ptr; + msg_params[strings::button_name] = button_name; + request[strings::params][strings::function_id] = function_id; + request[strings::msg_params] = msg_params; + return request_ptr; } smart_objects::SmartObjectList -MessageHelper::CreateOnButtonSubscriptionNotificationsForApp( +MessageHelper::CreateButtonSubscriptionsHandlingRequestsList( ApplicationConstSharedPtr app, - ApplicationManager& app_mngr, - const ButtonSubscriptions& button_subscriptions) { - using namespace smart_objects; + const ButtonSubscriptions& button_subscriptions, + const hmi_apis::FunctionID::eType function_id, + ApplicationManager& app_mngr) { using namespace hmi_apis; - using namespace mobile_apis; SDL_LOG_AUTO_TRACE(); - SmartObjectList button_subscription_requests; + smart_objects::SmartObjectList button_subscription_requests; if (app.use_count() == 0) { SDL_LOG_ERROR("Invalid application pointer "); @@ -1207,7 +1197,8 @@ MessageHelper::CreateOnButtonSubscriptionNotificationsForApp( static_cast(it); button_subscription_requests.push_back( - CreateOnButtonSubscriptionNotification(app->hmi_app_id(), btn, true)); + CreateButtonSubscriptionHandlingRequestToHmi( + app->app_id(), btn, function_id, app_mngr)); } return button_subscription_requests; diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc index 18b1f8a2a3..598b7a6ccb 100644 --- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc +++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc @@ -162,6 +162,11 @@ void ResumptionDataProcessorImpl::ProcessResumptionStatus( CheckVehicleDataResponse(found_request.message, response, status); } + if (hmi_apis::FunctionID::Buttons_SubscribeButton == + found_request.request_id.function_id) { + ProcessSubscribeButtonResponse(app_id, found_request.message, response); + } + if (hmi_apis::FunctionID::UI_CreateWindow == found_request.request_id.function_id) { CheckCreateWindowResponse(found_request.message, response); @@ -857,6 +862,7 @@ void ResumptionDataProcessorImpl::AddButtonsSubscriptions( const smart_objects::SmartObject& subscriptions = saved_app[strings::application_subscriptions]; + ButtonSubscriptions button_subscriptions; if (subscriptions.keyExists(strings::application_buttons)) { const smart_objects::SmartObject& subscriptions_buttons = subscriptions[strings::application_buttons]; @@ -864,31 +870,20 @@ void ResumptionDataProcessorImpl::AddButtonsSubscriptions( for (size_t i = 0; i < subscriptions_buttons.length(); ++i) { btn = static_cast( (subscriptions_buttons[i]).asInt()); - application->SubscribeToButton(btn); + if (mobile_apis::ButtonName::CUSTOM_BUTTON != btn) { + button_subscriptions.insert(btn); + } } - ButtonSubscriptions button_subscriptions = - GetButtonSubscriptionsToResume(application); - ProcessMessagesToHMI( - MessageHelper::CreateOnButtonSubscriptionNotificationsForApp( - application, application_manager_, button_subscriptions)); + MessageHelper::CreateButtonSubscriptionsHandlingRequestsList( + application, + button_subscriptions, + hmi_apis::FunctionID::Buttons_SubscribeButton, + application_manager_)); } } -ButtonSubscriptions ResumptionDataProcessorImpl::GetButtonSubscriptionsToResume( - ApplicationSharedPtr application) const { - ButtonSubscriptions button_subscriptions = - application->SubscribedButtons().GetData(); - auto it = button_subscriptions.find(mobile_apis::ButtonName::CUSTOM_BUTTON); - - if (it != button_subscriptions.end()) { - button_subscriptions.erase(it); - } - - return button_subscriptions; -} - void ResumptionDataProcessorImpl::AddPluginsSubscriptions( ApplicationSharedPtr application, const smart_objects::SmartObject& saved_app) { @@ -916,11 +911,13 @@ void ResumptionDataProcessorImpl::DeleteButtonsSubscriptions( if (hmi_apis::Common_ButtonName::CUSTOM_BUTTON == hmi_btn) { continue; } - auto notification = MessageHelper::CreateOnButtonSubscriptionNotification( - application->hmi_app_id(), hmi_btn, false); - // is_subscribed = false - ProcessMessageToHMI(notification, false); - application->UnsubscribeFromButton(btn); + smart_objects::SmartObjectSPtr unsubscribe_request = + MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi( + application->app_id(), + hmi_btn, + hmi_apis::FunctionID::Buttons_UnsubscribeButton, + application_manager_); + ProcessMessageToHMI(unsubscribe_request, false); } } @@ -1007,7 +1004,7 @@ bool IsResponseSuccessful(const smart_objects::SmartObject& response) { response[strings::params][application_manager::hmi_response::code] .asInt()); - return commands::CommandRequestImpl::IsHMIResultSuccess(result_code) || + return commands::IsHMIResultSuccess(result_code) || hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code; } @@ -1046,6 +1043,26 @@ void ResumptionDataProcessorImpl::CheckVehicleDataResponse( } } +void ResumptionDataProcessorImpl::ProcessSubscribeButtonResponse( + const uint32_t app_id, + const smart_objects::SmartObject& request, + const smart_objects::SmartObject& response) { + SDL_LOG_AUTO_TRACE(); + if (!IsResponseSuccessful(response)) { + return; + } + + ApplicationSharedPtr app = application_manager_.application(app_id); + if (!app) { + SDL_LOG_ERROR("NULL pointer."); + return; + } + const mobile_apis::ButtonName::eType btn_id = + static_cast( + request[strings::msg_params][strings::button_name].asInt()); + app->SubscribeToButton(btn_id); +} + void ResumptionDataProcessorImpl::CheckModuleDataSubscription( const ns_smart_device_link::ns_smart_objects::SmartObject& request, const ns_smart_device_link::ns_smart_objects::SmartObject& response, diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc index 5c6d3b22f6..1f1a76298c 100644 --- a/src/components/application_manager/test/application_helper_test.cc +++ b/src/components/application_manager/test/application_helper_test.cc @@ -149,7 +149,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) { const uint32_t cmd_id = 1; const uint32_t menu_id = 2; const uint32_t choice_set_id = 3; - const mobile_apis::ButtonName::eType button = mobile_apis::ButtonName::AC; smart_objects::SmartObject cmd(smart_objects::SmartType_Map); cmd[strings::msg_params][strings::cmd_id] = cmd_id; @@ -163,8 +162,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) { app_impl_->AddSubMenu(menu_id, cmd[strings::menu_params]); app_impl_->AddChoiceSet(choice_set_id, cmd[strings::msg_params]); - EXPECT_TRUE(app_impl_->SubscribeToButton(button)); - const std::string some_string = "some_string"; smart_objects::SmartObject dummy_data = smart_objects::SmartObject(smart_objects::SmartType_String); @@ -191,7 +188,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) { EXPECT_TRUE(smart_objects::SmartType_Null != sub_menu1.getType()); const auto choice_set1 = app_impl_->FindChoiceSet(choice_set_id); EXPECT_TRUE(smart_objects::SmartType_Null != choice_set1.getType()); - EXPECT_TRUE(app_impl_->IsSubscribedToButton(button)); auto help_prompt = app_impl_->help_prompt(); EXPECT_TRUE(help_prompt->asString() == some_string); auto timeout_prompt = app_impl_->timeout_prompt(); @@ -227,7 +223,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) { EXPECT_TRUE(smart_objects::SmartType_Null == sub_menu2.getType()); const auto choice_set2 = app_impl_->FindChoiceSet(choice_set_id); EXPECT_TRUE(smart_objects::SmartType_Null == choice_set2.getType()); - EXPECT_FALSE(app_impl_->IsSubscribedToButton(button)); help_prompt = app_impl_->help_prompt(); EXPECT_FALSE(help_prompt->asString() == some_string); timeout_prompt = app_impl_->timeout_prompt(); @@ -261,7 +256,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) { app_impl_->AddCommand(cmd_id, cmd[strings::msg_params]); app_impl_->AddSubMenu(menu_id, cmd[strings::menu_params]); app_impl_->AddChoiceSet(choice_set_id, cmd[strings::msg_params]); - app_impl_->SubscribeToButton(mobile_apis::ButtonName::AC); EXPECT_CALL(*mock_message_helper_, CreateDeleteUICommandRequest(_, _, _)) .WillOnce(Return(std::make_shared())); @@ -275,9 +269,6 @@ TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) { EXPECT_CALL(*mock_message_helper_, SendResetPropertiesRequest(_, _)); - EXPECT_CALL(*mock_message_helper_, - SendUnsubscribeButtonNotification(_, _, _)); - // Act application_manager::DeleteApplicationData(app_impl_, app_manager_impl_); } diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc index 5f23e97391..1e58ce8636 100644 --- a/src/components/application_manager/test/application_impl_test.cc +++ b/src/components/application_manager/test/application_impl_test.cc @@ -560,9 +560,9 @@ TEST_F(ApplicationImplTest, SubscribeToButton_UnsubscribeFromButton) { EXPECT_FALSE(app_impl->IsSubscribedToButton(ButtonName::PRESET_0)); } -TEST_F(ApplicationImplTest, SubscribeToDefaultButton_UnsubscribeFromButton) { - EXPECT_TRUE(app_impl->IsSubscribedToButton(ButtonName::CUSTOM_BUTTON)); - EXPECT_FALSE(app_impl->SubscribeToButton(ButtonName::CUSTOM_BUTTON)); +TEST_F(ApplicationImplTest, NotSubscribedToDefaultButton_SubscribeToButton) { + EXPECT_FALSE(app_impl->IsSubscribedToButton(ButtonName::CUSTOM_BUTTON)); + EXPECT_TRUE(app_impl->SubscribeToButton(ButtonName::CUSTOM_BUTTON)); } TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) { diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index 82a0574c7f..9e69b0bcd6 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -125,11 +125,12 @@ class MockMessageHelper { MOCK_METHOD2(CreateHMIStatusNotification, smart_objects::SmartObjectSPtr(ApplicationSharedPtr application, const WindowID window_id)); - MOCK_METHOD3(CreateOnButtonSubscriptionNotificationsForApp, + MOCK_METHOD4(CreateButtonSubscriptionsHandlingRequestsList, smart_objects::SmartObjectList( ApplicationConstSharedPtr application, - ApplicationManager& app_mngr, - const ButtonSubscriptions& button_subscriptions)); + const ButtonSubscriptions& button_subscriptions, + const hmi_apis::FunctionID::eType function_id, + ApplicationManager& app_mngr)); MOCK_METHOD4(SendPolicyUpdate, void(const std::string& file_path, const uint32_t timeout, @@ -172,9 +173,6 @@ class MockMessageHelper { MOCK_METHOD2(CreateModuleInfoSO, smart_objects::SmartObjectSPtr(uint32_t function_id, ApplicationManager& app_mngr)); - MOCK_METHOD2(SendAllOnButtonSubscriptionNotificationsForApp, - void(ApplicationConstSharedPtr app, - ApplicationManager& app_mngr)); MOCK_METHOD2(CreateUIResetGlobalPropertiesRequest, smart_objects::SmartObjectSPtr( const ResetGlobalPropertiesResult& reset_result, @@ -196,11 +194,18 @@ class MockMessageHelper { MOCK_METHOD1(CreateSubscribeWayPointsMessageToHMI, smart_objects::SmartObjectSPtr(const uint32_t correlation_id)); - MOCK_METHOD3( - CreateOnButtonSubscriptionNotification, - smart_objects::SmartObjectSPtr(uint32_t app_id, - hmi_apis::Common_ButtonName::eType button, - bool is_subscribed)); + MOCK_METHOD4(CreateButtonSubscriptionHandlingRequestToHmi, + smart_objects::SmartObjectSPtr( + const uint32_t app_id, + const hmi_apis::Common_ButtonName::eType button_name, + const hmi_apis::FunctionID::eType function_id, + application_manager::ApplicationManager& app_mngr)); + + MOCK_METHOD2(CreateButtonNotificationToMobile, + smart_objects::SmartObjectSPtr( + ApplicationSharedPtr app, + const smart_objects::SmartObject& source_message)); + MOCK_METHOD2(SendOnResumeAudioSourceToHMI, void(uint32_t app_id, ApplicationManager& app_mngr)); MOCK_METHOD2(CreateAddSubMenuRequestsToHMI, @@ -352,10 +357,6 @@ class MockMessageHelper { MOCK_METHOD2(SendResetPropertiesRequest, void(ApplicationSharedPtr application, ApplicationManager& app_mngr)); - MOCK_METHOD3(SendUnsubscribeButtonNotification, - void(mobile_apis::ButtonName::eType button, - ApplicationSharedPtr application, - ApplicationManager& app_mngr)); MOCK_METHOD1(CreateAppServiceCapabilities, smart_objects::SmartObject( std::vector& all_services)); diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 3cab2be0fb..02cf70e3ba 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -269,11 +269,6 @@ MockMessageHelper* MockMessageHelper::message_helper_mock() { static ::testing::NiceMock message_helper_mock; return &message_helper_mock; } -void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp( - ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - MockMessageHelper::message_helper_mock() - ->SendAllOnButtonSubscriptionNotificationsForApp(app, app_mngr); -} void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id, ApplicationManager& app_mngr) { @@ -600,30 +595,32 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( } smart_objects::SmartObjectSPtr -MessageHelper::CreateOnButtonSubscriptionNotification( - uint32_t app_id, - hmi_apis::Common_ButtonName::eType button, - bool is_subscribed) { +MessageHelper::CreateButtonSubscriptionHandlingRequestToHmi( + const uint32_t app_id, + const hmi_apis::Common_ButtonName::eType button_name, + const hmi_apis::FunctionID::eType function_id, + ApplicationManager& app_mngr) { return MockMessageHelper::message_helper_mock() - ->CreateOnButtonSubscriptionNotification(app_id, button, is_subscribed); + ->CreateButtonSubscriptionHandlingRequestToHmi( + app_id, button_name, function_id, app_mngr); } -smart_objects::SmartObjectList -MessageHelper::CreateOnButtonSubscriptionNotificationsForApp( - ApplicationConstSharedPtr application, - ApplicationManager& app_mngr, - const ButtonSubscriptions& button_subscriptions) { +smart_objects::SmartObjectSPtr MessageHelper::CreateButtonNotificationToMobile( + ApplicationSharedPtr app, + const smart_objects::SmartObject& source_message) { return MockMessageHelper::message_helper_mock() - ->CreateOnButtonSubscriptionNotificationsForApp( - application, app_mngr, button_subscriptions); + ->CreateButtonNotificationToMobile(app, source_message); } -void MessageHelper::SendUnsubscribeButtonNotification( - mobile_apis::ButtonName::eType button, - ApplicationSharedPtr application, +smart_objects::SmartObjectList +MessageHelper::CreateButtonSubscriptionsHandlingRequestsList( + ApplicationConstSharedPtr app, + const ButtonSubscriptions& button_subscriptions, + const hmi_apis::FunctionID::eType function_id, ApplicationManager& app_mngr) { return MockMessageHelper::message_helper_mock() - ->SendUnsubscribeButtonNotification(button, application, app_mngr); + ->CreateButtonSubscriptionsHandlingRequestsList( + app, button_subscriptions, function_id, app_mngr); } smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities( diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc index f5ccd99ee0..1ff04c332c 100644 --- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc +++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc @@ -604,19 +604,13 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) { ON_CALL(*mock_app_, SubscribedButtons()) .WillByDefault(Return(button_subscription_accessor)); - smart_objects::SmartObjectList button_subscription_notifications; + smart_objects::SmartObjectList button_subscription_requests_list; ON_CALL(*application_manager::MockMessageHelper::message_helper_mock(), - CreateOnButtonSubscriptionNotificationsForApp(_, _, _)) - .WillByDefault(Return(button_subscription_notifications)); + CreateButtonSubscriptionsHandlingRequestsList(_, _, _, _)) + .WillByDefault(Return(button_subscription_requests_list)); EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_)); - for (uint32_t i = 0; i < count_of_buttons; ++i) { - EXPECT_CALL( - *mock_app_, - SubscribeToButton(static_cast(i))); - } - std::list extensions; extensions.insert(extensions.begin(), mock_app_extension_); @@ -624,7 +618,7 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) { EXPECT_CALL(*mock_app_extension_, ProcessResumption(saved_app)); EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(), - CreateOnButtonSubscriptionNotificationsForApp(_, _, _)); + CreateButtonSubscriptionsHandlingRequestsList(_, _, _, _)); const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_); EXPECT_TRUE(res); diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 708bf8b048..72a322f336 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -119,6 +119,11 @@ struct ApplicationsPolicyAppIdSorter { } }; +struct ExpiredButtonRequestData { + uint32_t app_id_; + hmi_apis::Common_ButtonName::eType button_name_; +}; + typedef std::set ApplicationSet; typedef std::set @@ -947,6 +952,35 @@ class ApplicationManager { */ virtual bool UnsubscribeAppFromSoftButtons( const commands::MessageSharedPtr response_message) = 0; + + /** + * @brief Save subscribe/unsubscribe button request after timeout to ensure + * possibility to align mobile subscription/unsubscription status with actual + * subscription/unsubscription status on HMI + * @param app_id Application id from request message + * @param corr_id Correlation id + * @param button_name name of button to subscribe/unsubscribe + */ + virtual void AddExpiredButtonRequest( + const uint32_t app_id, + const int32_t corr_id, + const hmi_apis::Common_ButtonName::eType button_name) = 0; + + /** + * @brief Return optional structure with information regarding + * subscribe/unsubscribe button request data + * @param corr_id Correlation id + * @return optional structure with subscribe/unsubscribe button request data + */ + virtual utils::Optional GetExpiredButtonRequestData( + const int32_t corr_id) const = 0; + + /** + * @brief Delete data about already processed expired subscribe/unsubscribe + * button request in case if HMI send response to expired request + * @param corr_id Correlation id + */ + virtual void DeleteExpiredButtonRequest(const int32_t corr_id) = 0; }; } // namespace application_manager diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 525197cb49..116d758ec4 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -396,6 +396,15 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_CONST_METHOD0(GetCommandFactory, application_manager::CommandFactory&()); MOCK_CONST_METHOD0(get_current_audio_source, uint32_t()); MOCK_METHOD1(set_current_audio_source, void(const uint32_t)); + MOCK_METHOD3(AddExpiredButtonRequest, + void(const uint32_t app_id, + const int32_t corr_id, + const hmi_apis::Common_ButtonName::eType button_name)); + MOCK_CONST_METHOD1( + GetExpiredButtonRequestData, + utils::Optional( + const int32_t corr_id)); + MOCK_METHOD1(DeleteExpiredButtonRequest, void(const int32_t corr_id)); }; } // namespace application_manager_test diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index 9b09f239fe..f5a8ce163d 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -4546,24 +4546,30 @@ - + - Sender: SDL->HMI. Purpose: to notify about button subscription state is changed for the named application + Subscribes to buttons. - - - - Defines whether the named button has status of 'subscribed' or 'unsubscribed': - If "true" - the named button is subscribed. - If "false" - the named button is unsubscribed. - + + The ID of the application requesting this button subscription. + + Name of the button to subscribe. + + + + + + Unsubscribes from buttons. + - - The ID of application that relates to this button-subscription status change. - + The ID of the application requesting this button unsubscription. + + + Name of the button to unsubscribe from. + -- cgit v1.2.1 From 04c02ecf27fbc82060adb9dfc57ea00b8e52a481 Mon Sep 17 00:00:00 2001 From: Collin Date: Thu, 12 Aug 2021 17:19:43 -0400 Subject: IsHMIResultSuccess was moved (#3754) --- .../sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc index 49e76ae327..09346dc20a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc @@ -230,7 +230,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { return; } - if (IsHMIResultSuccess(result_code)) { + if (application_manager::commands::IsHMIResultSuccess(result_code)) { const auto cmd_id = msg_params[strings::cmd_id].asUInt(); SDL_LOG_DEBUG("Removing UI Command: " << cmd_id); app->RemoveCommand(cmd_id); @@ -279,7 +279,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { return; } - if (IsHMIResultSuccess(result_code)) { + if (application_manager::commands::IsHMIResultSuccess(result_code)) { const auto menu_id = msg_params[strings::menu_id].asUInt(); SDL_LOG_DEBUG("Removing submenuID: " << menu_id); app->RemoveSubMenu(menu_id); -- cgit v1.2.1 From 6cbe18ff879afbd86d6c3718afa2d4bca43dfc1a Mon Sep 17 00:00:00 2001 From: "Vadym Luchko (GitHub)" <76956836+VadymLuchko@users.noreply.github.com> Date: Mon, 16 Aug 2021 16:49:47 +0300 Subject: [SDL 0205] Avoid custom button subscription by default (#3744) * Add SubscribeButtonRequest and SubscribeButtonResponse classes * unsubscribe buttons implementation (#197) * Resume button subscriptions * Remove OnButtonSubscription notification * Unify approach to result codes processing * Add shared base class for mobile button notifications * Revert expired button requests if response was received after timeout * Fix CUSTOM_BUTTON subscription logic Was removed subscription to custom button by default. Also, added check if app is actually subscribed to CUSTOM_BUTTON like for all other buttons. * Separate subscription processing for mobile requests and resumption * Fix affected unit tests * Return on_event() back to HMI subscription request * Add unit tests for subscribe and unsubscribe button * Avoid subscribe to custom button by default * Address Livio comments * Address Livio comments * fixup! Address Livio comments * Update CUSTOM_BUTTON logic * Fix tests after merge conflicts Co-authored-by: Yana Chernysheva Co-authored-by: Andrii Kalinich Co-authored-by: Olha Vorobiova --- src/appMain/hmi_capabilities.json | 6 ++++++ .../mobile/register_app_interface_request.h | 5 ++--- .../mobile/register_app_interface_request.cc | 9 ++++++--- .../mobile/register_app_interface_request_test.cc | 21 +++++++++++---------- .../test/hmi_capabilities_test.cc | 1 - .../include/application_manager/hmi_capabilities.h | 2 +- 6 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json index 8adb8da4b7..e5ee4f00b6 100755 --- a/src/appMain/hmi_capabilities.json +++ b/src/appMain/hmi_capabilities.json @@ -1160,6 +1160,12 @@ "shortPressAvailable": true, "longPressAvailable": true, "upDownAvailable": true + }, + { + "name" : "CUSTOM_BUTTON", + "longPressAvailable" : true, + "shortPressAvailable" : true, + "upDownAvailable" : true } ], "presetBankCapabilities": { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index ae52caf0f7..b3359f7752 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -210,10 +210,9 @@ class RegisterAppInterfaceRequest const std::string& param, const std::string& backup_value); /** - * @brief Sends ButtonSubscription notification at start up - * to notify HMI that app subscribed on the custom button by default. + * @brief Sends ButtonSubscription request if approved by hmi_capabilities */ - void SendSubscribeCustomButtonNotification(); + void SendSubscribeCustomButtonRequest(); /** * @brief IsApplicationSwitched checks whether application is switched diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index a43603294a..53820eccbb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -703,8 +703,11 @@ void RegisterAppInterfaceRequest::Run() { SendOnAppRegisteredNotificationToHMI( application, is_resumption_required && !is_resumption_failed_); - // By default app subscribed to CUSTOM_BUTTON - SendSubscribeCustomButtonNotification(); + if (CheckHMICapabilities(mobile_apis::ButtonName::CUSTOM_BUTTON)) { + SDL_LOG_DEBUG("CUSTOM_BUTTON available"); + SendSubscribeCustomButtonRequest(); + } + SendChangeRegistrationOnHMI(application); if (is_resumption_required) { @@ -1461,7 +1464,7 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam( } } -void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() { +void RegisterAppInterfaceRequest::SendSubscribeCustomButtonRequest() { SDL_LOG_AUTO_TRACE(); using namespace smart_objects; SmartObject msg_params = SmartObject(SmartType_Map); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc index 5d940c4f4c..0624c873fa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc @@ -461,6 +461,17 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) { .WillByDefault( Return(application_manager::HmiInterfaces::HMI_INTERFACE_Buttons)); + ON_CALL(mock_hmi_capabilities_, is_ui_cooperating()) + .WillByDefault(Return(true)); + + MessageSharedPtr button_caps_ptr = + CreateMessage(smart_objects::SmartType_Map); + (*button_caps_ptr)[0][am::hmi_response::button_name] = + mobile_apis::ButtonName::CUSTOM_BUTTON; + + ON_CALL(mock_hmi_capabilities_, button_capabilities()) + .WillByDefault(Return(button_caps_ptr)); + EXPECT_CALL( mock_rpc_service_, ManageHMICommand( @@ -584,11 +595,6 @@ TEST_F(RegisterAppInterfaceRequestTest, hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_SubscribeButton), _)) - .WillOnce(Return(true)); EXPECT_CALL( mock_rpc_service_, ManageHMICommand( @@ -848,11 +854,6 @@ TEST_F(RegisterAppInterfaceRequestTest, hmi_apis::FunctionID::BasicCommunication_OnAppRegistered), _)) .WillOnce(Return(true)); - EXPECT_CALL( - mock_rpc_service_, - ManageHMICommand( - HMIResultCodeIs(hmi_apis::FunctionID::Buttons_SubscribeButton), _)) - .WillOnce(Return(true)); EXPECT_CALL( mock_rpc_service_, ManageHMICommand( diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc index c83dd76978..2127f46b69 100644 --- a/src/components/application_manager/test/hmi_capabilities_test.cc +++ b/src/components/application_manager/test/hmi_capabilities_test.cc @@ -286,7 +286,6 @@ TEST_F( // Count of buttons in json file const size_t btn_length = buttons_capabilities_so.length(); - EXPECT_EQ(16ull, btn_length); for (size_t index = 0; index < btn_length; ++index) { EXPECT_TRUE(buttons_capabilities_so [index][rc_rpc_plugin::enums_value::kShortPressAvailable] diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h index 93f3db76cb..93cb09737d 100644 --- a/src/components/include/application_manager/hmi_capabilities.h +++ b/src/components/include/application_manager/hmi_capabilities.h @@ -274,7 +274,7 @@ class HMICapabilities { /** * @brief Sets supported Button's capabilities - * @param soft_button_capabilities supported Button's capabilities + * @param button_capabilities supported Button's capabilities */ virtual void set_button_capabilities( const smart_objects::SmartObject& button_capabilities) = 0; -- cgit v1.2.1 From 042872f24b2cf7d9c1b18cab81d502071de4b5a7 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Tue, 17 Aug 2021 11:45:31 -0400 Subject: Remove minimum value for AppIconsFolderMaxSize (#3756) --- src/components/config_profile/src/profile.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index ad624a22a9..f318ec98f5 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -1444,10 +1444,6 @@ void Profile::UpdateValues() { kSDL4Section, kAppIconsFolderMaxSizeKey); - if (app_icons_folder_max_size_ < kDefaultAppIconsFolderMaxSize) { - app_icons_folder_max_size_ = kDefaultAppIconsFolderMaxSize; - } - LOG_UPDATED_VALUE( app_icons_folder_max_size_, kAppIconsFolderMaxSizeKey, kSDL4Section); -- cgit v1.2.1 From ca0cdaf10bae555a7bb5bdec0026adcc5f317eb6 Mon Sep 17 00:00:00 2001 From: Akihiro-Miyazaki <60722633+Akihiro-Miyazaki@users.noreply.github.com> Date: Thu, 19 Aug 2021 06:23:30 +0900 Subject: Modify the code files according to sdl0264 proposal (#3738) --- .../include/application_manager/hmi_state.h | 2 -- .../application_manager/src/hmi_state.cc | 26 ---------------------- .../test/state_controller/state_controller_test.cc | 12 +++++----- 3 files changed, 6 insertions(+), 34 deletions(-) diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index e3a9784346..8271edcbd8 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -434,13 +434,11 @@ class PhoneCallHmiState : public HmiState { PhoneCallHmiState(std::shared_ptr app, const ApplicationManager& app_mngr); - mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { return mobile_apis::AudioStreamingState::NOT_AUDIBLE; } - mobile_apis::HMILevel::eType max_hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType max_audio_streaming_state() const OVERRIDE { return audio_streaming_state(); diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index cebcdfd203..07200af6cd 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -241,32 +241,6 @@ PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {} -mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { - using namespace mobile_apis; - if (HMILevel::INVALID_ENUM == parent_hmi_level()) { - return parent_hmi_level(); - } - return std::max(parent_hmi_level(), max_hmi_level()); -} - -mobile_apis::HMILevel::eType PhoneCallHmiState::max_hmi_level() const { - using namespace helpers; - using namespace mobile_apis; - - if (WindowType::WIDGET == window_type()) { - return std::max(HMILevel::HMI_FULL, parent_max_hmi_level()); - } - - auto expected = HMILevel::HMI_FULL; - if (is_navi_app() || is_mobile_projection_app()) { - expected = HMILevel::HMI_LIMITED; - } else if (is_media_app() || is_voice_communication_app()) { - expected = HMILevel::HMI_BACKGROUND; - } - - return std::max(expected, parent_max_hmi_level()); -} - SafetyModeHmiState::SafetyModeHmiState(std::shared_ptr app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_SAFETY_MODE) {} diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc index 2730489d17..fa301e73ca 100644 --- a/src/components/application_manager/test/state_controller/state_controller_test.cc +++ b/src/components/application_manager/test/state_controller/state_controller_test.cc @@ -392,22 +392,22 @@ class StateControllerImplTest : public ::testing::Test { case APP_TYPE_MEDIA: { PrepareCommonStateResults(result_hmi_state); result_hmi_state.push_back( - createHmiState(HMILevel::HMI_BACKGROUND, + createHmiState(HMILevel::HMI_LIMITED, AudioStreamingState::NOT_AUDIBLE, VideoStreamingState::NOT_STREAMABLE, SystemContext::SYSCTXT_MAIN)); result_hmi_state.push_back( - createHmiState(HMILevel::HMI_BACKGROUND, + createHmiState(HMILevel::HMI_LIMITED, AudioStreamingState::NOT_AUDIBLE, VideoStreamingState::NOT_STREAMABLE, SystemContext::SYSCTXT_MAIN)); result_hmi_state.push_back( - createHmiState(HMILevel::HMI_BACKGROUND, + createHmiState(HMILevel::HMI_FULL, AudioStreamingState::NOT_AUDIBLE, VideoStreamingState::NOT_STREAMABLE, SystemContext::SYSCTXT_MAIN)); result_hmi_state.push_back( - createHmiState(HMILevel::HMI_BACKGROUND, + createHmiState(HMILevel::HMI_FULL, AudioStreamingState::NOT_AUDIBLE, VideoStreamingState::NOT_STREAMABLE, SystemContext::SYSCTXT_MAIN)); @@ -426,12 +426,12 @@ class StateControllerImplTest : public ::testing::Test { VideoStreamingState::NOT_STREAMABLE, SystemContext::SYSCTXT_MAIN)); result_hmi_state.push_back( - createHmiState(HMILevel::HMI_LIMITED, + createHmiState(HMILevel::HMI_FULL, AudioStreamingState::NOT_AUDIBLE, VideoStreamingState::NOT_STREAMABLE, SystemContext::SYSCTXT_MAIN)); result_hmi_state.push_back( - createHmiState(HMILevel::HMI_LIMITED, + createHmiState(HMILevel::HMI_FULL, AudioStreamingState::NOT_AUDIBLE, VideoStreamingState::NOT_STREAMABLE, SystemContext::SYSCTXT_MAIN)); -- cgit v1.2.1 From 90879643717a1f8fef5061345e5e9b279329619f Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Tue, 24 Aug 2021 13:23:38 -0400 Subject: Ignore frame data for single and first frames (#3762) Co-authored-by: VladSemenyuk --- src/components/protocol_handler/src/multiframe_builder.cc | 1 + src/components/protocol_handler/src/protocol_packet.cc | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc index 875b5b5933..b66ce9b911 100644 --- a/src/components/protocol_handler/src/multiframe_builder.cc +++ b/src/components/protocol_handler/src/multiframe_builder.cc @@ -197,6 +197,7 @@ RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) { << connection_id << ", session_id: " << static_cast(session_id) << ", message_id: " << message_id); + packet->set_frame_data(FRAME_DATA_FIRST); messageId_map[message_id] = {packet, date_time::getCurrentTime()}; return RESULT_OK; } diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc index 9c3dd03141..51b5e838b3 100644 --- a/src/components/protocol_handler/src/protocol_packet.cc +++ b/src/components/protocol_handler/src/protocol_packet.cc @@ -325,21 +325,8 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate( break; } case FRAME_TYPE_SINGLE: - if (header.frameData != FRAME_DATA_SINGLE) { - SDL_LOG_WARN("FRAME_TYPE_SINGLE - Invalide frame data " - << static_cast(header.frameData)); - return RESULT_FAIL; - } - break; case FRAME_TYPE_FIRST: - if (header.frameData != FRAME_DATA_FIRST) { - SDL_LOG_WARN("FRAME_TYPE_FIRST - Invalide frame data " - << static_cast(header.frameData)); - return RESULT_FAIL; - } - break; case FRAME_TYPE_CONSECUTIVE: - // Could have any FrameInfo value break; default: SDL_LOG_WARN("Unknown frame type " << static_cast(header.frameType)); -- cgit v1.2.1 From e75bd4f3131b63e7e7f805bc36eb70c758c37640 Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Wed, 25 Aug 2021 09:47:45 -0400 Subject: Fix SDL crash on validation of numeric schemas with type overflow (#3750) * Added handling of cases with type overflow * Update generator logic and schema validation * Add validation info Co-authored-by: Jacob Keeler --- .../include/smart_objects/number_schema_item.h | 23 ++++++++++++++++++++-- .../smart_objects/src/number_schema_item.cc | 5 +++++ src/components/utils/include/utils/convert_utils.h | 14 ------------- .../generator/generators/SmartFactoryBase.py | 23 ++++++++++++++++++---- 4 files changed, 45 insertions(+), 20 deletions(-) diff --git a/src/components/smart_objects/include/smart_objects/number_schema_item.h b/src/components/smart_objects/include/smart_objects/number_schema_item.h index 25b7684829..5fa9597db7 100644 --- a/src/components/smart_objects/include/smart_objects/number_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/number_schema_item.h @@ -135,6 +135,7 @@ bool TNumberSchemaItem::isValidNumberType(SmartType type) { typeid(int32_t), typeid(uint32_t), typeid(int64_t), + typeid(uint64_t), typeid(double))) { return true; } @@ -157,11 +158,26 @@ errors::eType TNumberSchemaItem::validate( report->set_validation_info(validation_info); return errors::INVALID_VALUE; } + NumberType value(0); if (typeid(int32_t) == typeid(value)) { - value = utils::SafeStaticCast(Object.asInt()); + if (Object.asInt() < std::numeric_limits::min() || + Object.asInt() > std::numeric_limits::max()) { + const std::string validation_info = + "Value " + Object.asString() + " out of int32 range"; + report->set_validation_info(validation_info); + return errors::OUT_OF_RANGE; + } + value = Object.asInt(); } else if (typeid(uint32_t) == typeid(value)) { - value = utils::SafeStaticCast(Object.asUInt()); + if (Object.asInt() < std::numeric_limits::min() || + Object.asInt() > std::numeric_limits::max()) { + const std::string validation_info = + "Value " + Object.asString() + " out of uint32 range"; + report->set_validation_info(validation_info); + return errors::OUT_OF_RANGE; + } + value = Object.asUInt(); } else if (typeid(double) == typeid(value)) { value = Object.asDouble(); } else if (typeid(int64_t) == typeid(value)) { @@ -230,6 +246,9 @@ SmartType TNumberSchemaItem::getSmartType() const; template <> SmartType TNumberSchemaItem::getSmartType() const; +template <> +SmartType TNumberSchemaItem::getSmartType() const; + template <> SmartType TNumberSchemaItem::getSmartType() const; diff --git a/src/components/smart_objects/src/number_schema_item.cc b/src/components/smart_objects/src/number_schema_item.cc index c383f6ecca..1874ff30a0 100644 --- a/src/components/smart_objects/src/number_schema_item.cc +++ b/src/components/smart_objects/src/number_schema_item.cc @@ -49,6 +49,11 @@ SmartType TNumberSchemaItem::getSmartType() const { return SmartType_Integer; } +template <> +SmartType TNumberSchemaItem::getSmartType() const { + return SmartType_UInteger; +} + template <> SmartType TNumberSchemaItem::getSmartType() const { return SmartType_Double; diff --git a/src/components/utils/include/utils/convert_utils.h b/src/components/utils/include/utils/convert_utils.h index ba23b620dc..e51cf8cd57 100644 --- a/src/components/utils/include/utils/convert_utils.h +++ b/src/components/utils/include/utils/convert_utils.h @@ -69,20 +69,6 @@ unsigned long long int ConvertUInt64ToLongLongUInt(const uint64_t value); */ uint64_t ConvertLongLongUIntToUInt64(const unsigned long long int value); -/** - * @brief Convert one number value to another type value - * @param value to be converted - * @return conversion result - */ -template -OutputType SafeStaticCast(const InputType value) { - DCHECK_OR_RETURN(value >= std::numeric_limits::min(), - std::numeric_limits::min()); - DCHECK_OR_RETURN(value <= std::numeric_limits::max(), - std::numeric_limits::max()); - return static_cast(value); -} - /** * @brief Convert binary data to a string value * @param data raw binary data diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py index 69e8d71428..dffaa6c1b5 100755 --- a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py +++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py @@ -840,22 +840,37 @@ class CodeGenerator(object): [[u"bool", None if param.default_value is None else u"true" if param.default_value is True else u"false"]])) elif type(param) is Integer: - if not param.max_value or param.max_value and param.max_value < 2 ** 31: + if param.min_value is not None and param.min_value >= 0: + if param.max_value is None or param.max_value >= 2 ** 32: + code = self._impl_code_integer_item_template.substitute( + type=u"uint64_t", + params=self._gen_schema_item_param_values( + [[u"uint64_t", param.min_value], + [u"uint64_t", param.max_value], + [u"uint64_t", param.default_value]])) + else: + code = self._impl_code_integer_item_template.substitute( + type=u"uint32_t", + params=self._gen_schema_item_param_values( + [[u"uint32_t", param.min_value], + [u"uint32_t", param.max_value], + [u"uint32_t", param.default_value]])) + elif (param.min_value is not None and param.min_value >= -(2 ** 31)) and (param.max_value is not None and param.max_value < 2 ** 31): code = self._impl_code_integer_item_template.substitute( type=u"int32_t", params=self._gen_schema_item_param_values( [[u"int32_t", param.min_value], [u"int32_t", param.max_value], [u"int32_t", param.default_value]])) - elif param.max_value < 2 ** 63: + elif (param.min_value is None or param.min_value >= -(2 ** 63)) and (param.max_value is None or param.max_value < 2 ** 63): code = self._impl_code_integer_item_template.substitute( type=u"int64_t", params=self._gen_schema_item_param_values( [[u"int64_t", param.min_value], - [u"int64_t", str(param.max_value) + u"LL"], + [u"int64_t", param.max_value], [u"int64_t", param.default_value]])) else: - raise GenerateError("Parameter value too large: " + str(param.max_value)) + raise GenerateError("Parameter value too large/small: " + str(param.min_value) + "/" + str(param.max_value)) elif type(param) is Float: code = self._impl_code_integer_item_template.substitute( type=u"double", -- cgit v1.2.1 From 68dbfd895d5298c5fe03202445aaae51bc63a3ef Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 25 Aug 2021 13:48:33 -0400 Subject: Remove unused files (#3753) --- .../policies/policy_retry_sequence.h | 5 - .../policies/regular/policy_retry_sequence.h | 54 ---------- .../hmi/on_vi_acc_pedal_position_notification.h | 80 --------------- .../commands/hmi/on_vi_belt_status_notification.h | 80 --------------- .../hmi/on_vi_body_information_notification.h | 80 --------------- .../hmi/on_vi_device_status_notification.h | 80 --------------- .../hmi/on_vi_driver_braking_notification.h | 80 --------------- .../hmi/on_vi_engine_torque_notification.h | 80 --------------- .../hmi/on_vi_external_temperature_notification.h | 80 --------------- .../commands/hmi/on_vi_fuel_level_notification.h | 79 --------------- .../hmi/on_vi_fuel_level_state_notification.h | 80 --------------- .../commands/hmi/on_vi_gps_data_notification.h | 78 --------------- .../hmi/on_vi_head_lamp_status_notification.h | 80 --------------- .../on_vi_instant_fuel_consumption_notification.h | 80 --------------- .../commands/hmi/on_vi_my_key_notification.h | 78 --------------- .../commands/hmi/on_vi_odometer_notification.h | 79 --------------- .../commands/hmi/on_vi_prndl_notification.h | 78 --------------- .../commands/hmi/on_vi_rpm_notification.h | 78 --------------- .../commands/hmi/on_vi_speed_notification.h | 78 --------------- .../hmi/on_vi_steering_wheel_angle_notification.h | 80 --------------- .../hmi/on_vi_tire_pressure_notification.h | 80 --------------- .../commands/hmi/on_vi_vin_notification.h | 78 --------------- .../commands/hmi/on_vi_wiper_status_notification.h | 80 --------------- .../hmi/on_vi_acc_pedal_position_notification.cc | 69 ------------- .../commands/hmi/on_vi_belt_status_notification.cc | 69 ------------- .../hmi/on_vi_body_information_notification.cc | 69 ------------- .../hmi/on_vi_device_status_notification.cc | 69 ------------- .../hmi/on_vi_driver_braking_notification.cc | 69 ------------- .../hmi/on_vi_engine_torque_notification.cc | 69 ------------- .../hmi/on_vi_external_temperature_notification.cc | 69 ------------- .../commands/hmi/on_vi_fuel_level_notification.cc | 69 ------------- .../hmi/on_vi_fuel_level_state_notification.cc | 69 ------------- .../commands/hmi/on_vi_gps_data_notification.cc | 69 ------------- .../hmi/on_vi_head_lamp_status_notification.cc | 69 ------------- .../on_vi_instant_fuel_consumption_notification.cc | 70 ------------- .../src/commands/hmi/on_vi_my_key_notification.cc | 69 ------------- .../commands/hmi/on_vi_odometer_notification.cc | 69 ------------- .../src/commands/hmi/on_vi_prndl_notification.cc | 69 ------------- .../src/commands/hmi/on_vi_rpm_notification.cc | 69 ------------- .../src/commands/hmi/on_vi_speed_notification.cc | 69 ------------- .../hmi/on_vi_steering_wheel_angle_notification.cc | 69 ------------- .../hmi/on_vi_tire_pressure_notification.cc | 69 ------------- .../src/commands/hmi/on_vi_vin_notification.cc | 69 ------------- .../hmi/on_vi_wiper_status_notification.cc | 69 ------------- .../src/policies/policy_retry_sequence.cc | 77 -------------- .../test/sql_pt_representation_test.cc | 1 - .../include/utils/threads/pulse_thread_delegate.h | 101 ------------------- .../utils/include/utils/threads/thread_manager.h | 81 --------------- .../utils/src/threads/pulse_thread_delegate.cc | 111 --------------------- src/components/utils/src/threads/thread_manager.cc | 54 ---------- 50 files changed, 3600 deletions(-) delete mode 100644 src/components/application_manager/include/application_manager/policies/policy_retry_sequence.h delete mode 100644 src/components/application_manager/include/application_manager/policies/regular/policy_retry_sequence.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc delete mode 100644 src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc delete mode 100644 src/components/application_manager/src/policies/policy_retry_sequence.cc delete mode 100644 src/components/utils/include/utils/threads/pulse_thread_delegate.h delete mode 100644 src/components/utils/include/utils/threads/thread_manager.h delete mode 100644 src/components/utils/src/threads/pulse_thread_delegate.cc delete mode 100644 src/components/utils/src/threads/thread_manager.cc diff --git a/src/components/application_manager/include/application_manager/policies/policy_retry_sequence.h b/src/components/application_manager/include/application_manager/policies/policy_retry_sequence.h deleted file mode 100644 index 334a7b3a2d..0000000000 --- a/src/components/application_manager/include/application_manager/policies/policy_retry_sequence.h +++ /dev/null @@ -1,5 +0,0 @@ -#ifdef EXTERNAL_PROPRIETARY_MODE -#error "policy_handler_observer.h is not available in policy external" -#else -#include "application_manager/policies/regular/policy_handler_observer.h" -#endif diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_retry_sequence.h b/src/components/application_manager/include/application_manager/policies/regular/policy_retry_sequence.h deleted file mode 100644 index f1a9ff55b8..0000000000 --- a/src/components/application_manager/include/application_manager/policies/regular/policy_retry_sequence.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_RETRY_SEQUENCE_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_RETRY_SEQUENCE_H_ - -#include "utils/threads/thread_delegate.h" - -namespace policy { - -class PolicyHandler; - -class RetrySequence : public threads::ThreadDelegate { - public: - explicit RetrySequence(PolicyHandler* const policy_handler); - void threadMain(); - - private: - PolicyHandler* const policy_handler_; - void StartNextRetry(); -}; - -} // namespace policy - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_RETRY_SEQUENCE_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h deleted file mode 100644 index c848233497..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIAccPedalPositionNotification command class - **/ -class OnVIAccPedalPositionNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIAccPedalPositionNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIAccPedalPositionNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIAccPedalPositionNotification class destructor - **/ - virtual ~OnVIAccPedalPositionNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIAccPedalPositionNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ACC_PEDAL_POSITION_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h deleted file mode 100644 index 0cb3e04f4e..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIBeltStatusNotification command class - **/ -class OnVIBeltStatusNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIBeltStatusNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIBeltStatusNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIBeltStatusNotification class destructor - **/ - virtual ~OnVIBeltStatusNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIBeltStatusNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BELT_STATUS_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h deleted file mode 100644 index 6ab920204d..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIBodyInformationNotification command class - **/ -class OnVIBodyInformationNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIBodyInformationNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIBodyInformationNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIBodyInformationNotification class destructor - **/ - virtual ~OnVIBodyInformationNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIBodyInformationNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_BODY_INFORMATION_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h deleted file mode 100644 index b3afeb82b3..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIDeviceStatusNotification command class - **/ -class OnVIDeviceStatusNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIDeviceStatusNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIDeviceStatusNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIDeviceStatusNotification class destructor - **/ - virtual ~OnVIDeviceStatusNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIDeviceStatusNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DEVICE_STATUS_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h deleted file mode 100644 index a1885c5e29..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIDriverBrakingNotification command class - **/ -class OnVIDriverBrakingNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIDriverBrakingNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIDriverBrakingNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIDriverBrakingNotification class destructor - **/ - virtual ~OnVIDriverBrakingNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIDriverBrakingNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_DRIVER_BRAKING_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h deleted file mode 100644 index feb6cc6060..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIEngineTorqueNotification command class - **/ -class OnVIEngineTorqueNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIEngineTorqueNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIEngineTorqueNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIEngineTorqueNotification class destructor - **/ - virtual ~OnVIEngineTorqueNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIEngineTorqueNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ENGINE_TORQUE_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h deleted file mode 100644 index 734420aaee..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIExternalTemperatureNotification command class - **/ -class OnVIExternalTemperatureNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIExternalTemperatureNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIExternalTemperatureNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIExternalTemperatureNotification class destructor - **/ - virtual ~OnVIExternalTemperatureNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIExternalTemperatureNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_EXTERNAL_TEMPERATURE_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h deleted file mode 100644 index a5588901f7..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIFuelLevelNotification command class - **/ -class OnVIFuelLevelNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIFuelLevelNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIFuelLevelNotification(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIFuelLevelNotification class destructor - **/ - virtual ~OnVIFuelLevelNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIFuelLevelNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h deleted file mode 100644 index 5ed661cdbf..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIFuelLevelStateNotification command class - **/ -class OnVIFuelLevelStateNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIFuelLevelStateNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIFuelLevelStateNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIFuelLevelStateNotification class destructor - **/ - virtual ~OnVIFuelLevelStateNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIFuelLevelStateNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_FUEL_LEVEL_STATE_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h deleted file mode 100644 index 70ee5f6c00..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIGpsDataNotification command class - **/ -class OnVIGpsDataNotification : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIGpsDataNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIGpsDataNotification(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIGpsDataNotification class destructor - **/ - virtual ~OnVIGpsDataNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIGpsDataNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_GPS_DATA_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h deleted file mode 100644 index 5ef1e3ed92..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIHeadLampStatusNotification command class - **/ -class OnVIHeadLampStatusNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIHeadLampStatusNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIHeadLampStatusNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIHeadLampStatusNotification class destructor - **/ - virtual ~OnVIHeadLampStatusNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIHeadLampStatusNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_HEAD_LAMP_STATUS_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h deleted file mode 100644 index 7bb7756fc5..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIInstantFuelConsumptionNotification command class - **/ -class OnVIInstantFuelConsumptionNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIInstantFuelConsumptionNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIInstantFuelConsumptionNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIInstantFuelConsumptionNotification class destructor - **/ - virtual ~OnVIInstantFuelConsumptionNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIInstantFuelConsumptionNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_INSTANT_FUEL_CONSUMPTION_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h deleted file mode 100644 index cdebc99768..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIMyKeyNotification command class - **/ -class OnVIMyKeyNotification : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIMyKeyNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIMyKeyNotification(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIMyKeyNotification class destructor - **/ - virtual ~OnVIMyKeyNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIMyKeyNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_MY_KEY_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h deleted file mode 100644 index 1da26dd316..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIOdometerNotification command class - **/ -class OnVIOdometerNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIOdometerNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIOdometerNotification(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIOdometerNotification class destructor - **/ - virtual ~OnVIOdometerNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIOdometerNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_ODOMETER_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h deleted file mode 100644 index 7d03c62633..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIPrndlNotification command class - **/ -class OnVIPrndlNotification : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIPrndlNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIPrndlNotification(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIPrndlNotification class destructor - **/ - virtual ~OnVIPrndlNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIPrndlNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_PRNDL_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h deleted file mode 100644 index 60a0ce0782..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIRpmNotification command class - **/ -class OnVIRpmNotification : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIRpmNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIRpmNotification(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIRpmNotification class destructor - **/ - virtual ~OnVIRpmNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIRpmNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_RPM_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h deleted file mode 100644 index 4920fbd661..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVISpeedNotification command class - **/ -class OnVISpeedNotification : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVISpeedNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVISpeedNotification(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVISpeedNotification class destructor - **/ - virtual ~OnVISpeedNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVISpeedNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_SPEED_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h deleted file mode 100644 index cff99ecf8e..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVISteeringWheelAngleNotification command class - **/ -class OnVISteeringWheelAngleNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVISteeringWheelAngleNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVISteeringWheelAngleNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVISteeringWheelAngleNotification class destructor - **/ - virtual ~OnVISteeringWheelAngleNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVISteeringWheelAngleNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_STEERING_WHEEL_ANGLE_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h deleted file mode 100644 index 0399780869..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVITirePressureNotification command class - **/ -class OnVITirePressureNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVITirePressureNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVITirePressureNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVITirePressureNotification class destructor - **/ - virtual ~OnVITirePressureNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVITirePressureNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_TIRE_PRESSURE_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h deleted file mode 100644 index 60b686683f..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIVinNotification command class - **/ -class OnVIVinNotification : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIVinNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIVinNotification(const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIVinNotification class destructor - **/ - virtual ~OnVIVinNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIVinNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_VIN_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h deleted file mode 100644 index a6e1ba9921..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_ -#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_ - -#include "application_manager/application_manager.h" -#include "application_manager/commands/notification_from_hmi.h" - -namespace sdl_rpc_plugin { -namespace app_mngr = application_manager; - -namespace commands { - -/** - * @brief OnVIWiperStatusNotification command class - **/ -class OnVIWiperStatusNotification - : public app_mngr::commands::NotificationFromHMI { - public: - /** - * @brief OnVIWiperStatusNotification class constructor - * - * @param message Incoming SmartObject message - **/ - OnVIWiperStatusNotification( - const app_mngr::commands::MessageSharedPtr& message, - app_mngr::ApplicationManager& application_manager, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle); - - /** - * @brief OnVIWiperStatusNotification class destructor - **/ - virtual ~OnVIWiperStatusNotification(); - - /** - * @brief Execute command - **/ - virtual void Run(); - - private: - DISALLOW_COPY_AND_ASSIGN(OnVIWiperStatusNotification); -}; - -} // namespace commands - -} // namespace sdl_rpc_plugin - -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_VI_WIPER_STATUS_NOTIFICATION_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc deleted file mode 100644 index 9f4e707b83..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_acc_pedal_position_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_acc_pedal_position_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIAccPedalPositionNotification::OnVIAccPedalPositionNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIAccPedalPositionNotification::~OnVIAccPedalPositionNotification() {} - -void OnVIAccPedalPositionNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc deleted file mode 100644 index 4227847153..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_belt_status_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_belt_status_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIBeltStatusNotification::OnVIBeltStatusNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIBeltStatusNotification::~OnVIBeltStatusNotification() {} - -void OnVIBeltStatusNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc deleted file mode 100644 index 663f9342f4..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_body_information_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_body_information_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIBodyInformationNotification::OnVIBodyInformationNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIBodyInformationNotification::~OnVIBodyInformationNotification() {} - -void OnVIBodyInformationNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc deleted file mode 100644 index 62bec16546..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_device_status_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_device_status_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIDeviceStatusNotification::OnVIDeviceStatusNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIDeviceStatusNotification::~OnVIDeviceStatusNotification() {} - -void OnVIDeviceStatusNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc deleted file mode 100644 index 722fddc5f1..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_driver_braking_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_driver_braking_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIDriverBrakingNotification::OnVIDriverBrakingNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIDriverBrakingNotification::~OnVIDriverBrakingNotification() {} - -void OnVIDriverBrakingNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc deleted file mode 100644 index 8c524a3f1d..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_engine_torque_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_engine_torque_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIEngineTorqueNotification::OnVIEngineTorqueNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIEngineTorqueNotification::~OnVIEngineTorqueNotification() {} - -void OnVIEngineTorqueNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc deleted file mode 100644 index 3cbd22eb97..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_external_temperature_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_external_temperature_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIExternalTemperatureNotification::OnVIExternalTemperatureNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIExternalTemperatureNotification::~OnVIExternalTemperatureNotification() {} - -void OnVIExternalTemperatureNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc deleted file mode 100644 index 8065434063..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIFuelLevelNotification::OnVIFuelLevelNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIFuelLevelNotification::~OnVIFuelLevelNotification() {} - -void OnVIFuelLevelNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc deleted file mode 100644 index c0c60108f3..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_fuel_level_state_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_fuel_level_state_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIFuelLevelStateNotification::OnVIFuelLevelStateNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIFuelLevelStateNotification::~OnVIFuelLevelStateNotification() {} - -void OnVIFuelLevelStateNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc deleted file mode 100644 index 1e18d18eba..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_gps_data_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_gps_data_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIGpsDataNotification::OnVIGpsDataNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIGpsDataNotification::~OnVIGpsDataNotification() {} - -void OnVIGpsDataNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc deleted file mode 100644 index 29906df43f..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_head_lamp_status_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_head_lamp_status_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIHeadLampStatusNotification::OnVIHeadLampStatusNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIHeadLampStatusNotification::~OnVIHeadLampStatusNotification() {} - -void OnVIHeadLampStatusNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc deleted file mode 100644 index c4bc32e825..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_instant_fuel_consumption_notification.cc +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_instant_fuel_consumption_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIInstantFuelConsumptionNotification::OnVIInstantFuelConsumptionNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIInstantFuelConsumptionNotification:: - ~OnVIInstantFuelConsumptionNotification() {} - -void OnVIInstantFuelConsumptionNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc deleted file mode 100644 index 6139d143f6..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_my_key_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_my_key_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIMyKeyNotification::OnVIMyKeyNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIMyKeyNotification::~OnVIMyKeyNotification() {} - -void OnVIMyKeyNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc deleted file mode 100644 index 92f4b47fcf..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_odometer_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_odometer_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIOdometerNotification::OnVIOdometerNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIOdometerNotification::~OnVIOdometerNotification() {} - -void OnVIOdometerNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc deleted file mode 100644 index c2afd7d697..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_prndl_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_prndl_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIPrndlNotification::OnVIPrndlNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIPrndlNotification::~OnVIPrndlNotification() {} - -void OnVIPrndlNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc deleted file mode 100644 index f41f5d3f56..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_rpm_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_rpm_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIRpmNotification::OnVIRpmNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIRpmNotification::~OnVIRpmNotification() {} - -void OnVIRpmNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc deleted file mode 100644 index 73313b6ea4..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_speed_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_speed_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVISpeedNotification::OnVISpeedNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVISpeedNotification::~OnVISpeedNotification() {} - -void OnVISpeedNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc deleted file mode 100644 index e04eaab3b4..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_steering_wheel_angle_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_steering_wheel_angle_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVISteeringWheelAngleNotification::OnVISteeringWheelAngleNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVISteeringWheelAngleNotification::~OnVISteeringWheelAngleNotification() {} - -void OnVISteeringWheelAngleNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc deleted file mode 100644 index bc013c2e2c..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_tire_pressure_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_tire_pressure_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVITirePressureNotification::OnVITirePressureNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVITirePressureNotification::~OnVITirePressureNotification() {} - -void OnVITirePressureNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc deleted file mode 100644 index 4b33c2d589..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_vin_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_vin_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIVinNotification::OnVIVinNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIVinNotification::~OnVIVinNotification() {} - -void OnVIVinNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc deleted file mode 100644 index dde1e642c3..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vi_wiper_status_notification.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sdl_rpc_plugin/commands/hmi/on_vi_wiper_status_notification.h" -#include "interfaces/MOBILE_API.h" - -namespace sdl_rpc_plugin { -using namespace application_manager; - -namespace commands { - -SDL_CREATE_LOG_VARIABLE("Commands") - -OnVIWiperStatusNotification::OnVIWiperStatusNotification( - const application_manager::commands::MessageSharedPtr& message, - ApplicationManager& application_manager, - rpc_service::RPCService& rpc_service, - HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handle) - : NotificationFromHMI(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handle) {} - -OnVIWiperStatusNotification::~OnVIWiperStatusNotification() {} - -void OnVIWiperStatusNotification::Run() { - SDL_LOG_AUTO_TRACE(); - - // prepare SmartObject for mobile factory - (*message_)[strings::params][strings::function_id] = - static_cast(mobile_apis::FunctionID::eType::OnVehicleDataID); - - SendNotificationToMobile(message_); -} - -} // namespace commands - -} // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/src/policies/policy_retry_sequence.cc b/src/components/application_manager/src/policies/policy_retry_sequence.cc deleted file mode 100644 index abb2926c9e..0000000000 --- a/src/components/application_manager/src/policies/policy_retry_sequence.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (c) 2013, Ford Motor Company - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of the Ford Motor Company nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#include "application_manager/policies/policy_retry_sequence.h" - -#include - -#include "application_manager/policies/policy_handler.h" - -namespace policy { - -SDL_CREATE_LOG_VARIABLE("PolicyHandler") - -RetrySequence::RetrySequence(PolicyHandler* const policy_handler) - // TODO (Risk copy of PolicyHandler Pointer) - : policy_handler_(policy_handler) {} - -void RetrySequence::threadMain() { - StartNextRetry(); -} - -void RetrySequence::StartNextRetry() { - SDL_LOG_TRACE("Start next retry of exchanging PT"); - DCHECK(policy_handler_); - // TODO(Ezamakhov): inverstigate StartNextRetry on unload policy lib - - BinaryMessageSptr pt_snapshot = policy_handler_->RequestPTUpdate(); - if (pt_snapshot) { - policy_handler_->SendMessageToSDK(*pt_snapshot); - - const uint32_t timeout = policy_handler_->TimeoutExchangeSec(); - const int seconds = policy_handler_->NextRetryTimeout(); - SDL_LOG_DEBUG("Timeout response: " << timeout << " Next try: " << seconds); - if (timeout > 0) { - sleep(timeout); - policy_handler_->OnExceededTimeout(); - } - if (seconds > 0) { - sleep(seconds); - StartNextRetry(); - } else { - SDL_LOG_INFO("End retry sequence. Update PT was not received"); - policy_handler_->OnPTUFinished(false); - } - } -} - -} // namespace policy diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc index 1adf9ae7c6..548b6f3666 100644 --- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc @@ -48,7 +48,6 @@ #include "policy/sql_wrapper.h" #include "rpc_base/rpc_base.h" #include "utils/file_system.h" -#include "utils/system.h" namespace policy_table = rpc::policy_table_interface_base; using policy::CheckPermissionResult; diff --git a/src/components/utils/include/utils/threads/pulse_thread_delegate.h b/src/components/utils/include/utils/threads/pulse_thread_delegate.h deleted file mode 100644 index ad6df6fca7..0000000000 --- a/src/components/utils/include/utils/threads/pulse_thread_delegate.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_PULSE_THREAD_DELEGATE_H_ -#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_PULSE_THREAD_DELEGATE_H_ - -#include - -#include "utils/threads/thread_delegate.h" - -namespace threads { - -/** - * @brief This ThreadDelegate derivative is designed - * to implement threads waiting for QNX Pulse messages - * When constucted, an instance of this class creates QNX channel and connects - * to it - * In exitThreadMain() channel is disconnected and destroyed - * In threadMain() endless loop event is armed via pure virtual method - * ArmEvent() - * and thread blocks on MsgReceivePulse() waiting for Pulse - * When Pulse comes, OnPulse() pure virtual method is invoked - * Subclassed must implement ArmEvent() for events of interest - * and OnPulse() for reaction on such events - */ -class PulseThreadDelegate : public ThreadDelegate { - public: - /** - * @brief default constructor - */ - PulseThreadDelegate(); - virtual void threadMain(); - virtual void exitThreadMain(); - - protected: - /** - * @brief This method is to be implemented to arm events of interest - * @param event pointer to structure sigevent - * @return If this method returns true, thread is blocked on - * MsgReceivePulse() waiting for Pulse - */ - virtual bool ArmEvent(struct sigevent* event) = 0; - /** - * @brief This method is invoked from threadMain() when Pulse comes - */ - virtual void OnPulse() = 0; - - /** - * This method is to be initialize child class - * @return If this method returns false, thread will be stopped - */ - virtual bool Init() { - return true; - } - - /** - * Finalizes thread - * Can free resources - */ - virtual void Finalize() {} - - private: - enum { PULSE_CODE = _PULSE_CODE_MINAVAIL + 1 }; - - volatile bool run_; - int chid_; - int coid_; -}; - -} // namespace threads - -#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_PULSE_THREAD_DELEGATE_H_ diff --git a/src/components/utils/include/utils/threads/thread_manager.h b/src/components/utils/include/utils/threads/thread_manager.h deleted file mode 100644 index 4f28d0cb15..0000000000 --- a/src/components/utils/include/utils/threads/thread_manager.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_THREAD_MANAGER_H_ -#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_THREAD_MANAGER_H_ - -#include "utils/threads/thread.h" - -#include - -#include -#include -#include -#include - -#include "utils/conditional_variable.h" -#include "utils/lock.h" -#include "utils/macro.h" -#include "utils/message_queue.h" -#include "utils/singleton.h" -#include "utils/threads/thread.h" -#include "utils/threads/thread_delegate.h" - -namespace threads { -class Thread; - -/* - * This class is here currently to remember names associated to threads. - * It manages raw impl::PlatformHandles because Thread::Id's do not provide - * comparison operator. Current linux implementation relies on fact that - * pthread_t is just an integer and every thread has single unique value - * associated with it. - * OS provides it's own facilities to name threads but - */ -class ThreadManager : public utils::Singleton { - public: - struct ThreadDesc { - pthread_t handle; - ThreadDelegate* delegate; - }; - ThreadManager() {} - MessageQueue threads_to_terminate; - - private: - DISALLOW_COPY_AND_ASSIGN(ThreadManager); - - FRIEND_BASE_SINGLETON_CLASS(ThreadManager); -}; - -} // namespace threads - -#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_THREADS_THREAD_MANAGER_H_ diff --git a/src/components/utils/src/threads/pulse_thread_delegate.cc b/src/components/utils/src/threads/pulse_thread_delegate.cc deleted file mode 100644 index 79174ae693..0000000000 --- a/src/components/utils/src/threads/pulse_thread_delegate.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#include "utils/logger.h" -#include "utils/threads/pulse_thread_delegate.h" - -namespace threads { - -SDL_CREATE_LOG_VARIABLE("Utils") - -PulseThreadDelegate::PulseThreadDelegate() : run_(false) { - SDL_LOG_TRACE("Creating QNX channel"); - chid_ = ChannelCreate(0); - if (chid_ == -1) { - SDL_LOG_ERROR("Failed to create QNX channel"); - return; - } - SDL_LOG_DEBUG("Created QNX channel " << chid_); - - SDL_LOG_TRACE("Connecting to QNX channel " << chid_); - coid_ = ConnectAttach(ND_LOCAL_NODE, 0, chid_, _NTO_SIDE_CHANNEL, 0); - if (coid_ == -1) { - SDL_LOG_ERROR("Failed to connect to QNX channel " << chid_); - return; - } - SDL_LOG_DEBUG("Connected to QNX channel " << chid_); - - run_ = true; -} - -void PulseThreadDelegate::threadMain() { - if (!Init()) { - SDL_LOG_ERROR("Failed to initialize thread for QNX channel " << chid_); - return; - } - while (run_) { - struct sigevent event; - SIGEV_PULSE_INIT(&event, coid_, SIGEV_PULSE_PRIO_INHERIT, PULSE_CODE, 0); - if (ArmEvent(&event)) { - struct _pulse pulse; - SDL_LOG_INFO("Waiting for pulse on QNX channel " << chid_); - if (MsgReceivePulse(chid_, &pulse, sizeof(pulse), 0) != -1) { - SDL_LOG_INFO("Received pulse on QNX channel " << chid_); - switch (pulse.code) { - case PULSE_CODE: - OnPulse(); - break; - } - } else { - if (run_) { - SDL_LOG_WARN("Error occurred while waiting for pulse on QNX channel " - << chid_); - } else { - SDL_LOG_INFO("QNX channel " << chid_ << " is apparently destroyed"); - } - } - } - } - Finalize(); -} - -void PulseThreadDelegate::exitThreadMain() { - run_ = false; - - SDL_LOG_TRACE("Disconnecting from QNX channel " << chid_); - if (ConnectDetach(coid_) != -1) { - SDL_LOG_DEBUG("Disconnected from QNX channel " << chid_); - } else { - SDL_LOG_WARN("Failed to disconnect from QNX channel " << chid_); - } - - SDL_LOG_TRACE("Destroying QNX channel " << chid_); - if (ChannelDestroy(chid_) != -1) { // unblocks MsgReceivePulse() - SDL_LOG_DEBUG("QNX channel " << chid_ << " destroyed"); - } else { - SDL_LOG_WARN("Failed to destroy QNX channel " << chid_); - } -} - -} // namespace threads diff --git a/src/components/utils/src/threads/thread_manager.cc b/src/components/utils/src/threads/thread_manager.cc deleted file mode 100644 index 466bd98dc5..0000000000 --- a/src/components/utils/src/threads/thread_manager.cc +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "utils/threads/thread_manager.h" -#include "utils/conditional_variable.h" -#include "utils/lock.h" -#include "utils/logger.h" -#include "utils/threads/thread.h" -#include "utils/threads/thread_delegate.h" - -#include - -#include -#include - -#if defined(OS_LINUX) -#include -#include -#endif - -namespace threads { - -SDL_CREATE_LOG_VARIABLE("Utils") - -} // namespace threads -- cgit v1.2.1 From aa846ae0cc3bb5c7e2c12e04906a0882145c1268 Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Wed, 25 Aug 2021 15:21:58 -0400 Subject: Add check for audio streaming state (#3763) --- src/components/application_manager/src/application_manager_impl.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index c3f3ef4bb3..bfb83d8de8 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -3473,6 +3473,7 @@ bool ApplicationManagerImpl::HMIStateAllowsStreaming( using namespace mobile_apis::HMILevel; using namespace mobile_apis::PredefinedWindows; using namespace mobile_apis::VideoStreamingState; + using namespace mobile_apis::AudioStreamingState; using namespace helpers; ApplicationSharedPtr app = application(app_id); @@ -3486,7 +3487,10 @@ bool ApplicationManagerImpl::HMIStateAllowsStreaming( Compare( hmi_state->hmi_level(), HMI_FULL, HMI_LIMITED); const bool allow_streaming_by_streaming_state = - hmi_state->video_streaming_state() == STREAMABLE; + (service_type == protocol_handler::SERVICE_TYPE_NAVI && + hmi_state->video_streaming_state() == STREAMABLE) || + (service_type == protocol_handler::SERVICE_TYPE_AUDIO && + hmi_state->audio_streaming_state() != NOT_AUDIBLE); return allow_streaming_by_hmi_level && allow_streaming_by_streaming_state; } -- cgit v1.2.1 From cf565cec5bfb2b66117a8ce6c3202d4cb1362f25 Mon Sep 17 00:00:00 2001 From: Collin Date: Wed, 25 Aug 2021 15:39:21 -0400 Subject: Remove language code ES-EN and EN-IE from the project (#3757) * remove invalid language code es-en from preloaded pt * remove es-en from other pt files * remove en-ie language --- src/appMain/sdl_preloaded_pt.json | 71 --------- .../application_manager/test/sdl_pt_update.json | 116 --------------- .../json/sdl_preloaded_pt_for_merge_initial.json | 161 --------------------- .../json/sdl_preloaded_pt_for_merge_latest.json | 161 --------------------- .../json/sdl_preloaded_pt_for_merge_initial.json | 161 --------------------- .../json/sdl_preloaded_pt_for_merge_latest.json | 161 --------------------- 6 files changed, 831 deletions(-) diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index e018a597f7..4887405909 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -1736,12 +1736,6 @@ "line2": "Permission(s)?", "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu." }, - "es-en": { - "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.", - "line1": "¿Otorgar permiso(s)", - "line2": "solicitado(s)?", - "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles." - }, "es-es": { "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.", "line1": "¿Conceder permisos", @@ -1833,9 +1827,6 @@ "en-us": { "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny." }, - "es-en": { - "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." - }, "es-es": { "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo." }, @@ -1897,9 +1888,6 @@ "en-us": { "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "es-en": { - "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." - }, "es-es": { "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil." }, @@ -1968,11 +1956,6 @@ "line1": "Not Authorized", "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%." }, - "es-en": { - "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.", - "line1": "no autorizada", - "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." - }, "es-es": { "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.", "line1": "No autorizada" @@ -2057,11 +2040,6 @@ "line1": "Not Supported", "textBody": "Your version of %appName% is not supported by SYNC." }, - "es-en": { - "tts": "Esta versión de %appName% no es compatible con SYNC.", - "line1": "no compatible", - "textBody": "Esta versión de %appName% no es compatible con SYNC." - }, "es-es": { "tts": "Esta versión de %appName% no es compatible con SYNC.", "line1": "No compatible" @@ -2182,12 +2160,6 @@ "line2": "and Mobile Apps?", "textBody": "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel." }, - "es-en": { - "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.", - "line1": "¿Deshab. actualiz.", - "line2": "autom. y aplic. móv.?", - "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." - }, "es-es": { "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.", "line1": "¿Desact. actual. auto", @@ -2286,11 +2258,6 @@ "label": "Driving Characteristics", "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status." }, - "es-en": { - "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.", - "label": "Características del manejo", - "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." - }, "es-es": { "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.", "label": "Características de conducción" @@ -2375,11 +2342,6 @@ "label": "GPS and speed", "textBody": "An app can access vehicle GPS and speed." }, - "es-en": { - "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.", - "label": "GPS y velocidad", - "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." - }, "es-es": { "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.", "label": "GPS y velocidad" @@ -2471,11 +2433,6 @@ "label": "Push notifications", "textBody": "An app can send notifications when running in the background." }, - "es-en": { - "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.", - "label": "Notificaciones tipo Push", - "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." - }, "es-es": { "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.", "label": "Notificaciones push" @@ -2554,10 +2511,6 @@ "line1": "Disable Updates", "textBody": "Disable Updates" }, - "es-en": { - "line1": "Deshab. actual.", - "textBody": "Deshab. actual." - }, "es-es": { "line1": "Desact. actual." }, @@ -2621,9 +2574,6 @@ "en-us": { "line1": "Enable Apps" }, - "es-en": { - "line1": "Hab. aplic." - }, "es-es": { "line1": "Activar apl." }, @@ -2687,10 +2637,6 @@ "line1": "Request Update", "textBody": "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute." }, - "es-en": { - "line1": "Solicit. actualiz.", - "textBody": "Solicit. actualiz." - }, "es-es": { "line1": "Solicitar actual." }, @@ -2756,10 +2702,6 @@ "line1": "Update Needed", "textBody": "Update Needed" }, - "es-en": { - "line1": "Actualiz. neces.", - "textBody": "Actualiz. neces." - }, "es-es": { "line1": "Actu. necesaria" }, @@ -2825,10 +2767,6 @@ "line1": "Updating...", "textBody": "Updating..." }, - "es-en": { - "line1": "Actualizando...", - "textBody": "Actualizando..." - }, "es-es": { "line1": "Actualizando..." }, @@ -2894,10 +2832,6 @@ "line1": "Up-To-Date", "textBody": "Up-To-Date" }, - "es-en": { - "line1": "Actualizado", - "textBody": "Actualizado" - }, "es-es": { "line1": "Actualizada" }, @@ -2968,11 +2902,6 @@ "label": "Vehicle information", "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure." }, - "es-en": { - "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.", - "label": "Información del vehículo", - "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." - }, "es-es": { "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.", "label": "Información del vehículo" diff --git a/src/components/application_manager/test/sdl_pt_update.json b/src/components/application_manager/test/sdl_pt_update.json index dc4fe16027..bb69933497 100644 --- a/src/components/application_manager/test/sdl_pt_update.json +++ b/src/components/application_manager/test/sdl_pt_update.json @@ -75,21 +75,11 @@ "line2" : "permission(s)?", "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." }, - "en-ie" : { - "line1" : "Grant requested", - "line2" : "permission(s)?", - "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." - }, "en-us" : { "line1" : "Grant Requested", "line2" : "Permission(s)?", "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press yes to allow or no to deny." }, - "es-en" : { - "line1" : "¿Otorgar permiso(s)", - "line2" : "solicitado(s)?", - "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar." - }, "es-es" : { "line1" : "¿Conceder permisos", "line2" : "solicitados?", @@ -173,15 +163,9 @@ "en-gb" : { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." }, - "en-ie" : { - "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." - }, "en-us" : { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny." }, - "es-en" : { - "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." - }, "es-es" : { "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo." }, @@ -237,15 +221,9 @@ "en-gb" : { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "en-ie" : { - "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." - }, "en-us" : { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "es-en" : { - "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." - }, "es-es" : { "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil." }, @@ -304,18 +282,10 @@ "line1" : "not authorized", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "en-ie" : { - "line1" : "not authorized", - "tts" : "This version of %appName% is not authorized and will not work with SYNC." - }, "en-us" : { "line1" : "Not Authorized", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "es-en" : { - "line1" : "no autorizada", - "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." - }, "es-es" : { "line1" : "No autorizada", "tts" : "Esta versión de %appName% no está autorizada y no funcionará con SYNC." @@ -388,18 +358,10 @@ "line1" : "not supported", "tts" : "This version of %appName% is not supported by SYNC." }, - "en-ie" : { - "line1" : "not supported", - "tts" : "This version of %appName% is not supported by SYNC." - }, "en-us" : { "line1" : "Not Supported", "tts" : "This version of %appName% is not supported by SYNC." }, - "es-en" : { - "line1" : "no compatible", - "tts" : "Esta versión de %appName% no es compatible con SYNC." - }, "es-es" : { "line1" : "No compatible", "tts" : "Esta versión de %appName% no es compatible con SYNC." @@ -491,21 +453,11 @@ "line2" : "and Mobile Apps?", "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." }, - "en-ie" : { - "line1" : "Disable auto-updates", - "line2" : "and Mobile Apps?", - "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." - }, "en-us" : { "line1" : "Disable Auto-Updates", "line2" : "and Mobile Apps?", "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel." }, - "es-en" : { - "line1" : "¿Deshab. actualiz.", - "line2" : "autom. y aplic. móv.?", - "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." - }, "es-es" : { "line1" : "¿Desact. actual. auto", "line2" : "y apl. móviles?", @@ -592,18 +544,10 @@ "label" : "Driving characteristics", "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." }, - "en-ie" : { - "label" : "Driving characteristics", - "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." - }, "en-us" : { "label" : "Driving Characteristics", "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status." }, - "es-en" : { - "label" : "Características del manejo", - "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." - }, "es-es" : { "label" : "Características de conducción", "tts" : "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad." @@ -676,18 +620,10 @@ "label" : "GPS and speed", "tts" : "An app can access vehicle GPS and speed." }, - "en-ie" : { - "label" : "GPS and speed", - "tts" : "An app can access vehicle GPS and speed." - }, "en-us" : { "label" : "GPS and speed", "tts" : "An app can access vehicle GPS and speed." }, - "es-en" : { - "label" : "GPS y velocidad", - "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." - }, "es-es" : { "label" : "GPS y velocidad", "tts" : "Una aplicación puede acceder al GPS y la velocidad del vehículo." @@ -760,18 +696,10 @@ "label" : "Push notifications", "tts" : "An app can send notifications when running in the background." }, - "en-ie" : { - "label" : "Push notifications", - "tts" : "An app can send notifications when running in the background." - }, "en-us" : { "label" : "Push notifications", "tts" : "An app can send notifications when running in the background." }, - "es-en" : { - "label" : "Notificaciones tipo Push", - "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." - }, "es-es" : { "label" : "Notificaciones push", "tts" : "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano." @@ -841,15 +769,9 @@ "en-gb" : { "line1" : "Disable updates" }, - "en-ie" : { - "line1" : "Disable updates" - }, "en-us" : { "line1" : "Disable Updates" }, - "es-en" : { - "line1" : "Deshab. actual." - }, "es-es" : { "line1" : "Desact. actual." }, @@ -905,15 +827,9 @@ "en-gb" : { "line1" : "Enable Apps" }, - "en-ie" : { - "line1" : "Enable Apps" - }, "en-us" : { "line1" : "Enable Apps" }, - "es-en" : { - "line1" : "Hab. aplic." - }, "es-es" : { "line1" : "Activar apl." }, @@ -969,15 +885,9 @@ "en-gb" : { "line1" : "Request update" }, - "en-ie" : { - "line1" : "Request update" - }, "en-us" : { "line1" : "Request Update" }, - "es-en" : { - "line1" : "Solicit. actualiz." - }, "es-es" : { "line1" : "Solicitar actual." }, @@ -1033,15 +943,9 @@ "en-gb" : { "line1" : "Update needed" }, - "en-ie" : { - "line1" : "Update needed" - }, "en-us" : { "line1" : "Update Needed" }, - "es-en" : { - "line1" : "Actualiz. neces." - }, "es-es" : { "line1" : "Actu. necesaria" }, @@ -1097,15 +1001,9 @@ "en-gb" : { "line1" : "Updating..." }, - "en-ie" : { - "line1" : "Updating..." - }, "en-us" : { "line1" : "Updating..." }, - "es-en" : { - "line1" : "Actualizando..." - }, "es-es" : { "line1" : "Actualizando..." }, @@ -1161,15 +1059,9 @@ "en-gb" : { "line1" : "Up-to-date" }, - "en-ie" : { - "line1" : "Up-to-date" - }, "en-us" : { "line1" : "Up-To-Date" }, - "es-en" : { - "line1" : "Actualizado" - }, "es-es" : { "line1" : "Actualizada" }, @@ -1228,18 +1120,10 @@ "label" : "Vehicle information", "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." }, - "en-ie" : { - "label" : "Vehicle information", - "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." - }, "en-us" : { "label" : "Vehicle information", "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure." }, - "es-en" : { - "label" : "Información del vehículo", - "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." - }, "es-es" : { "label" : "Información del vehículo", "tts" : "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos." diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json index c949575190..087da1e93b 100644 --- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json +++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_initial.json @@ -56,12 +56,6 @@ "textBody" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu.", "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny." }, - "en-ie" : - { - "line1" : "Grant requested", - "line2" : "permission(s)?", - "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." - }, "en-us" : { "line1" : "Grant Requested", @@ -69,13 +63,6 @@ "textBody" : "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent.", "tts" : "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny." }, - "es-en" : - { - "line1" : "¿Otorgar permiso(s)", - "line2" : "solicitado(s)?", - "textBody" : "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior.", - "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar." - }, "es-es" : { "line1" : "¿Conceder permisos", @@ -180,18 +167,10 @@ { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." }, - "en-ie" : - { - "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." - }, "en-us" : { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny." }, - "es-en" : - { - "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." - }, "es-es" : { "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo." @@ -266,18 +245,10 @@ { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "en-ie" : - { - "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." - }, "en-us" : { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "es-en" : - { - "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." - }, "es-es" : { "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil." @@ -356,23 +327,12 @@ "textBody" : "This version of %appName% is not authorized and will not work with SYNC.", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "en-ie" : - { - "line1" : "not authorized", - "tts" : "This version of %appName% is not authorized and will not work with SYNC." - }, "en-us" : { "line1" : "Not Authorized", "textBody" : "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%.", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "es-en" : - { - "line1" : "no autorizada", - "textBody" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.", - "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." - }, "es-es" : { "line1" : "No autorizada", @@ -467,23 +427,12 @@ "textBody" : "This version of %appName% is not supported by SYNC.", "tts" : "This version of %appName% is not supported by SYNC." }, - "en-ie" : - { - "line1" : "not supported", - "tts" : "This version of %appName% is not supported by SYNC." - }, "en-us" : { "line1" : "Not Supported", "textBody" : "Your version of %appName% is not supported by SYNC.", "tts" : "This version of %appName% is not supported by SYNC." }, - "es-en" : - { - "line1" : "no compatible", - "textBody" : "Esta versión de %appName% no es compatible con SYNC.", - "tts" : "Esta versión de %appName% no es compatible con SYNC." - }, "es-es" : { "line1" : "No compatible", @@ -623,12 +572,6 @@ "textBody" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.", "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." }, - "en-ie" : - { - "line1" : "Disable auto-updates", - "line2" : "and Mobile Apps?", - "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." - }, "en-us" : { "line1" : "Disable Auto-Updates", @@ -636,13 +579,6 @@ "textBody" : "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel.", "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel." }, - "es-en" : - { - "line1" : "¿Deshab. actualiz.", - "line2" : "autom. y aplic. móv.?", - "textBody" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.", - "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." - }, "es-es" : { "line1" : "¿Desact. actual. auto", @@ -751,23 +687,12 @@ "textBody" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.", "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." }, - "en-ie" : - { - "label" : "Driving characteristics", - "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." - }, "en-us" : { "label" : "Driving Characteristics", "textBody" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.", "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM." }, - "es-en" : - { - "label" : "Características del manejo", - "textBody" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.", - "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." - }, "es-es" : { "label" : "Características de conducción", @@ -863,23 +788,12 @@ "textBody" : "An app can access vehicle GPS and speed.", "tts" : "An app can access vehicle GPS and speed." }, - "en-ie" : - { - "label" : "GPS and speed", - "tts" : "An app can access vehicle GPS and speed." - }, "en-us" : { "label" : "GPS and Speed", "textBody" : "An app can access vehicle GPS and speed.", "tts" : "An app can access vehicle GPS and speed." }, - "es-en" : - { - "label" : "GPS y velocidad", - "textBody" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.", - "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." - }, "es-es" : { "label" : "GPS y velocidad", @@ -974,23 +888,12 @@ "textBody" : "An app can send notifications when running in the background.", "tts" : "An app can send notifications when running in the background." }, - "en-ie" : - { - "label" : "Push notifications", - "tts" : "An app can send notifications when running in the background." - }, "en-us" : { "label" : "Push Notifications", "textBody" : "An app can send notifications when running in the background.", "tts" : "An app can send notifications when running in the background." }, - "es-en" : - { - "label" : "Notificaciones tipo Push", - "textBody" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.", - "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." - }, "es-es" : { "label" : "Notificaciones push", @@ -1100,20 +1003,11 @@ { "line1" : "Disable updates" }, - "en-ie" : - { - "line1" : "Disable updates" - }, "en-us" : { "line1" : "Disable Updates", "textBody" : "Disable Updates" }, - "es-en" : - { - "line1" : "Deshab. actual.", - "textBody" : "Deshab. actual." - }, "es-es" : { "line1" : "Desact. actual." @@ -1190,18 +1084,10 @@ { "line1" : "Enable Apps" }, - "en-ie" : - { - "line1" : "Enable Apps" - }, "en-us" : { "line1" : "Enable Apps" }, - "es-en" : - { - "line1" : "Hab. aplic." - }, "es-es" : { "line1" : "Activar apl." @@ -1277,20 +1163,11 @@ { "line1" : "Request update" }, - "en-ie" : - { - "line1" : "Request update" - }, "en-us" : { "line1" : "Request Update", "textBody" : "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute." }, - "es-en" : - { - "line1" : "Solicit. actualiz.", - "textBody" : "Solicit. actualiz." - }, "es-es" : { "line1" : "Solicitar actual." @@ -1368,20 +1245,11 @@ "line1" : "Update needed", "textBody" : "Update needed" }, - "en-ie" : - { - "line1" : "Update needed" - }, "en-us" : { "line1" : "Update Needed", "textBody" : "Update Needed" }, - "es-en" : - { - "line1" : "Actualiz. neces.", - "textBody" : "Actualiz. neces." - }, "es-es" : { "line1" : "Actu. necesaria" @@ -1459,20 +1327,11 @@ "line1" : "Updating...", "textBody" : "Updating..." }, - "en-ie" : - { - "line1" : "Updating..." - }, "en-us" : { "line1" : "Updating...", "textBody" : "Updating..." }, - "es-en" : - { - "line1" : "Actualizando...", - "textBody" : "Actualizando..." - }, "es-es" : { "line1" : "Actualizando..." @@ -1550,20 +1409,11 @@ "line1" : "Up-to-date", "textBody" : "Up-to-date" }, - "en-ie" : - { - "line1" : "Up-to-date" - }, "en-us" : { "line1" : "Up-To-Date", "textBody" : "Up-To-Date" }, - "es-en" : - { - "line1" : "Actualizado", - "textBody" : "Actualizado" - }, "es-es" : { "line1" : "Actualizada" @@ -1644,23 +1494,12 @@ "textBody" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.", "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure." }, - "en-ie" : - { - "label" : "Vehicle information", - "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." - }, "en-us" : { "label" : "Vehicle Information", "textBody" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.", "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure." }, - "es-en" : - { - "label" : "Información del vehículo", - "textBody" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.", - "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." - }, "es-es" : { "label" : "Información del vehículo", diff --git a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json index 81c2093c72..43c16f18b8 100644 --- a/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json +++ b/src/components/policy/policy_external/test/json/sdl_preloaded_pt_for_merge_latest.json @@ -56,12 +56,6 @@ "textBody" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu.", "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny." }, - "en-ie" : - { - "line1" : "Grant requested", - "line2" : "permission(s)?", - "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." - }, "en-us" : { "line1" : "Grant Requested", @@ -69,13 +63,6 @@ "textBody" : "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent.", "tts" : "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny." }, - "es-en" : - { - "line1" : "¿Otorgar permiso(s)", - "line2" : "solicitado(s)?", - "textBody" : "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior.", - "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar." - }, "es-es" : { "line1" : "¿Conceder permisos", @@ -180,18 +167,10 @@ { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." }, - "en-ie" : - { - "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." - }, "en-us" : { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny." }, - "es-en" : - { - "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." - }, "es-es" : { "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo." @@ -266,18 +245,10 @@ { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "en-ie" : - { - "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." - }, "en-us" : { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "es-en" : - { - "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." - }, "es-es" : { "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil." @@ -356,23 +327,12 @@ "textBody" : "This version of %appName% is not authorized and will not work with SYNC.", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "en-ie" : - { - "line1" : "not authorized", - "tts" : "This version of %appName% is not authorized and will not work with SYNC." - }, "en-us" : { "line1" : "Not Authorized", "textBody" : "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%.", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "es-en" : - { - "line1" : "no autorizada", - "textBody" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.", - "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." - }, "es-es" : { "line1" : "No autorizada", @@ -467,23 +427,12 @@ "textBody" : "This version of %appName% is not supported by SYNC.", "tts" : "This version of %appName% is not supported by SYNC." }, - "en-ie" : - { - "line1" : "not supported", - "tts" : "This version of %appName% is not supported by SYNC." - }, "en-us" : { "line1" : "Not Supported", "textBody" : "Your version of %appName% is not supported by SYNC.", "tts" : "This version of %appName% is not supported by SYNC." }, - "es-en" : - { - "line1" : "no compatible", - "textBody" : "Esta versión de %appName% no es compatible con SYNC.", - "tts" : "Esta versión de %appName% no es compatible con SYNC." - }, "es-es" : { "line1" : "No compatible", @@ -623,12 +572,6 @@ "textBody" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.", "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." }, - "en-ie" : - { - "line1" : "Disable auto-updates", - "line2" : "and Mobile Apps?", - "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." - }, "en-us" : { "line1" : "Disable Auto-Updates", @@ -636,13 +579,6 @@ "textBody" : "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel.", "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel." }, - "es-en" : - { - "line1" : "¿Deshab. actualiz.", - "line2" : "autom. y aplic. móv.?", - "textBody" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.", - "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." - }, "es-es" : { "line1" : "¿Desact. actual. auto", @@ -751,23 +687,12 @@ "textBody" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.", "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." }, - "en-ie" : - { - "label" : "Driving characteristics", - "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." - }, "en-us" : { "label" : "Driving Characteristics", "textBody" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.", "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM." }, - "es-en" : - { - "label" : "Características del manejo", - "textBody" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.", - "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." - }, "es-es" : { "label" : "Características de conducción", @@ -863,23 +788,12 @@ "textBody" : "An app can access vehicle GPS and speed.", "tts" : "An app can access vehicle GPS and speed." }, - "en-ie" : - { - "label" : "GPS and speed", - "tts" : "An app can access vehicle GPS and speed." - }, "en-us" : { "label" : "GPS and Speed", "textBody" : "An app can access vehicle GPS and speed.", "tts" : "An app can access vehicle GPS and speed." }, - "es-en" : - { - "label" : "GPS y velocidad", - "textBody" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.", - "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." - }, "es-es" : { "label" : "GPS y velocidad", @@ -974,23 +888,12 @@ "textBody" : "An app can send notifications when running in the background.", "tts" : "An app can send notifications when running in the background." }, - "en-ie" : - { - "label" : "Push notifications", - "tts" : "An app can send notifications when running in the background." - }, "en-us" : { "label" : "Push Notifications", "textBody" : "An app can send notifications when running in the background.", "tts" : "An app can send notifications when running in the background." }, - "es-en" : - { - "label" : "Notificaciones tipo Push", - "textBody" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.", - "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." - }, "es-es" : { "label" : "Notificaciones push", @@ -1100,20 +1003,11 @@ { "line1" : "Disable updates" }, - "en-ie" : - { - "line1" : "Disable updates" - }, "en-us" : { "line1" : "Disable Updates", "textBody" : "Disable Updates" }, - "es-en" : - { - "line1" : "Deshab. actual.", - "textBody" : "Deshab. actual." - }, "es-es" : { "line1" : "Desact. actual." @@ -1190,18 +1084,10 @@ { "line1" : "Enable Apps" }, - "en-ie" : - { - "line1" : "Enable Apps" - }, "en-us" : { "line1" : "Enable Apps" }, - "es-en" : - { - "line1" : "Hab. aplic." - }, "es-es" : { "line1" : "Activar apl." @@ -1277,20 +1163,11 @@ { "line1" : "Request update" }, - "en-ie" : - { - "line1" : "Request update" - }, "en-us" : { "line1" : "Request Update", "textBody" : "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute." }, - "es-en" : - { - "line1" : "Solicit. actualiz.", - "textBody" : "Solicit. actualiz." - }, "es-es" : { "line1" : "Solicitar actual." @@ -1368,20 +1245,11 @@ "line1" : "Update needed", "textBody" : "Update needed" }, - "en-ie" : - { - "line1" : "Update needed" - }, "en-us" : { "line1" : "Update Needed", "textBody" : "Update Needed" }, - "es-en" : - { - "line1" : "Actualiz. neces.", - "textBody" : "Actualiz. neces." - }, "es-es" : { "line1" : "Actu. necesaria" @@ -1459,20 +1327,11 @@ "line1" : "Updating...", "textBody" : "Updating..." }, - "en-ie" : - { - "line1" : "Updating..." - }, "en-us" : { "line1" : "Updating...", "textBody" : "Updating..." }, - "es-en" : - { - "line1" : "Actualizando...", - "textBody" : "Actualizando..." - }, "es-es" : { "line1" : "Actualizando..." @@ -1550,20 +1409,11 @@ "line1" : "Up-to-date", "textBody" : "Up-to-date" }, - "en-ie" : - { - "line1" : "Up-to-date" - }, "en-us" : { "line1" : "Up-To-Date", "textBody" : "Up-To-Date" }, - "es-en" : - { - "line1" : "Actualizado", - "textBody" : "Actualizado" - }, "es-es" : { "line1" : "Actualizada" @@ -1644,23 +1494,12 @@ "textBody" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.", "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure." }, - "en-ie" : - { - "label" : "Vehicle information", - "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." - }, "en-us" : { "label" : "Vehicle Information", "textBody" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.", "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure." }, - "es-en" : - { - "label" : "Información del vehículo", - "textBody" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.", - "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." - }, "es-es" : { "label" : "Información del vehículo", diff --git a/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json b/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json index d17a4b82e4..066ed86727 100644 --- a/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json +++ b/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_initial.json @@ -56,12 +56,6 @@ "textBody" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu.", "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny." }, - "en-ie" : - { - "line1" : "Grant requested", - "line2" : "permission(s)?", - "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." - }, "en-us" : { "line1" : "Grant Requested", @@ -69,13 +63,6 @@ "textBody" : "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent.", "tts" : "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny." }, - "es-en" : - { - "line1" : "¿Otorgar permiso(s)", - "line2" : "solicitado(s)?", - "textBody" : "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior.", - "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar." - }, "es-es" : { "line1" : "¿Conceder permisos", @@ -180,18 +167,10 @@ { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." }, - "en-ie" : - { - "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." - }, "en-us" : { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny." }, - "es-en" : - { - "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." - }, "es-es" : { "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo." @@ -266,18 +245,10 @@ { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "en-ie" : - { - "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." - }, "en-us" : { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "es-en" : - { - "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." - }, "es-es" : { "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil." @@ -356,23 +327,12 @@ "textBody" : "This version of %appName% is not authorized and will not work with SYNC.", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "en-ie" : - { - "line1" : "not authorized", - "tts" : "This version of %appName% is not authorized and will not work with SYNC." - }, "en-us" : { "line1" : "Not Authorized", "textBody" : "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%.", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "es-en" : - { - "line1" : "no autorizada", - "textBody" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.", - "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." - }, "es-es" : { "line1" : "No autorizada", @@ -467,23 +427,12 @@ "textBody" : "This version of %appName% is not supported by SYNC.", "tts" : "This version of %appName% is not supported by SYNC." }, - "en-ie" : - { - "line1" : "not supported", - "tts" : "This version of %appName% is not supported by SYNC." - }, "en-us" : { "line1" : "Not Supported", "textBody" : "Your version of %appName% is not supported by SYNC.", "tts" : "This version of %appName% is not supported by SYNC." }, - "es-en" : - { - "line1" : "no compatible", - "textBody" : "Esta versión de %appName% no es compatible con SYNC.", - "tts" : "Esta versión de %appName% no es compatible con SYNC." - }, "es-es" : { "line1" : "No compatible", @@ -623,12 +572,6 @@ "textBody" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.", "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." }, - "en-ie" : - { - "line1" : "Disable auto-updates", - "line2" : "and Mobile Apps?", - "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." - }, "en-us" : { "line1" : "Disable Auto-Updates", @@ -636,13 +579,6 @@ "textBody" : "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel.", "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel." }, - "es-en" : - { - "line1" : "¿Deshab. actualiz.", - "line2" : "autom. y aplic. móv.?", - "textBody" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.", - "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." - }, "es-es" : { "line1" : "¿Desact. actual. auto", @@ -751,23 +687,12 @@ "textBody" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.", "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." }, - "en-ie" : - { - "label" : "Driving characteristics", - "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." - }, "en-us" : { "label" : "Driving Characteristics", "textBody" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.", "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM." }, - "es-en" : - { - "label" : "Características del manejo", - "textBody" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.", - "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." - }, "es-es" : { "label" : "Características de conducción", @@ -863,23 +788,12 @@ "textBody" : "An app can access vehicle GPS and speed.", "tts" : "An app can access vehicle GPS and speed." }, - "en-ie" : - { - "label" : "GPS and speed", - "tts" : "An app can access vehicle GPS and speed." - }, "en-us" : { "label" : "GPS and Speed", "textBody" : "An app can access vehicle GPS and speed.", "tts" : "An app can access vehicle GPS and speed." }, - "es-en" : - { - "label" : "GPS y velocidad", - "textBody" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.", - "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." - }, "es-es" : { "label" : "GPS y velocidad", @@ -974,23 +888,12 @@ "textBody" : "An app can send notifications when running in the background.", "tts" : "An app can send notifications when running in the background." }, - "en-ie" : - { - "label" : "Push notifications", - "tts" : "An app can send notifications when running in the background." - }, "en-us" : { "label" : "Push Notifications", "textBody" : "An app can send notifications when running in the background.", "tts" : "An app can send notifications when running in the background." }, - "es-en" : - { - "label" : "Notificaciones tipo Push", - "textBody" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.", - "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." - }, "es-es" : { "label" : "Notificaciones push", @@ -1100,20 +1003,11 @@ { "line1" : "Disable updates" }, - "en-ie" : - { - "line1" : "Disable updates" - }, "en-us" : { "line1" : "Disable Updates", "textBody" : "Disable Updates" }, - "es-en" : - { - "line1" : "Deshab. actual.", - "textBody" : "Deshab. actual." - }, "es-es" : { "line1" : "Desact. actual." @@ -1190,18 +1084,10 @@ { "line1" : "Enable Apps" }, - "en-ie" : - { - "line1" : "Enable Apps" - }, "en-us" : { "line1" : "Enable Apps" }, - "es-en" : - { - "line1" : "Hab. aplic." - }, "es-es" : { "line1" : "Activar apl." @@ -1277,20 +1163,11 @@ { "line1" : "Request update" }, - "en-ie" : - { - "line1" : "Request update" - }, "en-us" : { "line1" : "Request Update", "textBody" : "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute." }, - "es-en" : - { - "line1" : "Solicit. actualiz.", - "textBody" : "Solicit. actualiz." - }, "es-es" : { "line1" : "Solicitar actual." @@ -1368,20 +1245,11 @@ "line1" : "Update needed", "textBody" : "Update needed" }, - "en-ie" : - { - "line1" : "Update needed" - }, "en-us" : { "line1" : "Update Needed", "textBody" : "Update Needed" }, - "es-en" : - { - "line1" : "Actualiz. neces.", - "textBody" : "Actualiz. neces." - }, "es-es" : { "line1" : "Actu. necesaria" @@ -1459,20 +1327,11 @@ "line1" : "Updating...", "textBody" : "Updating..." }, - "en-ie" : - { - "line1" : "Updating..." - }, "en-us" : { "line1" : "Updating...", "textBody" : "Updating..." }, - "es-en" : - { - "line1" : "Actualizando...", - "textBody" : "Actualizando..." - }, "es-es" : { "line1" : "Actualizando..." @@ -1550,20 +1409,11 @@ "line1" : "Up-to-date", "textBody" : "Up-to-date" }, - "en-ie" : - { - "line1" : "Up-to-date" - }, "en-us" : { "line1" : "Up-To-Date", "textBody" : "Up-To-Date" }, - "es-en" : - { - "line1" : "Actualizado", - "textBody" : "Actualizado" - }, "es-es" : { "line1" : "Actualizada" @@ -1644,23 +1494,12 @@ "textBody" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.", "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure." }, - "en-ie" : - { - "label" : "Vehicle information", - "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." - }, "en-us" : { "label" : "Vehicle Information", "textBody" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.", "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure." }, - "es-en" : - { - "label" : "Información del vehículo", - "textBody" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.", - "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." - }, "es-es" : { "label" : "Información del vehículo", diff --git a/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json b/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json index 81c2093c72..43c16f18b8 100644 --- a/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json +++ b/src/components/policy/policy_regular/test/json/sdl_preloaded_pt_for_merge_latest.json @@ -56,12 +56,6 @@ "textBody" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu.", "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny." }, - "en-ie" : - { - "line1" : "Grant requested", - "line2" : "permission(s)?", - "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny." - }, "en-us" : { "line1" : "Grant Requested", @@ -69,13 +63,6 @@ "textBody" : "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent.", "tts" : "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny." }, - "es-en" : - { - "line1" : "¿Otorgar permiso(s)", - "line2" : "solicitado(s)?", - "textBody" : "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior.", - "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar." - }, "es-es" : { "line1" : "¿Conceder permisos", @@ -180,18 +167,10 @@ { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." }, - "en-ie" : - { - "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny." - }, "en-us" : { "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny." }, - "es-en" : - { - "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar." - }, "es-es" : { "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo." @@ -266,18 +245,10 @@ { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "en-ie" : - { - "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." - }, "en-us" : { "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device." }, - "es-en" : - { - "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil." - }, "es-es" : { "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil." @@ -356,23 +327,12 @@ "textBody" : "This version of %appName% is not authorized and will not work with SYNC.", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "en-ie" : - { - "line1" : "not authorized", - "tts" : "This version of %appName% is not authorized and will not work with SYNC." - }, "en-us" : { "line1" : "Not Authorized", "textBody" : "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%.", "tts" : "This version of %appName% is not authorized and will not work with SYNC." }, - "es-en" : - { - "line1" : "no autorizada", - "textBody" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.", - "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC." - }, "es-es" : { "line1" : "No autorizada", @@ -467,23 +427,12 @@ "textBody" : "This version of %appName% is not supported by SYNC.", "tts" : "This version of %appName% is not supported by SYNC." }, - "en-ie" : - { - "line1" : "not supported", - "tts" : "This version of %appName% is not supported by SYNC." - }, "en-us" : { "line1" : "Not Supported", "textBody" : "Your version of %appName% is not supported by SYNC.", "tts" : "This version of %appName% is not supported by SYNC." }, - "es-en" : - { - "line1" : "no compatible", - "textBody" : "Esta versión de %appName% no es compatible con SYNC.", - "tts" : "Esta versión de %appName% no es compatible con SYNC." - }, "es-es" : { "line1" : "No compatible", @@ -623,12 +572,6 @@ "textBody" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.", "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." }, - "en-ie" : - { - "line1" : "Disable auto-updates", - "line2" : "and Mobile Apps?", - "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel." - }, "en-us" : { "line1" : "Disable Auto-Updates", @@ -636,13 +579,6 @@ "textBody" : "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel.", "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel." }, - "es-en" : - { - "line1" : "¿Deshab. actualiz.", - "line2" : "autom. y aplic. móv.?", - "textBody" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.", - "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar." - }, "es-es" : { "line1" : "¿Desact. actual. auto", @@ -751,23 +687,12 @@ "textBody" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.", "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." }, - "en-ie" : - { - "label" : "Driving characteristics", - "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status." - }, "en-us" : { "label" : "Driving Characteristics", "textBody" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.", "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM." }, - "es-en" : - { - "label" : "Características del manejo", - "textBody" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.", - "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad." - }, "es-es" : { "label" : "Características de conducción", @@ -863,23 +788,12 @@ "textBody" : "An app can access vehicle GPS and speed.", "tts" : "An app can access vehicle GPS and speed." }, - "en-ie" : - { - "label" : "GPS and speed", - "tts" : "An app can access vehicle GPS and speed." - }, "en-us" : { "label" : "GPS and Speed", "textBody" : "An app can access vehicle GPS and speed.", "tts" : "An app can access vehicle GPS and speed." }, - "es-en" : - { - "label" : "GPS y velocidad", - "textBody" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.", - "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo." - }, "es-es" : { "label" : "GPS y velocidad", @@ -974,23 +888,12 @@ "textBody" : "An app can send notifications when running in the background.", "tts" : "An app can send notifications when running in the background." }, - "en-ie" : - { - "label" : "Push notifications", - "tts" : "An app can send notifications when running in the background." - }, "en-us" : { "label" : "Push Notifications", "textBody" : "An app can send notifications when running in the background.", "tts" : "An app can send notifications when running in the background." }, - "es-en" : - { - "label" : "Notificaciones tipo Push", - "textBody" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.", - "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano." - }, "es-es" : { "label" : "Notificaciones push", @@ -1100,20 +1003,11 @@ { "line1" : "Disable updates" }, - "en-ie" : - { - "line1" : "Disable updates" - }, "en-us" : { "line1" : "Disable Updates", "textBody" : "Disable Updates" }, - "es-en" : - { - "line1" : "Deshab. actual.", - "textBody" : "Deshab. actual." - }, "es-es" : { "line1" : "Desact. actual." @@ -1190,18 +1084,10 @@ { "line1" : "Enable Apps" }, - "en-ie" : - { - "line1" : "Enable Apps" - }, "en-us" : { "line1" : "Enable Apps" }, - "es-en" : - { - "line1" : "Hab. aplic." - }, "es-es" : { "line1" : "Activar apl." @@ -1277,20 +1163,11 @@ { "line1" : "Request update" }, - "en-ie" : - { - "line1" : "Request update" - }, "en-us" : { "line1" : "Request Update", "textBody" : "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute." }, - "es-en" : - { - "line1" : "Solicit. actualiz.", - "textBody" : "Solicit. actualiz." - }, "es-es" : { "line1" : "Solicitar actual." @@ -1368,20 +1245,11 @@ "line1" : "Update needed", "textBody" : "Update needed" }, - "en-ie" : - { - "line1" : "Update needed" - }, "en-us" : { "line1" : "Update Needed", "textBody" : "Update Needed" }, - "es-en" : - { - "line1" : "Actualiz. neces.", - "textBody" : "Actualiz. neces." - }, "es-es" : { "line1" : "Actu. necesaria" @@ -1459,20 +1327,11 @@ "line1" : "Updating...", "textBody" : "Updating..." }, - "en-ie" : - { - "line1" : "Updating..." - }, "en-us" : { "line1" : "Updating...", "textBody" : "Updating..." }, - "es-en" : - { - "line1" : "Actualizando...", - "textBody" : "Actualizando..." - }, "es-es" : { "line1" : "Actualizando..." @@ -1550,20 +1409,11 @@ "line1" : "Up-to-date", "textBody" : "Up-to-date" }, - "en-ie" : - { - "line1" : "Up-to-date" - }, "en-us" : { "line1" : "Up-To-Date", "textBody" : "Up-To-Date" }, - "es-en" : - { - "line1" : "Actualizado", - "textBody" : "Actualizado" - }, "es-es" : { "line1" : "Actualizada" @@ -1644,23 +1494,12 @@ "textBody" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.", "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure." }, - "en-ie" : - { - "label" : "Vehicle information", - "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure." - }, "en-us" : { "label" : "Vehicle Information", "textBody" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.", "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure." }, - "es-en" : - { - "label" : "Información del vehículo", - "textBody" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.", - "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos." - }, "es-es" : { "label" : "Información del vehículo", -- cgit v1.2.1 From 7912ecb1c083bdaebadd43fe1530e9dded10083a Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Wed, 25 Aug 2021 16:52:38 -0400 Subject: Add method for delete empty message (#3751) * Add method for delete empty message * Add WARNINGS code when some parameters were cut off Co-authored-by: Jacob Keeler --- .../include/application_manager/message_helper.h | 8 ++++ .../commands/mobile/get_vehicle_data_request.cc | 7 +++ .../mobile/on_vehicle_data_notification.cc | 2 + .../src/message_helper/message_helper.cc | 53 ++++++++++++++++++++++ .../application_manager/mock_message_helper.h | 2 + .../test/mock_message_helper.cc | 7 +++ 6 files changed, 79 insertions(+) diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index 88200d6593..9cfb504b00 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -1095,6 +1095,14 @@ class MessageHelper { ApplicationManager& app_mngr, const WindowID window_id); + /** + * @brief Recursively removes empty parameters of composite type from message + * @param msg_params smart object containing message params + * @return amount of empty parameters removed + */ + static uint16_t RemoveEmptyMessageParams( + smart_objects::SmartObject& msg_params); + /** * @brief AddDefaultParamsToTireStatus adds missing default sub-params to * tirePressure param, if version of related application requires presence of diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc index 18149fbe02..854d78b684 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc @@ -170,6 +170,13 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { } } + if (MessageHelper::RemoveEmptyMessageParams( + message[strings::msg_params]) > 0) { + mobile_result_code = mobile_apis::Result::WARNINGS; + response_info = app_mngr::commands::MergeInfos( + response_info, "Some vehicle data items could not be retrieved"); + } + if (message[strings::msg_params].empty() && hmi_apis::Common_Result::DATA_NOT_AVAILABLE != result_code) { response_info = "Failed to retrieve data from vehicle"; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc index 0ae38a9398..71a6289d9c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc @@ -70,6 +70,8 @@ void OnVehicleDataNotification::Run() { custom_vehicle_data_manager_.CreateMobileMessageParams( (*message_)[strings::msg_params]); + MessageHelper::RemoveEmptyMessageParams((*message_)[strings::msg_params]); + const auto& param_names = (*message_)[strings::msg_params].enumerate(); for (const auto& name : param_names) { SDL_LOG_DEBUG("vehicle_data name: " << name); diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index decdabb55c..606bc4c3f0 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -3475,6 +3475,59 @@ WindowID MessageHelper::ExtractWindowIdFromSmartObject( return mobile_apis::PredefinedWindows::DEFAULT_WINDOW; } +uint16_t MessageHelper::RemoveEmptyMessageParams( + smart_objects::SmartObject& msg_params) { + uint16_t erased_params = 0; + + if (msg_params.empty()) { + return erased_params; + } + + const auto keys = msg_params.enumerate(); + for (const auto& key_params : keys) { + auto& param = msg_params[key_params]; + + if (smart_objects::SmartType_Array == param.getType()) { + smart_objects::SmartArray* array = param.asArray(); + + if (array == nullptr || array->empty()) + continue; + + const bool are_all_empty = + std::all_of(array->begin(), + array->end(), + [](const smart_objects::SmartObject& item) { + if (smart_objects::SmartType_Array == item.getType() || + smart_objects::SmartType_Map == item.getType()) { + return item.empty(); + } + + return false; + }); + + if (are_all_empty) { + SDL_LOG_DEBUG("Remove empty array " + key_params + + " from msg_params in HMI response"); + msg_params.erase(key_params); + ++erased_params; + } + + continue; + } + + if (smart_objects::SmartType_Map == param.getType()) { + if (param.empty()) { + SDL_LOG_DEBUG("Remove empty field " + key_params + + " from msg_params in HMI response"); + msg_params.erase(key_params); + ++erased_params; + } + } + } + + return erased_params; +} + void MessageHelper::AddDefaultParamsToTireStatus( ApplicationSharedPtr app, smart_objects::SmartObject& response_from_hmi) { const utils::SemanticVersion max_version_with_mandatory_params(8, 0, 0); diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index 9e69b0bcd6..67d992d4af 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -394,6 +394,8 @@ class MockMessageHelper { application_manager::ApplicationSharedPtr application, application_manager::ApplicationManager& app_mngr, const application_manager::WindowID window_id)); + MOCK_METHOD1(RemoveEmptyMessageParams, + uint16_t(const smart_objects::SmartObject&)); MOCK_METHOD2(AddDefaultParamsToTireStatus, void(application_manager::ApplicationSharedPtr application, diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 02cf70e3ba..9212b0feab 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -687,10 +687,17 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateResponseMessageFromHmi( function_id, correlation_id, result_code); } +uint16_t MessageHelper::RemoveEmptyMessageParams( + smart_objects::SmartObject& msg_params) { + return MockMessageHelper::message_helper_mock()->RemoveEmptyMessageParams( + msg_params); +} + void MessageHelper::AddDefaultParamsToTireStatus( application_manager::ApplicationSharedPtr application, smart_objects::SmartObject& response_from_hmi) { return MockMessageHelper::message_helper_mock()->AddDefaultParamsToTireStatus( application, response_from_hmi); } + } // namespace application_manager -- cgit v1.2.1 From 2d23a79a745c50b0ff69ac91ceef55320ee79b37 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Fri, 27 Aug 2021 15:05:13 -0400 Subject: Fix build failure when EXTENDED_MEDIA_MODE=ON (#3766) --- src/components/media_manager/src/audio/from_mic_recorder_adapter.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc index 68018028ae..911ef239cc 100644 --- a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc +++ b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc @@ -108,10 +108,6 @@ void FromMicRecorderAdapter::set_output_file(const std::string& output_file) { output_file_ = output_file; } -void FromMicRecorderAdapter::set_duration(int32_t duration) { - duration_ = duration; -} - void FromMicRecorderAdapter::set_config( mobile_apis::SamplingRate::eType sampling_rate, mobile_apis::BitsPerSample::eType bits_per_sample, -- cgit v1.2.1 From 2fc754452eac4e08e4919245742cd4dfb945a3d8 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Fri, 27 Aug 2021 15:06:30 -0400 Subject: Send REQUEST type and generated sequence number in SendHandshakeData (#3761) * Send REQUEST type and generated sequence number in SendHandshakeData * Update query type in tests --- .../security_manager/security_manager_impl.h | 13 +++++++++-- .../security_manager/src/security_manager_impl.cc | 26 ++++++++++++++++------ .../security_manager/test/security_manager_test.cc | 2 +- .../security_manager/test/security_query_test.cc | 17 ++++++-------- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h index 7cbb19708e..c4a752173e 100644 --- a/src/components/security_manager/include/security_manager/security_manager_impl.h +++ b/src/components/security_manager/include/security_manager/security_manager_impl.h @@ -225,18 +225,25 @@ class SecurityManagerImpl : public SecurityManager, #endif private: + /** + * @brief NextSequentialNumber get next sequential number for request + * @return next sequential number + */ + uint32_t NextSequentialNumber(); + /** * \brief Sends Handshake binary data to mobile application * \param connection_key Unique key used by other components as session * identifier * \param data pointer to binary data array * \param data_size size of binary data array - * \param seq_number received from Mobile Application + * \param custom_seq_number specific sequential number of request. If omitted, + * this will be automatically generated */ void SendHandshakeBinData(const uint32_t connection_key, const uint8_t* const data, const size_t data_size, - const uint32_t seq_number = 0); + const uint32_t custom_seq_number = 0); /** * \brief Parse SecurityMessage as HandshakeData request * \param inMessage SecurityMessage with binary data of handshake @@ -327,6 +334,8 @@ class SecurityManagerImpl : public SecurityManager, std::set awaiting_certificate_connections_; std::set awaiting_time_connections_; + uint32_t current_seq_number_; + mutable sync_primitives::Lock waiters_lock_; volatile bool waiting_for_certificate_; volatile bool waiting_for_time_; diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc index 914d30003a..f78f859c04 100644 --- a/src/components/security_manager/src/security_manager_impl.cc +++ b/src/components/security_manager/src/security_manager_impl.cc @@ -54,6 +54,7 @@ SecurityManagerImpl::SecurityManagerImpl( , crypto_manager_(NULL) , protocol_handler_(NULL) , system_time_handler_(std::move(system_time_handler)) + , current_seq_number_(0) , waiting_for_certificate_(false) , waiting_for_time_(false) { DCHECK(system_time_handler_); @@ -596,13 +597,24 @@ bool SecurityManagerImpl::ProcessInternalError( return true; } -void SecurityManagerImpl::SendHandshakeBinData(const uint32_t connection_key, - const uint8_t* const data, - const size_t data_size, - const uint32_t seq_number) { - const SecurityQuery::QueryHeader header(SecurityQuery::NOTIFICATION, - SecurityQuery::SEND_HANDSHAKE_DATA, - seq_number); +uint32_t SecurityManagerImpl::NextSequentialNumber() { + if (current_seq_number_ >= std::numeric_limits::max()) { + current_seq_number_ = 0; + } + current_seq_number_++; + return current_seq_number_; +} + +void SecurityManagerImpl::SendHandshakeBinData( + const uint32_t connection_key, + const uint8_t* const data, + const size_t data_size, + const uint32_t custom_seq_number) { + uint32_t seq_number = + (0 == custom_seq_number) ? NextSequentialNumber() : custom_seq_number; + + const SecurityQuery::QueryHeader header( + SecurityQuery::REQUEST, SecurityQuery::SEND_HANDSHAKE_DATA, seq_number); DCHECK(data_size < 1024 * 1024 * 1024); const SecurityQuery query = SecurityQuery(header, connection_key, data, data_size); diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc index 912ffff4c7..7e0454e840 100644 --- a/src/components/security_manager/test/security_manager_test.cc +++ b/src/components/security_manager/test/security_manager_test.cc @@ -152,7 +152,7 @@ class SecurityManagerTest : public ::testing::Test { void EmulateMobileMessageHandshake(const uint8_t* const data, const uint32_t data_size, const int repeat_count = 1) { - const SecurityQuery::QueryHeader header(SecurityQuery::NOTIFICATION, + const SecurityQuery::QueryHeader header(SecurityQuery::RESPONSE, SecurityQuery::SEND_HANDSHAKE_DATA, kSeqNumber); for (int c = 0; c < repeat_count; ++c) { diff --git a/src/components/security_manager/test/security_query_test.cc b/src/components/security_manager/test/security_query_test.cc index 6becddaaf9..60e3a20d77 100644 --- a/src/components/security_manager/test/security_query_test.cc +++ b/src/components/security_manager/test/security_query_test.cc @@ -53,7 +53,7 @@ class SecurityQueryTest : public ::testing::Test { protected: void SetUp() OVERRIDE { // init_header used for SecurityQuery initialization - init_header.query_type = SecurityQuery::NOTIFICATION; + init_header.query_type = SecurityQuery::REQUEST; init_header.query_id = SecurityQuery::SEND_HANDSHAKE_DATA; init_header.seq_number = SEQ_NUMBER; init_header.json_size = 0u; @@ -107,18 +107,17 @@ TEST_F(SecurityQueryTest, QueryHeaderConstructor) { * Security QueryHeader shall construct with correct fields */ TEST_F(SecurityQueryTest, QueryHeaderConstructor2) { - SecurityQuery::QueryHeader new_header(SecurityQuery::NOTIFICATION, - SecurityQuery::SEND_HANDSHAKE_DATA, - SEQ_NUMBER); - ASSERT_EQ(new_header.query_type, SecurityQuery::NOTIFICATION); + SecurityQuery::QueryHeader new_header( + SecurityQuery::REQUEST, SecurityQuery::SEND_HANDSHAKE_DATA, SEQ_NUMBER); + ASSERT_EQ(new_header.query_type, SecurityQuery::REQUEST); ASSERT_EQ(new_header.query_id, SecurityQuery::SEND_HANDSHAKE_DATA); ASSERT_EQ(new_header.seq_number, SEQ_NUMBER); ASSERT_EQ(new_header.json_size, 0u); - SecurityQuery::QueryHeader new_header2(SecurityQuery::RESPONSE, + SecurityQuery::QueryHeader new_header2(SecurityQuery::NOTIFICATION, SecurityQuery::SEND_INTERNAL_ERROR, SEQ_NUMBER + 1); - ASSERT_EQ(new_header2.query_type, SecurityQuery::RESPONSE); + ASSERT_EQ(new_header2.query_type, SecurityQuery::NOTIFICATION); ASSERT_EQ(new_header2.query_id, SecurityQuery::SEND_INTERNAL_ERROR); ASSERT_EQ(new_header2.seq_number, SEQ_NUMBER + 1); ASSERT_EQ(new_header2.json_size, 0u); @@ -385,9 +384,7 @@ TEST_F(SecurityQueryTest, Parse_InvalidQuery_UnknownId_Response) { */ TEST_F(SecurityQueryTest, Parse_Handshake) { SecurityQuery::QueryHeader handshake_header( - SecurityQuery::NOTIFICATION, - SecurityQuery::SEND_HANDSHAKE_DATA, - SEQ_NUMBER); + SecurityQuery::REQUEST, SecurityQuery::SEND_HANDSHAKE_DATA, SEQ_NUMBER); // some sample data uint8_t raw_data[] = {0x6, 0x7, 0x8}; const size_t raw_data_size = sizeof(raw_data) / sizeof(raw_data[0]); -- cgit v1.2.1 From b9a2a53cca954b710ed5b25ba91d3267cc2996fd Mon Sep 17 00:00:00 2001 From: VladSemenyuk Date: Fri, 27 Aug 2021 22:36:43 +0300 Subject: Fix/ccb 3141 change command request inheritance structure (#3591) * Change command request inheritance structure. Fix data races during requests event processing. * Change commands according to new inheritance structure. * Change unit tests according new inheritance structure. * Fix review comments * Fix build after merge * Fix format style * Fix recursion in SetGlobalProperties * Add delay before request releasing That gives to event dispatcher some time to figure out that event should not be rasied for a finalized request and this request will be released soon. Also, this allows to avoid calling some virtual functions on pointer to invalidated object. * Fix data races in EventDispatcher Now reference counter is increased indirectly by event dispatcher before calling `HandleOnEvent()` of specific observer. This will guarantee that during `HandleOnEvent` the command object is still be alive. * Revert changes for SetGlobalProperties Co-authored-by: v-seme12 Co-authored-by: Andrii Kalinich --- .../application_manager/application_manager_impl.h | 9 + .../include/application_manager/commands/command.h | 9 +- .../application_manager/commands/command_impl.h | 4 +- .../commands/command_request_impl.h | 367 ++------- .../commands/request_from_hmi.h | 11 +- .../commands/request_from_mobile_impl.h | 372 +++++++++ .../application_manager/commands/request_to_hmi.h | 3 +- .../event_engine/event_dispatcher.h | 9 + .../event_engine/event_dispatcher_impl.h | 3 + .../event_engine/event_observer.h | 18 +- .../application_manager/hmi_language_handler.h | 2 +- .../policies/external/policy_event_observer.h | 6 +- .../policies/regular/policy_event_observer.h | 6 +- .../application_manager/request_controller_impl.h | 60 +- .../include/application_manager/request_info.h | 11 +- .../request_timeout_handler_impl.h | 2 +- .../resumption/resumption_data_processor_impl.h | 2 +- .../application_manager/state_controller_impl.h | 9 +- .../system_time/system_time_handler_impl.h | 3 +- .../hmi/as_get_app_service_data_request_from_hmi.h | 2 +- ...form_app_service_interaction_request_from_hmi.h | 2 +- .../commands/mobile/get_app_service_data_request.h | 5 +- .../perform_app_service_interaction_request.h | 4 +- .../commands/mobile/publish_app_service_request.h | 5 +- .../mobile/unpublish_app_service_request.h | 4 +- .../as_get_app_service_data_request_from_hmi.cc | 2 +- ...orm_app_service_interaction_request_from_hmi.cc | 2 +- .../mobile/get_app_service_data_request.cc | 10 +- .../perform_app_service_interaction_request.cc | 10 +- .../commands/mobile/publish_app_service_request.cc | 10 +- .../mobile/unpublish_app_service_request.cc | 10 +- .../hmi/rc_get_interior_vehicle_data_request.h | 2 +- .../rc_rpc_plugin/commands/rc_command_request.h | 8 +- .../rc_rpc_plugin/rc_pending_resumption_handler.h | 3 +- .../hmi/rc_get_interior_vehicle_data_request.cc | 2 +- .../src/commands/mobile/button_press_request.cc | 5 +- .../mobile/get_interior_vehicle_data_request.cc | 6 +- .../mobile/set_interior_vehicle_data_request.cc | 4 +- .../src/commands/rc_command_request.cc | 26 +- .../src/rc_pending_resumption_handler.cc | 2 +- .../rc_get_interior_vehicle_data_consent_test.cc | 3 +- .../test/rc_pending_resumption_handler_test.cc | 4 +- .../basic_communication_get_system_time_request.h | 7 +- .../commands/hmi/button_get_capabilities_request.h | 2 +- .../commands/hmi/get_system_info_request.h | 4 +- .../commands/hmi/navi_audio_start_stream_request.h | 10 +- .../commands/hmi/navi_is_ready_request.h | 5 +- .../commands/hmi/navi_set_video_config_request.h | 5 +- .../commands/hmi/navi_start_stream_request.h | 10 +- .../hmi/navi_subscribe_way_points_request.h | 2 +- .../commands/hmi/rc_get_capabilities_request.h | 2 +- .../commands/hmi/rc_is_ready_request.h | 5 +- .../commands/hmi/sdl_activate_app_request.h | 2 +- .../commands/hmi/subscribe_button_request.h | 5 +- .../commands/hmi/tts_get_capabilities_request.h | 2 +- .../commands/hmi/tts_get_language_request.h | 2 +- .../hmi/tts_get_supported_languages_request.h | 2 +- .../commands/hmi/tts_is_ready_request.h | 5 +- .../hmi/tts_set_global_properties_request.h | 2 +- .../commands/hmi/ui_add_command_request.h | 2 +- .../commands/hmi/ui_add_submenu_request.h | 2 +- .../commands/hmi/ui_create_window_request.h | 2 +- .../commands/hmi/ui_get_capabilities_request.h | 2 +- .../commands/hmi/ui_get_language_request.h | 2 +- .../hmi/ui_get_supported_languages_request.h | 2 +- .../commands/hmi/ui_is_ready_request.h | 5 +- .../hmi/ui_set_global_properties_request.h | 2 +- .../commands/hmi/unsubscribe_button_request.h | 7 +- .../commands/hmi/vr_add_command_request.h | 2 +- .../commands/hmi/vr_get_capabilities_request.h | 2 +- .../commands/hmi/vr_get_language_request.h | 2 +- .../hmi/vr_get_supported_languages_request.h | 2 +- .../commands/hmi/vr_is_ready_request.h | 5 +- .../commands/mobile/add_command_request.h | 29 +- .../commands/mobile/add_sub_menu_request.h | 4 +- .../commands/mobile/alert_maneuver_request.h | 11 +- .../sdl_rpc_plugin/commands/mobile/alert_request.h | 15 +- .../commands/mobile/cancel_interaction_request.h | 5 +- .../commands/mobile/change_registration_request.h | 20 +- .../commands/mobile/close_application_request.h | 5 +- .../mobile/create_interaction_choice_set_request.h | 21 +- .../commands/mobile/create_window_request.h | 4 +- .../commands/mobile/delete_command_request.h | 22 +- .../commands/mobile/delete_file_request.h | 4 +- .../mobile/delete_interaction_choice_set_request.h | 9 +- .../commands/mobile/delete_sub_menu_request.h | 3 +- .../commands/mobile/delete_window_request.h | 4 +- .../commands/mobile/dial_number_request.h | 4 +- .../commands/mobile/end_audio_pass_thru_request.h | 7 +- .../mobile/get_cloud_app_properties_request.h | 4 +- .../commands/mobile/get_file_request.h | 4 +- .../mobile/get_system_capability_request.h | 6 +- .../commands/mobile/get_way_points_request.h | 12 +- .../commands/mobile/list_files_request.h | 4 +- .../mobile/perform_audio_pass_thru_request.h | 19 +- .../commands/mobile/perform_interaction_request.h | 20 +- .../commands/mobile/put_file_request.h | 3 +- .../mobile/register_app_interface_request.h | 4 +- .../mobile/reset_global_properties_request.h | 16 +- .../commands/mobile/scrollable_message_request.h | 7 +- .../commands/mobile/send_haptic_data_request.h | 5 +- .../commands/mobile/send_location_request.h | 6 +- .../commands/mobile/set_app_icon_request.h | 6 +- .../mobile/set_cloud_app_properties_request.h | 6 +- .../commands/mobile/set_display_layout_request.h | 7 +- .../mobile/set_global_properties_request.h | 7 +- .../mobile/set_media_clock_timer_request.h | 6 +- .../commands/mobile/show_app_menu_request.h | 4 +- .../commands/mobile/show_constant_tbt_request.h | 7 +- .../sdl_rpc_plugin/commands/mobile/show_request.h | 6 +- .../commands/mobile/slider_request.h | 6 +- .../sdl_rpc_plugin/commands/mobile/speak_request.h | 6 +- .../commands/mobile/subscribe_button_request.h | 5 +- .../commands/mobile/subscribe_way_points_request.h | 6 +- .../commands/mobile/subtle_alert_request.h | 4 +- .../commands/mobile/system_request.h | 5 +- .../mobile/unregister_app_interface_request.h | 14 +- .../commands/mobile/unsubscribe_button_request.h | 8 +- .../mobile/unsubscribe_way_points_request.h | 6 +- .../commands/mobile/update_turn_list_request.h | 6 +- .../waypoints_pending_resumption_handler.h | 2 +- .../basic_communication_get_system_time_request.cc | 2 +- .../hmi/button_get_capabilities_request.cc | 3 +- .../src/commands/hmi/get_system_info_request.cc | 2 +- .../hmi/navi_audio_start_stream_request.cc | 3 +- .../src/commands/hmi/navi_is_ready_request.cc | 5 +- .../commands/hmi/navi_set_video_config_request.cc | 6 +- .../src/commands/hmi/navi_start_stream_request.cc | 3 +- .../hmi/navi_subscribe_way_points_request.cc | 2 +- .../commands/hmi/rc_get_capabilities_request.cc | 2 +- .../src/commands/hmi/rc_is_ready_request.cc | 5 +- .../src/commands/hmi/sdl_activate_app_request.cc | 2 +- .../src/commands/hmi/subscribe_button_request.cc | 5 +- .../commands/hmi/tts_get_capabilities_request.cc | 2 +- .../src/commands/hmi/tts_get_language_request.cc | 2 +- .../hmi/tts_get_supported_languages_request.cc | 2 +- .../src/commands/hmi/tts_is_ready_request.cc | 5 +- .../hmi/tts_set_global_properties_request.cc | 2 +- .../src/commands/hmi/ui_add_command_request.cc | 2 +- .../src/commands/hmi/ui_add_submenu_request.cc | 2 +- .../src/commands/hmi/ui_create_window_request.cc | 2 +- .../commands/hmi/ui_get_capabilities_request.cc | 2 +- .../src/commands/hmi/ui_get_language_request.cc | 2 +- .../hmi/ui_get_supported_languages_request.cc | 2 +- .../src/commands/hmi/ui_is_ready_request.cc | 5 +- .../hmi/ui_set_global_properties_request.cc | 2 +- .../src/commands/hmi/unsubscribe_button_request.cc | 5 +- .../src/commands/hmi/vr_add_command_request.cc | 2 +- .../commands/hmi/vr_get_capabilities_request.cc | 2 +- .../src/commands/hmi/vr_get_language_request.cc | 2 +- .../hmi/vr_get_supported_languages_request.cc | 2 +- .../src/commands/hmi/vr_is_ready_request.cc | 5 +- .../src/commands/mobile/add_command_request.cc | 54 +- .../src/commands/mobile/add_sub_menu_request.cc | 10 +- .../src/commands/mobile/alert_maneuver_request.cc | 20 +- .../src/commands/mobile/alert_request.cc | 28 +- .../commands/mobile/cancel_interaction_request.cc | 10 +- .../commands/mobile/change_registration_request.cc | 100 ++- .../commands/mobile/close_application_request.cc | 10 +- .../create_interaction_choice_set_request.cc | 24 +- .../src/commands/mobile/create_window_request.cc | 12 +- .../src/commands/mobile/delete_command_request.cc | 31 +- .../src/commands/mobile/delete_file_request.cc | 10 +- .../delete_interaction_choice_set_request.cc | 15 +- .../src/commands/mobile/delete_sub_menu_request.cc | 10 +- .../src/commands/mobile/delete_window_request.cc | 12 +- .../src/commands/mobile/dial_number_request.cc | 12 +- .../commands/mobile/end_audio_pass_thru_request.cc | 10 +- .../mobile/get_cloud_app_properties_request.cc | 10 +- .../src/commands/mobile/get_file_request.cc | 10 +- .../mobile/get_system_capability_request.cc | 10 +- .../src/commands/mobile/get_way_points_request.cc | 11 +- .../src/commands/mobile/list_files_request.cc | 10 +- .../mobile/perform_audio_pass_thru_request.cc | 18 +- .../commands/mobile/perform_interaction_request.cc | 38 +- .../src/commands/mobile/put_file_request.cc | 10 +- .../mobile/register_app_interface_request.cc | 10 +- .../mobile/reset_global_properties_request.cc | 17 +- .../commands/mobile/scrollable_message_request.cc | 10 +- .../commands/mobile/send_haptic_data_request.cc | 10 +- .../src/commands/mobile/send_location_request.cc | 10 +- .../src/commands/mobile/set_app_icon_request.cc | 10 +- .../mobile/set_cloud_app_properties_request.cc | 10 +- .../commands/mobile/set_display_layout_request.cc | 10 +- .../mobile/set_global_properties_request.cc | 23 +- .../mobile/set_media_clock_timer_request.cc | 10 +- .../src/commands/mobile/show_app_menu_request.cc | 10 +- .../commands/mobile/show_constant_tbt_request.cc | 10 +- .../src/commands/mobile/show_request.cc | 10 +- .../src/commands/mobile/slider_request.cc | 10 +- .../src/commands/mobile/speak_request.cc | 11 +- .../commands/mobile/subscribe_button_request.cc | 10 +- .../mobile/subscribe_way_points_request.cc | 12 +- .../src/commands/mobile/subtle_alert_request.cc | 10 +- .../src/commands/mobile/system_request.cc | 10 +- .../commands/mobile/unsubscribe_button_request.cc | 10 +- .../mobile/unsubscribe_way_points_request.cc | 12 +- .../commands/mobile/update_turn_list_request.cc | 10 +- .../src/waypoints_pending_resumption_handler.cc | 2 +- .../test/commands/hmi/activate_app_request_test.cc | 2 + ...c_communication_get_system_time_request_test.cc | 2 +- .../hmi/button_get_capabilities_request_test.cc | 8 +- .../commands/hmi/get_system_info_request_test.cc | 2 + .../hmi/mixing_audio_supported_request_test.cc | 2 + .../hmi/navi_set_video_config_request_test.cc | 2 +- .../hmi/rc_get_capabilities_request_test.cc | 5 +- .../test/commands/hmi/rc_is_ready_request_test.cc | 2 +- .../commands/hmi/sdl_activate_app_request_test.cc | 6 +- .../commands/hmi/simple_requests_to_hmi_test.cc | 9 + .../commands/hmi/subscribe_button_request_test.cc | 2 +- .../hmi/tts_get_capabilities_request_test.cc | 4 +- .../commands/hmi/tts_get_language_request_test.cc | 4 +- .../tts_get_supported_languages_request_test.cc | 4 +- .../test/commands/hmi/tts_is_ready_request_test.cc | 2 +- .../hmi/ui_get_capabilities_request_test.cc | 4 +- .../commands/hmi/ui_get_language_request_test.cc | 4 +- .../hmi/ui_get_supported_languages_request_test.cc | 4 +- .../test/commands/hmi/ui_is_ready_request_test.cc | 2 +- .../hmi/unsubscribe_button_request_test.cc | 2 +- .../hmi/update_device_list_request_test.cc | 7 + .../test/commands/hmi/update_sdl_request_test.cc | 2 + .../hmi/vr_get_capabilities_request_test.cc | 4 +- .../commands/hmi/vr_get_language_request_test.cc | 4 +- .../hmi/vr_get_supported_languages_request_test.cc | 5 +- .../test/commands/hmi/vr_is_ready_request_test.cc | 2 +- .../commands/mobile/add_command_request_test.cc | 59 +- .../test/commands/mobile/alert_request_test.cc | 9 +- .../mobile/create_interaction_choice_set_test.cc | 23 +- .../mobile/perform_audio_pass_thru_test.cc | 18 +- .../commands/mobile/perform_interaction_test.cc | 87 +- .../mobile/reset_global_properties_test.cc | 6 +- .../test/commands/mobile/slider_test.cc | 7 +- .../commands/hmi/vi_get_vehicle_type_request.h | 2 +- .../commands/hmi/vi_is_ready_request.h | 5 +- .../hmi/vi_subscribe_vehicle_data_request.h | 2 +- .../commands/mobile/diagnostic_message_request.h | 5 +- .../commands/mobile/get_dtcs_request.h | 6 +- .../commands/mobile/get_vehicle_data_request.h | 6 +- .../commands/mobile/read_did_request.h | 6 +- .../mobile/subscribe_vehicle_data_request.h | 3 +- .../mobile/unsubscribe_vehicle_data_request.h | 3 +- .../vehicle_info_pending_resumption_handler.h | 2 +- .../commands/hmi/vi_get_vehicle_type_request.cc | 2 +- .../src/commands/hmi/vi_is_ready_request.cc | 5 +- .../hmi/vi_subscribe_vehicle_data_request.cc | 2 +- .../commands/mobile/diagnostic_message_request.cc | 10 +- .../src/commands/mobile/get_dtcs_request.cc | 10 +- .../commands/mobile/get_vehicle_data_request.cc | 10 +- .../src/commands/mobile/read_did_request.cc | 10 +- .../mobile/subscribe_vehicle_data_request.cc | 12 +- .../mobile/unsubscribe_vehicle_data_request.cc | 12 +- .../src/vehicle_info_pending_resumption_handler.cc | 2 +- .../hmi/vi_get_vehicle_type_request_test.cc | 2 +- .../test/commands/hmi/vi_is_ready_request_test.cc | 2 +- .../test/vehicle_info_pending_resumption_test.cc | 16 +- .../src/application_manager_impl.cc | 18 +- .../src/commands/command_impl.cc | 12 +- .../src/commands/command_request_impl.cc | 859 ++----------------- .../src/commands/request_from_hmi.cc | 13 +- .../src/commands/request_from_mobile_impl.cc | 906 +++++++++++++++++++++ .../src/commands/request_to_hmi.cc | 10 +- .../src/event_engine/event_dispatcher_impl.cc | 21 +- .../src/event_engine/event_observer.cc | 10 +- .../src/hmi_language_handler.cc | 3 +- .../src/policies/policy_event_observer.cc | 5 +- .../src/request_controller_impl.cc | 145 +++- .../application_manager/src/request_info.cc | 17 + .../src/request_timeout_handler_impl.cc | 3 +- .../resumption/resumption_data_processor_impl.cc | 3 +- .../src/state_controller_impl.cc | 12 +- .../src/system_time/system_time_handler_impl.cc | 2 +- .../test/commands/command_impl_test.cc | 2 +- .../commands/command_mobile_request_impl_test.cc | 699 ++++++++++++++++ .../test/commands/command_request_impl_test.cc | 710 ---------------- .../application_manager/test/event_engine_test.cc | 2 +- .../test/hmi_language_handler_test.cc | 26 +- .../application_manager/commands/commands_test.h | 20 + .../application_manager/mock_event_dispatcher.h | 4 + .../application_manager/mock_event_observer.h | 4 +- .../include/application_manager/mock_request.h | 3 +- .../test/mobile_event_engine_test.cc | 2 +- .../test/policy_event_observer_test.cc | 2 +- .../test/policy_handler_test.cc | 4 +- .../request_controller/request_controller_test.cc | 9 +- .../test/request_timeout_handler_test.cc | 8 +- .../test/rpc_service_impl_test.cc | 6 +- .../test/state_controller/state_controller_test.cc | 95 +-- .../application_manager/application_manager.h | 30 + .../application_manager/request_controller.h | 30 + .../application_manager/mock_application_manager.h | 9 + .../application_manager/mock_request_controller.h | 9 + 291 files changed, 3644 insertions(+), 2873 deletions(-) create mode 100644 src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h create mode 100644 src/components/application_manager/src/commands/request_from_mobile_impl.cc create mode 100644 src/components/application_manager/test/commands/command_mobile_request_impl_test.cc delete mode 100644 src/components/application_manager/test/commands/command_request_impl_test.cc 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 c64ae2bbd2..f75a5220c6 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 @@ -686,6 +686,15 @@ class ApplicationManagerImpl const uint32_t corr_id, const int32_t function_id) OVERRIDE; + bool RetainRequestInstance(const uint32_t connection_key, + const uint32_t correlation_id) OVERRIDE; + + bool RemoveRetainedRequest(const uint32_t connection_key, + const uint32_t correlation_id) OVERRIDE; + + bool IsStillWaitingForResponse(const uint32_t connection_key, + const uint32_t correlation_id) const OVERRIDE; + void OnQueryAppsRequest( const connection_handler::DeviceHandle device) OVERRIDE; diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h index a7241ce16d..f8bc66df2a 100644 --- a/src/components/application_manager/include/application_manager/commands/command.h +++ b/src/components/application_manager/include/application_manager/commands/command.h @@ -115,7 +115,14 @@ class Command { * has exceed it's limit * */ - virtual void onTimeOut() = 0; + virtual void HandleTimeOut() = 0; + + /** + * @brief Function is called by RequestInfo when request controller + * updates request timeout + * Function sets request state to "AwaitingResponse" + */ + virtual void OnUpdateTimeOut() = 0; /** * @brief AllowedToTerminate tells if request controller is allowed diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 6105f7c5d6..534f07aa37 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -164,7 +164,7 @@ class CommandImpl : public Command { * has exceed it's limit * */ - void onTimeOut() OVERRIDE; + void HandleTimeOut() OVERRIDE; /** * @brief AllowedToTerminate tells request Controller if it can terminate this @@ -182,6 +182,8 @@ class CommandImpl : public Command { */ void SetAllowedToTerminate(const bool allowed) OVERRIDE; + void OnUpdateTimeOut() OVERRIDE; + /** * @brief Calculates command`s internal consecutive number * for specified application used during resumption. diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index e2c95a085b..97e2dce0eb 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -1,4 +1,4 @@ -/* +/* Copyright (c) 2016, Ford Motor Company All rights reserved. @@ -33,178 +33,104 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_ +#include + +#include "application_manager/application_manager.h" #include "application_manager/commands/command_impl.h" +#include "application_manager/event_engine/event_observer.h" +#include "application_manager/hmi_interfaces.h" +#include "application_manager/smart_object_keys.h" #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" #include "smart_objects/smart_object.h" #include "utils/lock.h" namespace application_manager { -namespace commands { - -struct ResponseInfo { - ResponseInfo(); - ResponseInfo(const hmi_apis::Common_Result::eType result, - const HmiInterfaces::InterfaceID hmi_interface, - ApplicationManager& application_manager); - hmi_apis::Common_Result::eType result_code; - HmiInterfaces::InterfaceID interface; - HmiInterfaces::InterfaceState interface_state; - bool is_ok; - bool is_unsupported_resource; - bool is_not_used; -}; - -namespace ns_smart = ns_smart_device_link::ns_smart_objects; - -/** - * @brief MergeInfos merge 2 infos in one string - * @param first - info string that should be first in result info - * @param second - info string that should be second in result info - * @return if first is empty return second - * if second is empty return first - * if both are empty return empty string - * if both are not empty return empty first +", " + second - */ -std::string MergeInfos(const std::string& first, const std::string& second); - -/** - * @brief MergeInfos merge 2 infos into one string with info - * @param first_info -contains result_code from HMI response and - * interface that returns response - * @param first_str - info string that should be first in result info - * @param second_info -contains result_code from HMI response and - * interface that returns response - * @param second_str - info string that should be second in result info - * @return if first_info is not available and second_str not empty return second - * if second_info is not available and first_str not empty return first - * other cases return result MergeInfos for 2 params - */ -std::string MergeInfos(const ResponseInfo& first_info, - const std::string& first_str, - const ResponseInfo& second_info, - const std::string& second_str); +namespace commands { /** - * @brief MergeInfos merge 3 infos in one string - * @param first - info string that should be first in result info - * @param second - info string that should be second in result info - * @param third - info string that should be second in result info - * @return resulting string contain merge all incoming parameters - */ -std::string MergeInfos(const std::string& first, - const std::string& second, - const std::string& third); - + * @brief Class is intended to encapsulate RPC as an object + **/ class CommandRequestImpl : public CommandImpl, public event_engine::EventObserver { public: - enum RequestState { kAwaitingHMIResponse = 0, kTimedOut, kCompleted }; + enum RequestState { + kAwaitingResponse = 0, + kTimedOut, + kProcessEvent, + }; /** - * @brief The HashUpdateMode enum defines whether request has to update - * hash after its execution is finished - */ - enum HashUpdateMode { kSkipHashUpdate, kDoHashUpdate }; - + * @brief CommandRequestImpl class constructor + * + * @param message Incoming SmartObject message + **/ CommandRequestImpl(const MessageSharedPtr& message, ApplicationManager& application_manager, rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler); - ~CommandRequestImpl(); - - /** - * @brief Checks command permissions according to policy table - */ - bool CheckPermissions() OVERRIDE; - /** - * @brief Init sets hash update mode for request - */ - bool Init() OVERRIDE; + * @brief CommandRequestImpl class destructor + * + **/ + virtual ~CommandRequestImpl(); /** - * @brief Cleanup all resources used by command + * @brief Send request to mobile + * @param function_id Function id + * @param msg Request to mobile + * @param use_event - true if request should be subscribed to an event, + * otherwise false **/ - bool CleanUp() OVERRIDE; + void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id, + smart_objects::SmartObjectSPtr msg, + bool use_events); /** * @brief Execute corresponding command by calling the action on reciever **/ void Run() OVERRIDE; + virtual void on_event(const event_engine::MobileEvent& event); + /* * @brief Function is called by RequestController when request execution time * has exceed it's limit * */ - virtual void onTimeOut(); + void HandleTimeOut() FINAL; /** * @brief Default EvenObserver's pure virtual method implementation * * @param event The received event */ - virtual void on_event(const event_engine::Event& event); - - virtual void on_event(const event_engine::MobileEvent& event); + void HandleOnEvent(const event_engine::Event& event) FINAL; - /* - * @brief Creates Mobile response + /** + * @brief Default EvenObserver's pure virtual method implementation * - * @param success true if successful; false, if failed - * @param result_code Result code (SUCCESS, INVALID_DATA, e.t.c) - * @param info Provides additional human readable info regarding the result - * @param response_params Additional params in response + * @param event The received event */ - void SendResponse( - const bool success, - const mobile_apis::Result::eType& result_code, - const char* info = NULL, - const smart_objects::SmartObject* response_params = NULL, - const std::vector binary_data = std::vector()); - - void SendProviderRequest( - const mobile_apis::FunctionID::eType& mobile_function_id, - const hmi_apis::FunctionID::eType& hmi_function_id, - const smart_objects::SmartObject* msg, - bool use_events = false); + void HandleOnEvent(const event_engine::MobileEvent& event) FINAL; - void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id, - smart_objects::SmartObjectSPtr msg, - bool use_events = false); - - /* - * @brief Sends HMI request - * - * @param function_id HMI request ID - * @param msg_params HMI request msg params - * @param use_events true if we need subscribe on event(HMI request) - * @return hmi correlation id + /** + * @brief Function is called by RequestController when request execution time + * has exceeded its limit + * @note default value is required as a lot of requests don't use it + * as they use automatically generated reason */ - uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id, - const smart_objects::SmartObject* msg_params = NULL, - bool use_events = false); + virtual void OnTimeOut(); - /* - * @brief Creates HMI request - * - * @param function_id HMI request ID - * @param msg_params HMI request msg params - */ - void CreateHMINotification(const hmi_apis::FunctionID::eType& function_id, - const ns_smart::SmartObject& msg_params) const; + virtual void on_event(const event_engine::Event&); - /** - * @brief Converts HMI result code to Mobile result code - * - * @param hmi_code HMI result code - * @return Mobile result code - */ - mobile_apis::Result::eType GetMobileResultCode( - const hmi_apis::Common_Result::eType& hmi_code) const; + void OnUpdateTimeOut() OVERRIDE; + + bool IncrementReferenceCount() const OVERRIDE; + + bool DecrementReferenceCount() const OVERRIDE; protected: /** @@ -217,146 +143,50 @@ class CommandRequestImpl : public CommandImpl, bool CheckAllowedParameters(const Command::CommandSource source); /** - * @brief Checks HMI capabilities for specified button support - * @param button Button to check - * @return true if button is present in HMI capabilities - * otherwise returns false - */ - bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const; - - /** - * @brief Checks if any request param was marked as disallowed by policy - * @return true if any param was marked as disallowed - */ - bool HasDisallowedParams() const; - - /** - * @brief Checks result code from HMI for single RPC - * and returns parameter for sending to mobile app. - * @param result_code contains result code from HMI response - * @param interface contains interface for which HMI sent response - * @return true if result code complies successful result cods - * otherwise returns false. - */ - bool PrepareResultForMobileResponse( - hmi_apis::Common_Result::eType result_code, - HmiInterfaces::InterfaceID interface) const; - - /** - * @brief Checks result code from HMI for splitted RPC - * and returns parameter for sending to mobile app. - * @param first contains result_code from HMI response and - * interface that returns response - * @param second contains result_code from HMI response and - * interface that returns response - * @return true if result code complies successful result code - * otherwise returns false + * @brief Adds interface to be awaited by SDL request + * @param interface_id interface from which SDL expects response in given time */ - bool PrepareResultForMobileResponse(ResponseInfo& out_first, - ResponseInfo& out_second) const; + void StartAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id); /** - * @brief Checks result code from HMI for splitted RPC - * and returns parameter for sending to mobile app. - * @param out_first Contains result_code from HMI response and - * interface that returns response - * @param out_second Contains result_code from HMI response and - * interface that returns response - * @param out_third Contains result_code from HMI response and - * interface that returns response - * @return true if result code complies successful result code - * otherwise returns false - */ - bool PrepareResultForMobileResponse(ResponseInfo& out_first, - ResponseInfo& out_second, - ResponseInfo& out_third) const; - - /** - * @brief If message from HMI contains returns this info - * or process result code from HMI and checks state of interface - * and create info. - * @param interface contains interface for which HMI sent response - * @param result_code contains result code from HMI - * @param response_from_hmi contains response from HMI - * @param out_info contain info for sending to application - */ - void GetInfo(const smart_objects::SmartObject& response_from_hmi, - std::string& out_info); - - /** - * @brief Prepare result code for sending to mobile application - * @param first contains result_code from HMI response and - * interface that returns response - * @param second contains result_code from HMI response and - * interface that returns response. - * @return resulting code for sending to mobile application. - */ - mobile_apis::Result::eType PrepareResultCodeForResponse( - const ResponseInfo& first, const ResponseInfo& second); - - /** - * @brief Prepare result code for sending to mobile application - * @param first contains result_code from HMI response and - * interface that returns response - * @param second contains result_code from HMI response and - * interface that returns response. - * @return resulting code for sending to mobile application. + * @brief Gets interface awaiting state. + * @param interface_id interface which SDL awaits for response in given time + * @return true if SDL awaits for response from given interface in + * interface_id */ - mobile_apis::Result::eType PrepareResultCodeForResponse( - const ResponseInfo& first, - const ResponseInfo& second, - const ResponseInfo& third); + bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const; /** - * @brief Resolves if the return code must be - * UNSUPPORTED_RESOURCE - * @param first contains result_code from HMI response and - * interface that returns response - * @param second contains result_code from HMI response and - * interface that returns response. - * @return True, if the communication return code must be - * UNSUPPORTED_RESOURCE, otherwise false. + * @brief Stops SDL awaiting from given HMI interface + * @param interface_id interface from which SDL no longer awaits + * for response in given time */ - bool IsResultCodeUnsupported(const ResponseInfo& first, - const ResponseInfo& second) const; + void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id); /** - * @brief CheckResult checks whether the overall result - * of the responses is successful - * @param first response - * @param second response - * @return true if the overall result is successful - * otherwise - false + * @brief Checks if there some not delivered hmi responses exist + * @return true if pending responses exist, otherwise - false */ - bool CheckResult(const ResponseInfo& first, const ResponseInfo& second) const; + bool IsPendingResponseExist() const; - protected: /** - * @brief Returns policy parameters permissions - * @return Parameters permissions struct reference + * @brief Checks if there some not delivered hmi responses exist + * @return true if pending responses exist, otherwise - false */ - const CommandParametersPermissions& parameters_permissions() const; - - /** - * @brief Adds interface to be awaited for by sdl request command - @param interface_id interface which SDL expects to response in given time - */ - void StartAwaitForInterface(const HmiInterfaces::InterfaceID interface_id); /** - * @brief Gets interface await state. - * @param interface_id interface which SDL awaits for response in given time - * @return true if SDL awaits for response from given interface in - * interface_id + * @brief Returns current state of request + * @return current request state. E.g. kAwaitingResponse, kTimedOut, + * kResponded */ - bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const; + virtual RequestState current_state() const; /** - * @brief Sets given HMI interface await status to false - * @param interface_id interface which SDL no longer awaits for response in - * given time + * @brief Sets current state of request + * @param request state to set. E.g. kAwaitingResponse, kTimedOut, + * kResponded */ - void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id); + virtual void set_current_state(const RequestState state); /** * @brief This set stores all the interfaces which are awaited by SDL to @@ -366,52 +196,33 @@ class CommandRequestImpl : public CommandImpl, mutable sync_primitives::Lock awaiting_response_interfaces_lock_; - RequestState current_state_; - sync_primitives::Lock state_lock_; + /** + * @brief This lock is used to guarantee thread safe access to request state + */ + mutable sync_primitives::RecursiveLock state_lock_; /** - * @brief hash_update_mode_ Defines whether request must update hash value of - * application or not + * @brief Current state of request to synchronize its life cycle */ - HashUpdateMode hash_update_mode_; + RequestState current_state_; private: DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl); - bool ProcessHMIInterfacesAvailability( - const uint32_t hmi_correlation_id, - const hmi_apis::FunctionID::eType& function_id); - /** - * @brief UpdateHash updates hash field for application and sends - * OnHashChanged notification to mobile side in case of approriate hash mode - * is set + * @brief Changes request state to "kProcessEvent", retain request instance + * @return false if request is not ready to handle event right now. + * If request is succesfully retained returns true */ - void UpdateHash(); + bool StartOnEventHandling(); /** - * @brief is_success_result_ Defines whether request succeded, at the moment - * it is value of 'success' field of appropriate response sent to mobile + * @brief Changes request state to "kAwaitingResponse", removes request + * instance retained before */ - bool is_success_result_; - - /** - * @brief Add information for the component of response in case of timeout - * @param response Response message, which info should be extended - */ - void AddTimeOutComponentInfoToMessage( - smart_objects::SmartObject& response) const; - /** - * @brief AddRequestToTimeoutHandler checks the request and adds it to - * request_timeout_handler map for tracking - * @param request_to_hmi request to HMI - */ - void AddRequestToTimeoutHandler( - const smart_objects::SmartObject& request_to_hmi) const; + void FinalizeOnEventHandling(); }; } // namespace commands - } // namespace application_manager - #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_REQUEST_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h index 0e03b31e74..c4fd25f5e0 100644 --- a/src/components/application_manager/include/application_manager/commands/request_from_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/request_from_hmi.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_HMI_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_HMI_H_ -#include "application_manager/commands/command_impl.h" +#include "application_manager/commands/command_request_impl.h" #include "interfaces/HMI_API.h" #include "smart_objects/smart_object.h" @@ -43,7 +43,7 @@ namespace commands { namespace ns_smart = ns_smart_device_link::ns_smart_objects; -class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { +class RequestFromHMI : public CommandRequestImpl { public: RequestFromHMI(const MessageSharedPtr& message, ApplicationManager& application_manager, @@ -54,8 +54,11 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { virtual bool Init(); virtual bool CleanUp(); virtual void Run(); - virtual void on_event(const event_engine::Event& event); + + void on_event(const event_engine::Event& event); void on_event(const event_engine::MobileEvent& event) OVERRIDE; + void OnTimeOut() OVERRIDE; + /** * @brief SendResponse allows to send response to hmi * @param correlation_id the correlation id for the rfesponse. @@ -91,7 +94,7 @@ class RequestFromHMI : public CommandImpl, public event_engine::EventObserver { const mobile_apis::FunctionID::eType& mobile_function_id, const hmi_apis::FunctionID::eType& hmi_function_id, const smart_objects::SmartObject* msg, - bool use_events = false); + bool use_events); void SendMobileRequest(const mobile_apis::FunctionID::eType& function_id, const ApplicationSharedPtr app, diff --git a/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h b/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h new file mode 100644 index 0000000000..e4f0bed223 --- /dev/null +++ b/src/components/application_manager/include/application_manager/commands/request_from_mobile_impl.h @@ -0,0 +1,372 @@ +/* + Copyright (c) 2020, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_MOBILE_IMPL_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_MOBILE_IMPL_H_ + +#include "application_manager/commands/command_request_impl.h" +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" +#include "utils/lock.h" + +namespace application_manager { +namespace commands { + +struct ResponseInfo { + ResponseInfo(); + ResponseInfo(const hmi_apis::Common_Result::eType result, + const HmiInterfaces::InterfaceID hmi_interface, + ApplicationManager& application_manager); + hmi_apis::Common_Result::eType result_code; + HmiInterfaces::InterfaceID interface; + HmiInterfaces::InterfaceState interface_state; + bool is_ok; + bool is_unsupported_resource; + bool is_not_used; +}; + +/** + * @brief MergeInfos merge 2 infos in one string + * @param first - info string that should be first in result info + * @param second - info string that should be second in result info + * @return if first is empty return second + * if second is empty return first + * if both are empty return empty string + * if both are not empty return empty first +", " + second + */ +std::string MergeInfos(const std::string& first, const std::string& second); + +/** + * @brief MergeInfos merge 2 infos into one string with info + * @param first_info -contains result_code from HMI response and + * interface that returns response + * @param first_str - info string that should be first in result info + * @param second_info -contains result_code from HMI response and + * interface that returns response + * @param second_str - info string that should be second in result info + * @return if first_info is not available and second_str not empty return second + * if second_info is not available and first_str not empty return first + * other cases return result MergeInfos for 2 params + */ +std::string MergeInfos(const ResponseInfo& first_info, + const std::string& first_str, + const ResponseInfo& second_info, + const std::string& second_str); + +/** + * @brief MergeInfos merge 3 infos in one string + * @param first - info string that should be first in result info + * @param second - info string that should be second in result info + * @param third - info string that should be second in result info + * @return resulting string contain merge all incoming parameters + */ +std::string MergeInfos(const std::string& first, + const std::string& second, + const std::string& third); + +class RequestFromMobileImpl : public CommandRequestImpl { + public: + /** + * @brief The HashUpdateMode enum defines whether request has to update + * hash after its execution is finished + */ + enum HashUpdateMode { kSkipHashUpdate, kDoHashUpdate }; + + RequestFromMobileImpl(const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler); + + /** + * @brief RequestFromMobileImpl class destructor + * + **/ + virtual ~RequestFromMobileImpl(); + + /** + * @brief Checks command permissions according to policy table + */ + bool CheckPermissions() OVERRIDE; + + /** + * @brief Init sets hash update mode for request + */ + bool Init() OVERRIDE; + + /** + * @brief Cleanup all resources used by command + **/ + bool CleanUp() OVERRIDE; + + /** + * @brief Execute corresponding command by calling the action on reciever + **/ + void Run() OVERRIDE; + + void on_event(const event_engine::Event& event) OVERRIDE; + void on_event(const event_engine::MobileEvent& event) OVERRIDE; + + void OnTimeOut() OVERRIDE; + + void SendProviderRequest( + const mobile_apis::FunctionID::eType& mobile_function_id, + const hmi_apis::FunctionID::eType& hmi_function_id, + const smart_objects::SmartObject* msg, + bool use_events); + + /* + * @brief Creates Mobile response + * + * @param success true if successful; false, if failed + * @param result_code Result code (SUCCESS, INVALID_DATA, e.t.c) + * @param info Provides additional human readable info regarding the result + * @param response_params Additional params in response + */ + void SendResponse( + const bool success, + const mobile_apis::Result::eType& result_code, + const char* info = NULL, + const smart_objects::SmartObject* response_params = NULL, + const std::vector binary_data = std::vector()); + /* + * @brief Sends HMI request + * + * @param function_id HMI request ID + * @param msg_params HMI request msg params + * @param use_events true if we need subscribe on event(HMI request) + * @return hmi correlation id + */ + uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id, + const smart_objects::SmartObject* msg_params = NULL, + bool use_events = false); + + /* + * @brief Creates HMI request + * + * @param function_id HMI request ID + * @param msg_params HMI request msg params + */ + void CreateHMINotification( + const hmi_apis::FunctionID::eType& function_id, + const ns_smart_device_link::ns_smart_objects::SmartObject& msg_params) + const; + + /** + * @brief Converts HMI result code to Mobile result code + * + * @param hmi_code HMI result code + * @return Mobile result code + */ + mobile_apis::Result::eType GetMobileResultCode( + const hmi_apis::Common_Result::eType& hmi_code) const; + + protected: + /** + * @brief Checks HMI capabilities for specified button support + * @param button Button to check + * @return true if button is present in HMI capabilities + * otherwise returns false + */ + bool CheckHMICapabilities(const mobile_apis::ButtonName::eType button) const; + + /** + * @brief Remove from current message parameters disallowed by policy table + */ + void RemoveDisallowedParameters(); + + /** + * @brief Checks if any request param was marked as disallowed by policy + * @return true if any param was marked as disallowed + */ + bool HasDisallowedParams() const; + + /** + * @brief Checks result code from HMI for single RPC + * and returns parameter for sending to mobile app. + * @param result_code contains result code from HMI response + * @param interface contains interface for which HMI sent response + * @return true if result code complies successful result code + * otherwise returns false. + */ + bool PrepareResultForMobileResponse( + hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const; + + /** + * @brief Checks result code from HMI for splitted RPC + * and returns parameter for sending to mobile app. + * @param out_first contains result_code from HMI response and + * interface that returns response + * @param out_second contains result_code from HMI response and + * interface that returns response + * @return true if result code complies successful result code + * otherwise returns false + */ + bool PrepareResultForMobileResponse(ResponseInfo& out_first, + ResponseInfo& out_second) const; + + /** + * @brief Checks result code from HMI for splitted RPC + * and returns parameter for sending to mobile app. + * @param out_first Contains result_code from HMI response and + * interface that returns response + * @param out_second Contains result_code from HMI response and + * interface that returns response + * @param out_third Contains result_code from HMI response and + * interface that returns response + * @return true if result code complies successful result code + * otherwise returns false + */ + bool PrepareResultForMobileResponse(ResponseInfo& out_first, + ResponseInfo& out_second, + ResponseInfo& out_third) const; + + /** + * @brief If message from HMI contains returns this info + * or process result code from HMI and checks state of interface + * and create info. + * @param response_from_hmi contains response from HMI + * @param out_info contain info for sending to application + */ + void GetInfo(const smart_objects::SmartObject& response_from_hmi, + std::string& out_info) const; + + /** + * @brief Prepare result code for sending to mobile application + * @param first contains result_code from HMI response and + * interface that returns response + * @param second contains result_code from HMI response and + * interface that returns response. + * @return resulting code for sending to mobile application. + */ + mobile_apis::Result::eType PrepareResultCodeForResponse( + const ResponseInfo& first, const ResponseInfo& second); + + /** + * @brief Prepare result code for sending to mobile application + * @param first contains result_code from HMI response and + * interface that returns response + * @param second contains result_code from HMI response and + * interface that returns response. + * @return resulting code for sending to mobile application. + */ + mobile_apis::Result::eType PrepareResultCodeForResponse( + const ResponseInfo& first, + const ResponseInfo& second, + const ResponseInfo& third); + + /** + * @brief Resolves if the return code must be + * UNSUPPORTED_RESOURCE + * @param first contains result_code from HMI response and + * interface that returns response + * @param second contains result_code from HMI response and + * interface that returns response. + * @return True, if the communication return code must be + * UNSUPPORTED_RESOURCE, otherwise false. + */ + bool IsResultCodeUnsupported(const ResponseInfo& first, + const ResponseInfo& second) const; + + /** + * @brief Checks result code from HMI for splitted RPC + * and returns parameter for sending to mobile app. + * @param first contains result_code from HMI response and + * interface that returns response + * @param second contains result_code from HMI response and + * interface that returns response + * @return true if result code complies successful result code + * otherwise returns false + */ + bool CheckResultCode(const ResponseInfo& first, + const ResponseInfo& second) const; + + /** + * @brief Returns policy parameters permissions + * @return Parameters permissions struct reference + */ + const CommandParametersPermissions& parameters_permissions() const; + + /** + * @brief hash_update_mode_ Defines whether request must update hash value of + * application or not + */ + HashUpdateMode hash_update_mode_; + + private: + DISALLOW_COPY_AND_ASSIGN(RequestFromMobileImpl); + + /** + * @brief Checks if HMI interface is available for the target function + * @param hmi_correlation_id HMI correlation id + * @param function_id Response message, which info should be extended + */ + bool ProcessHMIInterfacesAvailability( + const uint32_t hmi_correlation_id, + const hmi_apis::FunctionID::eType& function_id); + + /** + * @brief UpdateHash updates hash field for application and sends + * OnHashChanged notification to mobile side in case of approriate hash mode + * is set + */ + void UpdateHash(); + + /** + * @brief Add information for the component of response in case of timeout + * @param response Response message, which info should be extended + */ + void AddTimeOutComponentInfoToMessage( + smart_objects::SmartObject& response) const; + + /** + * @brief AddRequestToTimeoutHandler checks the request and adds it to + * request_timeout_handler map for tracking + * @param request_to_hmi request to HMI + */ + void AddRequestToTimeoutHandler( + const smart_objects::SmartObject& request_to_hmi) const; + + /** + * @brief is_success_result_ Defines whether request succeded, at the moment + * it is value of 'success' field of appropriate response sent to mobile + */ + bool is_success_result_; +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_REQUEST_FROM_MOBILE_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/commands/request_to_hmi.h b/src/components/application_manager/include/application_manager/commands/request_to_hmi.h index 3057476937..78c8281a03 100644 --- a/src/components/application_manager/include/application_manager/commands/request_to_hmi.h +++ b/src/components/application_manager/include/application_manager/commands/request_to_hmi.h @@ -35,6 +35,7 @@ #include "application_manager/application_manager.h" #include "application_manager/commands/command_impl.h" +#include "application_manager/commands/command_request_impl.h" namespace application_manager { @@ -61,7 +62,7 @@ bool ChangeInterfaceState(ApplicationManager& application_manager, const smart_objects::SmartObject& response_from_hmi, HmiInterfaces::InterfaceID interface); -class RequestToHMI : public CommandImpl { +class RequestToHMI : public CommandRequestImpl { public: RequestToHMI(const MessageSharedPtr& message, ApplicationManager& application_manager, diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h index 0656372f47..b232875f43 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h +++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h @@ -61,6 +61,15 @@ class EventDispatcher { int32_t hmi_correlation_id, EventObserver& observer) = 0; + /* + * @brief Unsubscribes the observer from specific event + * + * @param event_id The event ID to subscribe for + * @param hmi_correlation_id The event HMI correlation ID + */ + virtual void remove_observer(const Event::EventID& event_id, + const int32_t hmi_correlation_id) = 0; + /* * @brief Unsubscribes the observer from specific event * diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h index 3644299499..ffe659a07c 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h +++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h @@ -83,6 +83,9 @@ class EventDispatcherImpl : public EventDispatcher { */ void raise_event(const Event& event) OVERRIDE; + void remove_observer(const Event::EventID& event_id, + const int32_t hmi_correlation_id) OVERRIDE; + /* * @brief Subscribe the observer to event * diff --git a/src/components/application_manager/include/application_manager/event_engine/event_observer.h b/src/components/application_manager/include/application_manager/event_engine/event_observer.h index 1f4eccaf46..0ebf90133e 100644 --- a/src/components/application_manager/include/application_manager/event_engine/event_observer.h +++ b/src/components/application_manager/include/application_manager/event_engine/event_observer.h @@ -70,9 +70,23 @@ class EventObserver { * * @param event The received event */ - virtual void on_event(const Event& event) = 0; + virtual void HandleOnEvent(const Event& event) = 0; - virtual void on_event(const MobileEvent& event); + virtual void HandleOnEvent(const MobileEvent& event); + + /** + * @brief Increments reference count to avoid observer destruction while + * event dispatcher keeping pointer to that observer + * @return true if request reference was incremented, otherwise returns false + */ + virtual bool IncrementReferenceCount() const; + + /** + * @brief Decrements reference count to allow observer be safely destroyed + * as event dispatcher does not keep any pointers to it + * @return true if request reference was decremented, otherwise returns false + */ + virtual bool DecrementReferenceCount() const; protected: /* diff --git a/src/components/application_manager/include/application_manager/hmi_language_handler.h b/src/components/application_manager/include/application_manager/hmi_language_handler.h index 5db5a844da..10ae1f8967 100644 --- a/src/components/application_manager/include/application_manager/hmi_language_handler.h +++ b/src/components/application_manager/include/application_manager/hmi_language_handler.h @@ -78,7 +78,7 @@ class HMILanguageHandler : public event_engine::EventObserver { */ hmi_apis::Common_Language::eType get_language_for(Interface interface) const; - void on_event(const event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const event_engine::Event& event) OVERRIDE; /** * @brief Trigger waiting for response diff --git a/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h index 7d71611a3c..93b35ff99d 100644 --- a/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h +++ b/src/components/application_manager/include/application_manager/policies/external/policy_event_observer.h @@ -47,8 +47,10 @@ class PolicyEventObserver policy::PolicyHandlerInterface* const policy_handler, application_manager::event_engine::EventDispatcher& event_dispatcher); void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler); - void on_event(const application_manager::event_engine::Event& event); - void on_event(const application_manager::event_engine::MobileEvent& event); + void HandleOnEvent( + const application_manager::event_engine::Event& event) OVERRIDE; + void HandleOnEvent( + const application_manager::event_engine::MobileEvent& event) OVERRIDE; void subscribe_on_event( const application_manager::event_engine::Event::EventID& event_id, int32_t hmi_correlation_id = 0); diff --git a/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h b/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h index 4a104812a4..479d433d50 100644 --- a/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h +++ b/src/components/application_manager/include/application_manager/policies/regular/policy_event_observer.h @@ -47,8 +47,10 @@ class PolicyEventObserver policy::PolicyHandlerInterface* const policy_handler, application_manager::event_engine::EventDispatcher& event_dispatcher); void set_policy_handler(policy::PolicyHandlerInterface* const policy_handler); - void on_event(const application_manager::event_engine::Event& event); - void on_event(const application_manager::event_engine::MobileEvent& event); + void HandleOnEvent( + const application_manager::event_engine::Event& event) OVERRIDE; + void HandleOnEvent( + const application_manager::event_engine::MobileEvent& event) OVERRIDE; void subscribe_on_event( const application_manager::event_engine::Event::EventID& event_id, int32_t hmi_correlation_id = 0); diff --git a/src/components/application_manager/include/application_manager/request_controller_impl.h b/src/components/application_manager/include/application_manager/request_controller_impl.h index 7277cdc3fa..41d2419ba6 100644 --- a/src/components/application_manager/include/application_manager/request_controller_impl.h +++ b/src/components/application_manager/include/application_manager/request_controller_impl.h @@ -40,6 +40,7 @@ #include "utils/lock.h" #include "utils/conditional_variable.h" +#include "utils/threads/async_runner.h" #include "utils/threads/thread.h" #include "utils/threads/thread_delegate.h" #include "utils/timer.h" @@ -47,6 +48,7 @@ #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" +#include "application_manager/event_engine/event_dispatcher_impl.h" #include "application_manager/request_controller.h" #include "application_manager/request_controller_settings.h" #include "application_manager/request_info.h" @@ -56,14 +58,15 @@ namespace application_manager { namespace request_controller { -class RequestControllerImpl : public RequestController { +class RequestControllerImpl : public RequestController, threads::AsyncRunner { public: /** * @brief Class constructor * */ RequestControllerImpl(const RequestControlerSettings& settings, - RequestTimeoutHandler& request_timeout_handler); + RequestTimeoutHandler& request_timeout_handler, + event_engine::EventDispatcher& event_disptacher); ~RequestControllerImpl(); @@ -81,6 +84,25 @@ class RequestControllerImpl : public RequestController { void AddNotification(const RequestPtr ptr) OVERRIDE; + bool RetainRequestInstance(const uint32_t connection_key, + const uint32_t correlation_id) OVERRIDE; + + bool RemoveRetainedRequest(const uint32_t connection_key, + const uint32_t correlation_id) OVERRIDE; + + bool IsStillWaitingForResponse(const uint32_t connection_key, + const uint32_t correlation_id) const OVERRIDE; + + /** + * @brief Removes request from queue + * + * @param correlation_id Active request correlation ID, + * @param connection_key Active request connection key (0 for HMI requersts) + * @param function_id Active request function id + * @param force_terminate if true, request controller will terminate + * even if not allowed by request + */ + void TerminateRequest(const uint32_t correlation_id, const uint32_t connection_key, const int32_t function_id, @@ -125,6 +147,15 @@ class RequestControllerImpl : public RequestController { void TerminateWaitingForExecutionAppRequests(const uint32_t app_id); void TerminateWaitingForResponseAppRequests(const uint32_t app_id); + /** + * @brief Starts a new async task for cleaning up the provided requests + * references + * and perform the rest of cleanup actions for each request + * @param requests list of requests to cleanup + */ + typedef std::list RequestInfoPtrs; + void scheduleRequestsCleanup(const RequestInfoPtrs& requests); + /** * @brief Checks whether all constraints are met before adding of request into * processing queue. Verifies amount of pending requests, amount of requests @@ -159,6 +190,19 @@ class RequestControllerImpl : public RequestController { volatile bool stop_flag_; }; + class RequestCleanerDelegate : public threads::ThreadDelegate { + public: + explicit RequestCleanerDelegate(const RequestInfoPtrs& requests); + ~RequestCleanerDelegate(); + void threadMain() OVERRIDE; + void exitThreadMain() OVERRIDE; + + private: + sync_primitives::Lock state_lock_; + sync_primitives::ConditionalVariable state_cond_; + RequestInfoPtrs requests_; + }; + std::vector pool_; volatile TPoolState pool_state_; uint32_t pool_size_; @@ -167,13 +211,19 @@ class RequestControllerImpl : public RequestController { std::list mobile_request_list_; sync_primitives::Lock mobile_request_list_lock_; - /* - * Requests, that are waiting for responses + /** + * @brief Requests, that are waiting for responses * RequestInfoSet provides correct processing of requests with thre same * app_id and corr_id */ RequestInfoSet waiting_for_response_; + /** + * @brief Requests, that are retained to be not destroyed right after + * sending response to mobile request + */ + HashSortedRequestInfoSet retained_mobile_requests_; + /** * @brief Tracker verifying time scale and maximum requests amount in * different HMI levels @@ -206,7 +256,9 @@ class RequestControllerImpl : public RequestController { bool is_low_voltage_; const RequestControlerSettings& settings_; + RequestTimeoutHandler& request_timeout_handler_; + event_engine::EventDispatcher& event_dispatcher_; DISALLOW_COPY_AND_ASSIGN(RequestControllerImpl); }; diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h index e3d5dfd491..3d9ecfa630 100644 --- a/src/components/application_manager/include/application_manager/request_info.h +++ b/src/components/application_manager/include/application_manager/request_info.h @@ -39,7 +39,7 @@ #include #include -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "commands/request_to_hmi.h" #include "utils/date_time.h" @@ -213,6 +213,15 @@ class RequestInfoSet { */ RequestInfoPtr FrontWithNotNullTimeout(); + /** + * @brief GetRequestsByConnectionKey gets all pending requests by provided + * connection key + * @param connection_key connection key for related requests + * @return list of all pending requests for a specified connection key + */ + std::list GetRequestsByConnectionKey( + const uint32_t connection_key); + /* * @brief Erase request from colletion by log(n) time * @param request_info - request to erase diff --git a/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h b/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h index c58d09598f..207f19e0c5 100644 --- a/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h +++ b/src/components/application_manager/include/application_manager/request_timeout_handler_impl.h @@ -49,7 +49,7 @@ class RequestTimeoutHandlerImpl : public event_engine::EventObserver, void AddRequest(const uint32_t hmi_correlation_id, const Request& request) OVERRIDE; void RemoveRequest(const uint32_t hmi_correlation_id) OVERRIDE; - void on_event(const event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h index edb3581737..312302d157 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h @@ -79,7 +79,7 @@ class ResumptionDataProcessorImpl smart_objects::SmartObject& saved_app, ResumeCtrl::ResumptionCallBack callback) override; - void on_event(const app_mngr::event_engine::Event& event) override; + void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE; void HandleOnTimeOut(const uint32_t correlation_id, const hmi_apis::FunctionID::eType function_id) override; diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h index 4dc4c1ad7d..6845851f97 100644 --- a/src/components/application_manager/include/application_manager/state_controller_impl.h +++ b/src/components/application_manager/include/application_manager/state_controller_impl.h @@ -103,6 +103,10 @@ class StateControllerImpl : public event_engine::EventObserver, ApplicationSharedPtr app, const mobile_apis::HMILevel::eType default_level) OVERRIDE; + // EventObserver interface + void HandleOnEvent(const event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const event_engine::MobileEvent& event) OVERRIDE; + void OnAppWindowAdded( ApplicationSharedPtr app, const WindowID window_id, @@ -120,10 +124,6 @@ class StateControllerImpl : public event_engine::EventObserver, bool IsStateActive(HmiState::StateID state_id) const OVERRIDE; - // EventObserver interface - void on_event(const event_engine::Event& event) OVERRIDE; - void on_event(const event_engine::MobileEvent& event) OVERRIDE; - void ActivateDefaultWindow(ApplicationSharedPtr app) OVERRIDE; void ExitDefaultWindow(ApplicationSharedPtr app) OVERRIDE; void DeactivateApp(ApplicationSharedPtr app, @@ -139,6 +139,7 @@ class StateControllerImpl : public event_engine::EventObserver, int64_t RequestHMIStateChange(ApplicationConstSharedPtr app, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority); + /** * @brief The HmiLevelConflictResolver struct * Move other application to HmiStates if applied moved to FULL or LIMITED diff --git a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h index a8ba796a1b..23e140ff29 100644 --- a/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h +++ b/src/components/application_manager/include/application_manager/system_time/system_time_handler_impl.h @@ -70,7 +70,8 @@ class SystemTimeHandlerImpl : public utils::SystemTimeHandler, * in order to send system time query and GetSystemTimeResponse in order * to retrieve utc time and notify all the listeners with new time value. */ - void on_event(const application_manager::event_engine::Event& event) FINAL; + void HandleOnEvent( + const application_manager::event_engine::Event& event) FINAL; /** * @brief DoSystemTimeQuery sends the appropriate request to the system diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h index d9eb7528e4..dc8bfa4533 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_get_app_service_data_request_from_hmi.h @@ -71,7 +71,7 @@ class ASGetAppServiceDataRequestFromHMI /** * @brief onTimeOut from request controller */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; /** * @brief on_event allows to handle events diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h index 36acf116f4..09b7829745 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_request_from_hmi.h @@ -86,7 +86,7 @@ class ASPerformAppServiceInteractionRequestFromHMI /** * @brief onTimeOut from request controller */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; private: DISALLOW_COPY_AND_ASSIGN(ASPerformAppServiceInteractionRequestFromHMI); diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h index 6971354806..f628b94cd1 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/get_app_service_data_request.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_GET_APP_SERVICE_DATA_REQUEST_H_ #include "app_service_rpc_plugin/app_service_rpc_plugin.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -44,7 +44,8 @@ namespace commands { /** * @brief GetAppServiceDataRequest command class **/ -class GetAppServiceDataRequest : public app_mngr::commands::CommandRequestImpl { +class GetAppServiceDataRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief GetAppServiceDataRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h index 854ed3c6aa..e0665b9427 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_request.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_APP_SERVICE_INTERACTION_REQUEST_H_ #include "app_service_rpc_plugin/app_service_rpc_plugin.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -45,7 +45,7 @@ namespace commands { * @brief PerformAppServiceInteractionRequest command class **/ class PerformAppServiceInteractionRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PerformAppServiceInteractionRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h index d70f279658..5145b42171 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/publish_app_service_request.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_PUBLISH_APP_SERVICE_REQUEST_H_ #include "app_service_rpc_plugin/app_service_rpc_plugin.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -44,7 +44,8 @@ namespace commands { /** * @brief PublishAppServiceRequest command class **/ -class PublishAppServiceRequest : public app_mngr::commands::CommandRequestImpl { +class PublishAppServiceRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PublishAppServiceRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h index 4a883b92ee..6a85d10fd4 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace app_service_rpc_plugin { namespace app_mngr = application_manager; @@ -44,7 +44,7 @@ namespace commands { * @brief UnpublishAppServiceRequest command class **/ class UnpublishAppServiceRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief UnpublishAppServiceRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc index 25f389abd0..ff9d4e436a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_get_app_service_data_request_from_hmi.cc @@ -276,7 +276,7 @@ void ASGetAppServiceDataRequestFromHMI::on_event( } } -void ASGetAppServiceDataRequestFromHMI::onTimeOut() { +void ASGetAppServiceDataRequestFromHMI::OnTimeOut() { SDL_LOG_AUTO_TRACE(); SendErrorResponse(correlation_id(), hmi_apis::FunctionID::AppService_GetAppServiceData, diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc index 315d06b85f..eafefa663f 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_perform_app_service_interaction_request_from_hmi.cc @@ -150,7 +150,7 @@ void ASPerformAppServiceInteractionRequestFromHMI::on_event( application_manager::commands::Command::SOURCE_SDL_TO_HMI); } -void ASPerformAppServiceInteractionRequestFromHMI::onTimeOut() { +void ASPerformAppServiceInteractionRequestFromHMI::OnTimeOut() { SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject response_params; response_params[strings::info] = diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index b0063a327f..8560112bf3 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -50,11 +50,11 @@ GetAppServiceDataRequest::GetAppServiceDataRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} GetAppServiceDataRequest::~GetAppServiceDataRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc index 64110a8e23..35b7543a2c 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/perform_app_service_interaction_request.cc @@ -49,11 +49,11 @@ PerformAppServiceInteractionRequest::PerformAppServiceInteractionRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} PerformAppServiceInteractionRequest::~PerformAppServiceInteractionRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc index f2bc66520b..b2ae67610e 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc @@ -51,11 +51,11 @@ PublishAppServiceRequest::PublishAppServiceRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} PublishAppServiceRequest::~PublishAppServiceRequest() {} diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc index 200bae01d9..cba87d3173 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc @@ -49,11 +49,11 @@ UnpublishAppServiceRequest::UnpublishAppServiceRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} UnpublishAppServiceRequest::~UnpublishAppServiceRequest() {} diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h index f81919f4fa..e10b794685 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_get_interior_vehicle_data_request.h @@ -51,7 +51,7 @@ class RCGetInteriorVehicleDataRequest const RCCommandParams& params); void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; ~RCGetInteriorVehicleDataRequest(); }; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h index 6bca1017e0..91f9b6564a 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/rc_command_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_COMMANDS_RC_COMMAND_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "rc_rpc_plugin/commands/rc_command_params.h" #include "rc_rpc_plugin/interior_data_cache.h" #include "rc_rpc_plugin/rc_app_extension.h" @@ -48,7 +48,7 @@ enum TypeAccess { kDisallowed, kAllowed }; namespace commands { -class RCCommandRequest : public app_mngr::commands::CommandRequestImpl { +class RCCommandRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief RCCommandRequest class constructor @@ -65,11 +65,11 @@ class RCCommandRequest : public app_mngr::commands::CommandRequestImpl { virtual ~RCCommandRequest(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; void Run() OVERRIDE; - virtual void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; protected: bool is_subscribed; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h index 944d47b052..eeeb9988d7 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_pending_resumption_handler.h @@ -22,7 +22,8 @@ class RCPendingResumptionHandler : public resumption::PendingResumptionHandler { application_manager::ApplicationManager& application_manager, rc_rpc_plugin::InteriorDataCache& interior_data_cache); - void on_event(const application_manager::event_engine::Event& event) override; + void HandleOnEvent( + const application_manager::event_engine::Event& event) override; void HandleResumptionSubscriptionRequest( application_manager::AppExtension& extension, diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc index fede1dbd11..0aaee81ad4 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_get_interior_vehicle_data_request.cc @@ -57,7 +57,7 @@ void RCGetInteriorVehicleDataRequest::Run() { SendRequest(); } -void RCGetInteriorVehicleDataRequest::onTimeOut() { +void RCGetInteriorVehicleDataRequest::OnTimeOut() { SDL_LOG_TRACE("function_id: " << function_id() << " correlation_id: " << correlation_id()); using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc index 9bf7977bdf..297c4b70bb 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/button_press_request.cc @@ -125,7 +125,7 @@ AcquireResult::eType ButtonPressRequest::AcquireResource( SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); return resource_allocation_manager_.AcquireResource( module_type, ModuleId(), app->app_id()); @@ -141,8 +141,7 @@ void ButtonPressRequest::SetResourceState(const std::string& module_type, const ResourceState::eType state) { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); - + application_manager_.application(RequestFromMobileImpl::connection_key()); resource_allocation_manager_.SetResourceState( module_type, ModuleId(), app->app_id(), state); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc index c3b0a7d4a5..f5c5c9278d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc @@ -315,7 +315,7 @@ void GetInteriorVehicleDataRequest::ProccessSubscription( const_cast(hmi_response); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); const auto extension = RCHelpers::GetRCExtension(*app); const char* module_type; ns_smart_device_link::ns_smart_objects:: @@ -403,8 +403,8 @@ bool GetInteriorVehicleDataRequest::HasRequestExcessiveSubscription() { message_params::kSubscribe); if (is_subscribe_present_in_request) { - app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + app_mngr::ApplicationSharedPtr app = application_manager_.application( + RequestFromMobileImpl::connection_key()); const auto extension = RCHelpers::GetRCExtension(*app); const std::string module_type = ModuleType(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc index dea660b780..5b500dfa30 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc @@ -372,7 +372,7 @@ AcquireResult::eType SetInteriorVehicleDataRequest::AcquireResource( SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); return resource_allocation_manager_.AcquireResource( module_type, ModuleId(), app->app_id()); @@ -387,7 +387,7 @@ void SetInteriorVehicleDataRequest::SetResourceState( const std::string& module_type, const ResourceState::eType state) { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); resource_allocation_manager_.SetResourceState( module_type, ModuleId(), app->app_id(), state); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc index e179c0c0d7..376723b964 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/rc_command_request.cc @@ -31,7 +31,9 @@ */ #include "rc_rpc_plugin/commands/rc_command_request.h" + #include + #include "application_manager/hmi_interfaces.h" #include "application_manager/message_helper.h" #include "application_manager/policies/policy_handler_interface.h" @@ -49,7 +51,7 @@ namespace commands { RCCommandRequest::RCCommandRequest( const app_mngr::commands::MessageSharedPtr& message, const RCCommandParams& params) - : application_manager::commands::CommandRequestImpl( + : application_manager::commands::RequestFromMobileImpl( message, params.application_manager_, params.rpc_service_, @@ -74,18 +76,18 @@ bool RCCommandRequest::IsInterfaceAvailable( return app_mngr::HmiInterfaces::STATE_NOT_AVAILABLE != state; } -void RCCommandRequest::onTimeOut() { +void RCCommandRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); const std::string module_type = ModuleType(); SetResourceState(module_type, ResourceState::FREE); - SendResponse( - false, mobile_apis::Result::GENERIC_ERROR, "Request timeout expired"); + + RequestFromMobileImpl::OnTimeOut(); } bool RCCommandRequest::CheckDriverConsent() { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(connection_key()); const std::string module_type = ModuleType(); rc_rpc_plugin::TypeAccess access = CheckModule(module_type, app); @@ -131,7 +133,7 @@ void RCCommandRequest::SendDisallowed(rc_rpc_plugin::TypeAccess access) { void RCCommandRequest::Run() { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(connection_key()); if (!IsInterfaceAvailable(app_mngr::HmiInterfaces::HMI_INTERFACE_RC)) { SDL_LOG_WARN("HMI interface RC is not available"); @@ -224,19 +226,19 @@ void RCCommandRequest::on_event(const app_mngr::event_engine::Event& event) { void RCCommandRequest::ProcessAccessResponse( const app_mngr::event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); - app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + + auto app = application_manager_.application(connection_key()); const std::string module_type = ModuleType(); const std::string module_id = ModuleId(); + if (!app) { SDL_LOG_ERROR("NULL pointer."); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED, ""); return; } - const smart_objects::SmartObject& message = event.smart_object(); - - mobile_apis::Result::eType result_code = + const auto& message = event.smart_object(); + const auto result_code = GetMobileResultCode(static_cast( message[app_mngr::strings::params][app_mngr::hmi_response::code] .asUInt())); @@ -328,7 +330,7 @@ void RCCommandRequest::SendGetUserConsent( const smart_objects::SmartObject& module_ids) { SDL_LOG_AUTO_TRACE(); app_mngr::ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(connection_key()); DCHECK(app); smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc index e66023f27a..ba681b0136 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_pending_resumption_handler.cc @@ -14,7 +14,7 @@ RCPendingResumptionHandler::RCPendingResumptionHandler( , rpc_service_(application_manager.GetRPCService()) , interior_data_cache_(interior_data_cache) {} -void RCPendingResumptionHandler::on_event( +void RCPendingResumptionHandler::HandleOnEvent( const application_manager::event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); namespace am_strings = application_manager::strings; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc index 15b2148187..1b83034daf 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc @@ -113,7 +113,8 @@ class RCGetInteriorVehicleDataConsentTest , rpc_protection_manager_( std::make_shared()) , request_controller(mock_request_controler, - mock_request_timeout_handler_) + mock_request_timeout_handler_, + event_dispatcher_) , rpc_service_(app_mngr_, request_controller, &mock_protocol_handler, diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc index fe8ade1e05..077d0d2927 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc @@ -369,7 +369,7 @@ TEST_F(RCPendingResumptionHandlerTest, EXPECT_CALL(event_dispatcher_mock_, raise_event(EventCheck(kAppId_2))); - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); } TEST_F(RCPendingResumptionHandlerTest, @@ -415,7 +415,7 @@ TEST_F(RCPendingResumptionHandlerTest, EXPECT_CALL(mock_rpc_service_, ManageHMICommand(MessageCheck(kAppId_2), kSourceHMI)); - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); } } // namespace rc_rpc_plugin_test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h index 2208671e0b..b6406901be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h @@ -61,12 +61,7 @@ class BasicCommunicationGetSystemTimeRequest app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler); - /** - * @brief onTimeOut allows to handle case when - * system does not respond for certain request in - * appropriate time window. - */ - void onTimeOut() FINAL; + void OnTimeOut() FINAL; }; } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h index 62be7e8836..7b0e3f4590 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h @@ -64,7 +64,7 @@ class ButtonGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ButtonGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h index 0b82feb1c5..98f96c29c4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/get_system_info_request.h @@ -67,9 +67,9 @@ class GetSystemInfoRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; /** - * @brief onTimeOut from request controller + * @brief OnTimeOut from request controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(GetSystemInfoRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h index ac6f1474e6..0cf1e0872e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_audio_start_stream_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief AudioStartStreamRequest command class **/ -class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief AudioStartStreamRequest class constructor @@ -62,10 +61,7 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI, **/ virtual ~AudioStartStreamRequest(); - /** - * @brief onTimeOut from requrst Controller - */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; /** * @brief Execute command @@ -75,7 +71,7 @@ class AudioStartStreamRequest : public app_mngr::commands::RequestToHMI, /** * @brief On event callback **/ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h index d2bda320a3..7cc4181f6e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_is_ready_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief NaviIsReadyRequest command class **/ -class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief NaviIsReadyRequest class constructor @@ -72,7 +71,7 @@ class NaviIsReadyRequest : public app_mngr::commands::RequestToHMI, **/ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(NaviIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h index 437d58861c..8a62f31933 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief NaviSetVideoConfigRequest command class **/ -class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief NaviSetVideoConfigRequest class constructor @@ -76,7 +75,7 @@ class NaviSetVideoConfigRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut callback */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(NaviSetVideoConfigRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h index 76413cd55d..9527ae0a7d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_start_stream_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief NaviStartStreamRequest command class **/ -class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief NaviStartStreamRequest class constructor @@ -70,12 +69,9 @@ class NaviStartStreamRequest : public app_mngr::commands::RequestToHMI, /** * @brief On event callback **/ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; - /** - * @brief onTimeOut from requrst Controller - */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h index 898a2a8f67..c836ad3cc8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h @@ -65,7 +65,7 @@ class NaviSubscribeWayPointsRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(NaviSubscribeWayPointsRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h index 6dd06f283d..353b265908 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_get_capabilities_request.h @@ -63,7 +63,7 @@ class RCGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(RCGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h index 15b2e13867..393442801c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/rc_is_ready_request.h @@ -43,8 +43,7 @@ namespace commands { /** * @brief RCIsReadyRequest command class **/ -class RCIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class RCIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief RCIsReadyRequest class constructor @@ -75,7 +74,7 @@ class RCIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(RCIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h index 2751104486..21dc6a3bb2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/sdl_activate_app_request.h @@ -76,7 +76,7 @@ class SDLActivateAppRequest : public app_mngr::commands::RequestFromHMI { * @brief onTimeOut allows to process case when timeout has appeared * during request execution. */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; /** * @brief on_event allows to handle events diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h index f3e08d0a23..3d38e10525 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/subscribe_button_request.h @@ -45,8 +45,7 @@ namespace hmi { /** * @brief SubscribeButtonRequest command class **/ -class SubscribeButtonRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class SubscribeButtonRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief SubscribeButtonRequest class constructor @@ -68,7 +67,7 @@ class SubscribeButtonRequest : public app_mngr::commands::RequestToHMI, **/ void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; void on_event(const application_manager::event_engine::Event& event) OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h index 4ddd6f25fc..6d87158e57 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h @@ -63,7 +63,7 @@ class TTSGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h index b00fc9cffa..c2c02e50ae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_language_request.h @@ -63,7 +63,7 @@ class TTSGetLanguageRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSGetLanguageRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h index 802a196c46..e4a7ec5dee 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h @@ -65,7 +65,7 @@ class TTSGetSupportedLanguagesRequest void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSGetSupportedLanguagesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h index 039df31972..97d8e02e59 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h @@ -45,8 +45,7 @@ namespace commands { /** * @brief TTSIsReadyRequest command class **/ -class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief TTSIsReadyRequest class constructor @@ -77,7 +76,7 @@ class TTSIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h index 2ac47ab013..536fe767bc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h @@ -67,7 +67,7 @@ class TTSSetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(TTSSetGlobalPropertiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h index 20e9004503..a572aa53e8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_command_request.h @@ -66,7 +66,7 @@ class UIAddCommandRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIAddCommandRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h index 660c81c4f8..0823e7e7b3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h @@ -66,7 +66,7 @@ class UIAddSubmenuRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIAddSubmenuRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h index baa181fb53..015dca8789 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h @@ -55,7 +55,7 @@ class UICreateWindowRequest : public app_mngr::commands::RequestToHMI { void Run() FINAL; - void onTimeOut() FINAL; + void OnTimeOut() FINAL; private: DISALLOW_COPY_AND_ASSIGN(UICreateWindowRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h index 32e878e733..bb4799c0d0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h @@ -63,7 +63,7 @@ class UIGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h index d642beb341..3b395dc685 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_language_request.h @@ -63,7 +63,7 @@ class UIGetLanguageRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIGetLanguageRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h index 9c2492b9fe..1422035a2c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_get_supported_languages_request.h @@ -64,7 +64,7 @@ class UIGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIGetSupportedLanguagesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h index 5c7f6d4cc8..168f961e50 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h @@ -45,8 +45,7 @@ namespace commands { /** * @brief UIIsReadyRequest command class **/ -class UIIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class UIIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief UIIsReadyRequest class constructor @@ -77,7 +76,7 @@ class UIIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UIIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h index 145f1d7c07..6f8002ce78 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h @@ -67,7 +67,7 @@ class UISetGlobalPropertiesRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(UISetGlobalPropertiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h index b377a536cb..5a5f9228e0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/unsubscribe_button_request.h @@ -44,8 +44,7 @@ namespace commands { namespace hmi { -class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI { public: UnsubscribeButtonRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, @@ -57,7 +56,7 @@ class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI, void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; void on_event(const application_manager::event_engine::Event& event) OVERRIDE; @@ -72,4 +71,4 @@ class UnsubscribeButtonRequest : public app_mngr::commands::RequestToHMI, } // namespace sdl_rpc_plugin -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_ \ No newline at end of file +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UNSUBSCRIBE_BUTTON_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h index ba4c49ab01..44cb779beb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_add_command_request.h @@ -66,7 +66,7 @@ class VRAddCommandRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRAddCommandRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h index 7f8485ffa0..40e63651cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h @@ -63,7 +63,7 @@ class VRGetCapabilitiesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRGetCapabilitiesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h index abcaa35726..3e3976244e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_language_request.h @@ -63,7 +63,7 @@ class VRGetLanguageRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRGetLanguageRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h index fb6d05b0aa..4bf7d68e75 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h @@ -64,7 +64,7 @@ class VRGetSupportedLanguagesRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRGetSupportedLanguagesRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h index cbd77087b2..651f318b9f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h @@ -45,8 +45,7 @@ namespace commands { /** * @brief VRIsReadyRequest command class **/ -class VRIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class VRIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief VRIsReadyRequest class constructor @@ -77,7 +76,7 @@ class VRIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VRIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h index 6ccd57947c..d55b4f5af7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_command_request.h @@ -37,7 +37,7 @@ #include #include "application_manager/application.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -48,7 +48,7 @@ namespace commands { /** * @brief AddCommandRequest command class **/ -class AddCommandRequest : public app_mngr::commands::CommandRequestImpl { +class AddCommandRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief AddCommandRequest class constructor @@ -71,18 +71,9 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl { **/ void Run() FINAL; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ void on_event(const app_mngr::event_engine::Event& event) FINAL; - /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - */ - void onTimeOut() FINAL; + void OnTimeOut() FINAL; /** * @brief Init sets hash update mode for request @@ -117,13 +108,6 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl { DISALLOW_COPY_AND_ASSIGN(AddCommandRequest); - /* - * @brief Check if there some not delivered hmi responses exist - * - * @return true if all responses received - */ - bool IsPendingResponseExist(); - /** * @brief Checks add command param * When type is String there is a check on the contents \t\n \\t \\n @@ -140,17 +124,14 @@ class AddCommandRequest : public app_mngr::commands::CommandRequestImpl { * @return info for mobile response */ const std::string GenerateMobileResponseInfo(); - bool send_ui_; - bool send_vr_; - - bool is_ui_received_; - bool is_vr_received_; std::string ui_info_; std::string vr_info_; hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType vr_result_; + bool ui_is_sent_; + bool vr_is_sent_; }; } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h index d99c5dab38..943d634f70 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_SUB_MENU_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ADD_SUB_MENU_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief AddSubMenuRequest command class **/ -class AddSubMenuRequest : public app_mngr::commands::CommandRequestImpl { +class AddSubMenuRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief AddSubMenuRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h index 8b7e86fb3f..4abe7d4ece 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h @@ -34,8 +34,8 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_MANEUVER_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_ALERT_MANEUVER_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" #include "application_manager/commands/pending.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -47,7 +47,7 @@ namespace commands { /** * @brief AlertManeuverRequest command class **/ -class AlertManeuverRequest : public app_mngr::commands::CommandRequestImpl { +class AlertManeuverRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief AlertManeuverRequest class constructor @@ -70,12 +70,7 @@ class AlertManeuverRequest : public app_mngr::commands::CommandRequestImpl { **/ virtual void Run(); - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h index 2250d7a8de..5352148289 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/alert_request.h @@ -36,7 +36,7 @@ #include -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -48,7 +48,7 @@ namespace commands { /** * @brief AlertRequest command class **/ -class AlertRequest : public app_mngr::commands::CommandRequestImpl { +class AlertRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief AlertRequest class constructor @@ -76,12 +76,9 @@ class AlertRequest : public app_mngr::commands::CommandRequestImpl { **/ virtual void Run(); - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; + + void OnTimeOut() FINAL; protected: private: @@ -116,7 +113,7 @@ class AlertRequest : public app_mngr::commands::CommandRequestImpl { /* * @brief Tells if there are sent requests without responses */ - bool HasHmiResponsesToWait(); + bool IsPendingResponseExist(); /* * @brief Check if all strings have valid syntax in request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h index 0063c07512..f381317cf0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "sdl_rpc_plugin/sdl_rpc_plugin.h" namespace sdl_rpc_plugin { @@ -44,7 +44,8 @@ namespace commands { /** * @brief CancelInteractionRequest command class **/ -class CancelInteractionRequest : public app_mngr::commands::CommandRequestImpl { +class CancelInteractionRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief CancelInteractionRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h index f9f780b84b..384b9da4ae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h @@ -36,8 +36,8 @@ #include -#include "application_manager/commands/command_request_impl.h" #include "application_manager/commands/pending.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/custom_string.h" #include "utils/macro.h" @@ -52,7 +52,7 @@ namespace custom_str = utils::custom_string; * @brief ChangeRegistrationRequest command class **/ class ChangeRegistrationRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ChangeRegistrationRequest class constructor @@ -75,12 +75,7 @@ class ChangeRegistrationRequest **/ virtual void Run(); - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; private: /* @@ -104,13 +99,6 @@ class ChangeRegistrationRequest */ bool IsLanguageSupportedByTTS(const int32_t& hmi_display_lang); - /* - * @brief Check if there some not delivered hmi responses exist - * - * @return true if all responses received - */ - bool IsPendingResponseExist(); - /** * @brief Checks change_registration params(ttsName, appname, * ngnMediaScreenAppName, vrSynonyms) on invalid characters. @@ -164,8 +152,6 @@ class ChangeRegistrationRequest const custom_str::CustomString& newItem_; }; - app_mngr::commands::Pending pending_requests_; - hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType vr_result_; hmi_apis::Common_Result::eType tts_result_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h index b965e880b4..3f768c95e1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "sdl_rpc_plugin/sdl_rpc_plugin.h" namespace sdl_rpc_plugin { @@ -44,7 +44,8 @@ namespace commands { /** * @brief CloseApplicationRequest command class **/ -class CloseApplicationRequest : public app_mngr::commands::CommandRequestImpl { +class CloseApplicationRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief CloseApplicationRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h index aba2ce3be5..82967b717b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h @@ -37,7 +37,7 @@ #include #include "application_manager/application.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/event_engine/event_observer.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -53,7 +53,7 @@ namespace commands { * @brief CreateInteractionChoiceSetRequest command class **/ class CreateInteractionChoiceSetRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief CreateInteractionChoiceSetRequest class constructor @@ -77,18 +77,9 @@ class CreateInteractionChoiceSetRequest **/ void Run() FINAL; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ void on_event(const app_mngr::event_engine::Event& event) FINAL; - /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - */ - void onTimeOut() FINAL; + void OnTimeOut() FINAL; /** * @brief Init sets hash update mode for request @@ -137,12 +128,6 @@ class CreateInteractionChoiceSetRequest volatile bool error_from_hmi_; sync_primitives::Lock error_from_hmi_lock_; - /** - * @brief Flag shows if request already was expired by timeout - */ - volatile bool is_timed_out_; - sync_primitives::Lock is_timed_out_lock_; - sync_primitives::RecursiveLock vr_commands_lock_; /* * @brief Sends VR AddCommand request to HMI diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h index cfbfc460b7..3a3f84c0b7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/hmi_state.h" #include "utils/macro.h" @@ -45,7 +45,7 @@ namespace commands { /** * @brief CreateWindow request command class **/ -class CreateWindowRequest : public app_mngr::commands::CommandRequestImpl { +class CreateWindowRequest : public app_mngr::commands::RequestFromMobileImpl { public: CreateWindowRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h index 45864ca3aa..0092b0c917 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_command_request.h @@ -36,7 +36,7 @@ #include -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -47,7 +47,7 @@ namespace commands { /** * @brief DeleteCommandRequest command class **/ -class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl { +class DeleteCommandRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DeleteCommandRequest class constructor @@ -70,11 +70,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl { **/ void Run() FINAL; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ void on_event(const app_mngr::event_engine::Event& event) FINAL; /** @@ -85,13 +80,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl { private: DISALLOW_COPY_AND_ASSIGN(DeleteCommandRequest); - /* - * @brief Check if there some not delivered hmi responses exist - * - * @return true if all responses received - */ - bool IsPendingResponseExist(); - /* * @brief Prepare result code and result for sending to mobile application * @param result_code contains result code for sending to mobile application @@ -101,12 +89,6 @@ class DeleteCommandRequest : public app_mngr::commands::CommandRequestImpl { bool PrepareResponseParameters(mobile_apis::Result::eType& result_code, std::string& info); - bool is_ui_send_; - bool is_vr_send_; - - bool is_ui_received_; - bool is_vr_received_; - hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType vr_result_; std::string ui_info_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h index 8e4d63df4a..60633cfbea 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_file_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_FILE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_FILE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -47,7 +47,7 @@ namespace commands { /** * @brief DeleteFileRequest command class **/ -class DeleteFileRequest : public app_mngr::commands::CommandRequestImpl { +class DeleteFileRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DeleteFileRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h index d5fa89c8be..ad478bc70d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_request.h @@ -39,6 +39,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -52,7 +53,7 @@ typedef std::set SentRequestsSet; * @brief DeleteInteractionChoiceSetRequest command class **/ class DeleteInteractionChoiceSetRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DeleteInteractionChoiceSetRequest class constructor @@ -89,12 +90,6 @@ class DeleteInteractionChoiceSetRequest */ void on_event(const app_mngr::event_engine::Event& event) FINAL; - /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - */ - void onTimeOut() FINAL; - private: /* * @brief Check if requested choice set ID in use by perform interaction diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h index 20fff456d5..acb1565ec5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h @@ -36,6 +36,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +47,7 @@ namespace commands { /** * @brief DeleteSubMenuRequest command class **/ -class DeleteSubMenuRequest : public app_mngr::commands::CommandRequestImpl { +class DeleteSubMenuRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DeleteSubMenuRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h index b837724d7b..8be513d9ba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/hmi_state.h" #include "utils/macro.h" @@ -45,7 +45,7 @@ namespace commands { /** * @brief CreateWindow request command class **/ -class DeleteWindowRequest : public app_mngr::commands::CommandRequestImpl { +class DeleteWindowRequest : public app_mngr::commands::RequestFromMobileImpl { public: DeleteWindowRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h index 750288f5e8..b7865122aa 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/dial_number_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAL_NUMBER_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAL_NUMBER_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -44,7 +44,7 @@ namespace commands { /** * @brief DialNumber request command class **/ -class DialNumberRequest : public app_mngr::commands::CommandRequestImpl { +class DialNumberRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief DialNumberRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h index 1c18de3237..4f56a1b5f2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_END_AUDIO_PASS_THRU_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_END_AUDIO_PASS_THRU_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,8 @@ namespace commands { /** * @brief EndAudioPassThruRequest command class **/ -class EndAudioPassThruRequest : public app_mngr::commands::CommandRequestImpl { +class EndAudioPassThruRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief EndAudioPassThruRequest class constructor @@ -73,7 +74,7 @@ class EndAudioPassThruRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(EndAudioPassThruRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h index 3d74a80dc2..1166fead63 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_cloud_app_properties_request.h @@ -1,7 +1,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_CLOUD_APP_PROPERTIES_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -9,7 +9,7 @@ namespace app_mngr = application_manager; namespace commands { class GetCloudAppPropertiesRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: GetCloudAppPropertiesRequest( const app_mngr::commands::MessageSharedPtr& message, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h index d4182ea004..2f9f591c73 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_file_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_FILE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/event_engine/event.h" namespace sdl_rpc_plugin { @@ -44,7 +44,7 @@ namespace commands { /** * @brief GetFileRequest command class **/ -class GetFileRequest : public app_mngr::commands::CommandRequestImpl { +class GetFileRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief GetFileRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h index a5d1611f02..deff991b9f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_system_capability_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_SYSTEM_CAPABILITY_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -42,7 +42,7 @@ namespace app_mngr = application_manager; namespace commands { class GetSystemCapabilityRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: GetSystemCapabilityRequest( const app_mngr::commands::MessageSharedPtr& message, @@ -55,7 +55,7 @@ class GetSystemCapabilityRequest virtual void Run() OVERRIDE; - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(GetSystemCapabilityRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h index ec656820e5..a4aa606bd4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/get_way_points_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_WAY_POINTS_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -43,7 +43,7 @@ namespace commands { /** * @brief GetWayPointsRequest command class **/ -class GetWayPointsRequest : public app_mngr::commands::CommandRequestImpl { +class GetWayPointsRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief GetWayPointsRequest class constructor @@ -63,12 +63,8 @@ class GetWayPointsRequest : public app_mngr::commands::CommandRequestImpl { * @brief Execute command **/ virtual void Run() OVERRIDE; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - virtual void on_event(const app_mngr::event_engine::Event& event); + + void on_event(const app_mngr::event_engine::Event& event) FINAL; private: DISALLOW_COPY_AND_ASSIGN(GetWayPointsRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h index d98fa433b4..9435e80222 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/list_files_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_LIST_FILES_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_LIST_FILES_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief ListFilesRequest command class **/ -class ListFilesRequest : public app_mngr::commands::CommandRequestImpl { +class ListFilesRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ListFilesRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h index 434b6de028..da8f13c5d7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_PERFORM_AUDIO_PASS_THRU_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -47,7 +47,7 @@ namespace commands { * @brief PerformAudioPassThruRequest command class **/ class PerformAudioPassThruRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PerformAudioPassThruRequest class constructor @@ -66,13 +66,6 @@ class PerformAudioPassThruRequest **/ virtual ~PerformAudioPassThruRequest(); - /** - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - * - */ - virtual void onTimeOut(); - /** * @brief Init required by command resources **/ @@ -83,12 +76,14 @@ class PerformAudioPassThruRequest **/ virtual void Run(); + void on_event(const app_mngr::event_engine::Event& event) FINAL; + /** - * @brief Interface method that is called whenever new event received + * @brief Function is called by RequestController when request execution time + * has exceed it's limit * - * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void OnTimeOut() FINAL; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h index 88182a0b8e..8652464fba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h @@ -38,6 +38,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -51,7 +52,7 @@ namespace commands { * @brief PerformInteractionRequest command class **/ class PerformInteractionRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PerformInteractionRequest class constructor @@ -79,19 +80,9 @@ class PerformInteractionRequest **/ virtual void Run(); - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) FINAL; - /* - * @brief Function is called by RequestController when request execution time - * has exceed it's limit - * - */ - virtual void onTimeOut(); + void OnTimeOut() FINAL; protected: /** @@ -265,12 +256,11 @@ class PerformInteractionRequest smart_objects::SmartObject& msg_param) const; mobile_apis::InteractionMode::eType interaction_mode_; + std::int32_t ui_choice_id_received_; std::int32_t vr_choice_id_received_; std::string ui_text_entry_received_; - bool ui_response_received_; - bool vr_response_received_; bool app_pi_was_active_before_; static uint32_t pi_requests_count_; hmi_apis::Common_Result::eType vr_result_code_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h index b3e04f7796..f7aa0278a9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h @@ -36,6 +36,7 @@ #include "application_manager/application_manager.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +47,7 @@ namespace commands { /** * @brief PutFileRequest command class **/ -class PutFileRequest : public app_mngr::commands::CommandRequestImpl { +class PutFileRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief PutFileRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h index b3359f7752..d54f061228 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_REGISTER_APP_INTERFACE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/policies/policy_handler_interface.h" #include "utils/custom_string.h" #include "utils/macro.h" @@ -56,7 +56,7 @@ namespace custom_str = utils::custom_string; * @brief Register app interface request command class **/ class RegisterAppInterfaceRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief RegisterAppInterfaceRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h index 760eb09c2d..d156371ccd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/reset_global_properties_request.h @@ -35,7 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_RESET_GLOBAL_PROPERTIES_REQUEST_H_ #include "application_manager/application.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -47,7 +47,7 @@ namespace commands { * @brief ResetGlobalPropertiesRequest command class **/ class ResetGlobalPropertiesRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ResetGlobalPropertiesRequest class constructor @@ -71,11 +71,6 @@ class ResetGlobalPropertiesRequest **/ void Run() FINAL; - /** - * @brief Interface method that is called whenever new event received - * - * @param event The received event - */ void on_event(const app_mngr::event_engine::Event& event) FINAL; /** @@ -94,13 +89,6 @@ class ResetGlobalPropertiesRequest bool PrepareResponseParameters(mobile_apis::Result::eType& out_result_code, std::string& out_response_info); - /* - * @brief Check if there some not delivered hmi responses exist - * - * @return true if all responses received - */ - bool IsPendingResponseExist(); - DISALLOW_COPY_AND_ASSIGN(ResetGlobalPropertiesRequest); hmi_apis::Common_Result::eType ui_result_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h index 58b7b4491a..fc7b8e0207 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/scrollable_message_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SCROLLABLE_MESSAGE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SCROLLABLE_MESSAGE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -46,7 +46,8 @@ namespace commands { /** * @brief scrollable message request command class **/ -class ScrollableMessageRequest : public app_mngr::commands::CommandRequestImpl { +class ScrollableMessageRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ScrollableMessageRequest class constructor @@ -77,7 +78,7 @@ class ScrollableMessageRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ScrollableMessageRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h index 2f00b58d9e..96f560bd9e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h @@ -34,8 +34,9 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_HAPTIC_DATA_REQUEST_H_ #include + #include "application_manager/application_manager.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/event_engine/event.h" #include "smart_objects/smart_object.h" @@ -47,7 +48,7 @@ namespace commands { /** * @brief SendHapticDataRequest command class **/ -class SendHapticDataRequest : public app_mngr::commands::CommandRequestImpl { +class SendHapticDataRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SendHapticDataRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h index 5a0dc67f35..c035ffca34 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/send_location_request.h @@ -35,7 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SEND_LOCATION_REQUEST_H_ #include -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -45,7 +45,7 @@ namespace commands { /** * @brief send location request command class */ -class SendLocationRequest : public app_mngr::commands::CommandRequestImpl { +class SendLocationRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SendLocationRquest class constructor @@ -71,7 +71,7 @@ class SendLocationRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h index 520f27d8b9..aed482a8ab 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_app_icon_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_APP_ICON_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_APP_ICON_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief SetIconRequest command class **/ -class SetAppIconRequest : public app_mngr::commands::CommandRequestImpl { +class SetAppIconRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief Contains information about the type of image @@ -73,7 +73,7 @@ class SetAppIconRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; /** * @brief Execute command diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h index a3a3ea12f9..c05ba16684 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_cloud_app_properties_request.h @@ -1,7 +1,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -9,7 +9,7 @@ namespace app_mngr = application_manager; namespace commands { class SetCloudAppPropertiesRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: SetCloudAppPropertiesRequest( const app_mngr::commands::MessageSharedPtr& message, @@ -28,4 +28,4 @@ class SetCloudAppPropertiesRequest } // namespace commands } // namespace sdl_rpc_plugin -#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ \ No newline at end of file +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_CLOUD_APP_PROPERTIES_REQUEST_H_ diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h index 2f9c0946d3..0e0105c880 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_display_layout_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_DISPLAY_LAYOUT_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_DISPLAY_LAYOUT_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,8 @@ namespace commands { /** * @brief SetDisplayLayoutRequest command class **/ -class SetDisplayLayoutRequest : public app_mngr::commands::CommandRequestImpl { +class SetDisplayLayoutRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SetDisplayLayoutRequest class constructor @@ -68,7 +69,7 @@ class SetDisplayLayoutRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event **/ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; /** * @brief Execute command diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h index fbf3056e58..37ad705930 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h @@ -33,8 +33,9 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_GLOBAL_PROPERTIES_REQUEST_H_ #include + #include "application_manager/application.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +47,7 @@ namespace commands { * @brief Register app interface request command class **/ class SetGlobalPropertiesRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SetGlobalPropertiesRequest class constructor @@ -82,7 +83,7 @@ class SetGlobalPropertiesRequest */ bool Init() FINAL; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; /** * @brief Prepares total result for mobile according to three results: diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h index 3023bf4fec..af7427b2a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_MEDIA_CLOCK_TIMER_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SET_MEDIA_CLOCK_TIMER_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief SetMediaClockRequest request command class **/ -class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl { +class SetMediaClockRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief SetMediaClockRequest class constructor @@ -71,7 +71,7 @@ class SetMediaClockRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: bool isDataValid(std::string& info); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h index c9691a808f..3cc7c4d539 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -43,7 +43,7 @@ namespace commands { /** * @brief ShowAppMenuRequest command class **/ -class ShowAppMenuRequest : public app_mngr::commands::CommandRequestImpl { +class ShowAppMenuRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ShowAppMenuRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h index 7694070a72..692cf4b137 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_CONSTANT_TBT_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_CONSTANT_TBT_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -46,7 +46,8 @@ namespace commands { /** * @brief ShowConstantTBTRequest command class **/ -class ShowConstantTBTRequest : public app_mngr::commands::CommandRequestImpl { +class ShowConstantTBTRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ShowConstantTBTRequest class constructor @@ -74,7 +75,7 @@ class ShowConstantTBTRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h index 26612609a4..1d9988c765 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -46,7 +46,7 @@ namespace commands { /** * @brief show request command class **/ -class ShowRequest : public app_mngr::commands::CommandRequestImpl { +class ShowRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief ShowRequest class constructor @@ -72,7 +72,7 @@ class ShowRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /* diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h index 5dbcbb7d41..f9cf401c7c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/slider_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SLIDER_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SLIDER_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief slider request command class **/ -class SliderRequest : public app_mngr::commands::CommandRequestImpl { +class SliderRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief SliderRequest class constructor @@ -76,7 +76,7 @@ class SliderRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h index 68e35fcd1d..f753c02990 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/speak_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SPEAK_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SPEAK_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief speak request command class **/ -class SpeakRequest : public app_mngr::commands::CommandRequestImpl { +class SpeakRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief SpeakRequest class constructor @@ -71,7 +71,7 @@ class SpeakRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /* diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h index ecb390095e..332d622895 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_button_request.h @@ -35,7 +35,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_BUTTON_REQUEST_H_ #include "application_manager/application_impl.h" -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +46,8 @@ namespace commands { /** * @brief SubscribeButtonRequest command class **/ -class SubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl { +class SubscribeButtonRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SubscribeButtonRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h index 69154d7669..fbda174553 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subscribe_way_points_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBSCRIBE_WAY_POINTS_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -44,7 +44,7 @@ namespace commands { * @brief SubsribeWayPointsRequest command class **/ class SubscribeWayPointsRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief SubscribeWayPointsRequest class constructor @@ -76,7 +76,7 @@ class SubscribeWayPointsRequest */ bool Init() FINAL; - void onTimeOut() FINAL; + void OnTimeOut() FINAL; private: DISALLOW_COPY_AND_ASSIGN(SubscribeWayPointsRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h index 4789d35e60..c966be4dbe 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/subtle_alert_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBTLE_ALERT_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SUBTLE_ALERT_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "sdl_rpc_plugin/sdl_rpc_plugin.h" namespace sdl_rpc_plugin { @@ -44,7 +44,7 @@ namespace commands { /** * @brief SubtleAlertRequest command class **/ -class SubtleAlertRequest : public app_mngr::commands::CommandRequestImpl { +class SubtleAlertRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SubtleAlertRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h index eb2398f279..9b031859c3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/system_request.h @@ -37,6 +37,7 @@ #include #include "application_manager/application_manager.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/event_engine/event.h" #include "smart_objects/smart_object.h" @@ -48,7 +49,7 @@ namespace commands { /** * @brief SystemRequest command class **/ -class SystemRequest : public app_mngr::commands::CommandRequestImpl { +class SystemRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SystemRequest class constructor @@ -76,7 +77,7 @@ class SystemRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h index 0bc01f2aaa..90d0c24b88 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unregister_app_interface_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNREGISTER_APP_INTERFACE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNREGISTER_APP_INTERFACE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -46,7 +46,7 @@ namespace commands { * @brief Unregister app interface request command class **/ class UnregisterAppInterfaceRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief UnregisterAppInterfaceRequest class constructor @@ -57,11 +57,11 @@ class UnregisterAppInterfaceRequest app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} /** * \brief UnregisterAppInterfaceRequest class destructor diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h index 5adecb4d7a..42e2a7ffde 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_button_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_BUTTON_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_BUTTON_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" namespace sdl_rpc_plugin { @@ -42,7 +42,11 @@ namespace app_mngr = application_manager; namespace commands { -class UnsubscribeButtonRequest : public app_mngr::commands::CommandRequestImpl { +/** + * @brief UnsubscribeButtonRequest command class + **/ +class UnsubscribeButtonRequest + : public app_mngr::commands::RequestFromMobileImpl { public: UnsubscribeButtonRequest(const app_mngr::commands::MessageSharedPtr& message, app_mngr::ApplicationManager& application_manager, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h index c4357d7529..33aa9f743a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/unsubscribe_way_points_request.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UNSUBSCRIBE_WAY_POINTS_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" namespace sdl_rpc_plugin { namespace app_mngr = application_manager; @@ -41,7 +41,7 @@ namespace app_mngr = application_manager; namespace commands { class UnsubscribeWayPointsRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * \brief UnsubscribeWayPointsRequest class constructor @@ -75,7 +75,7 @@ class UnsubscribeWayPointsRequest */ bool Init() FINAL; - void onTimeOut() FINAL; + void OnTimeOut() FINAL; private: DISALLOW_COPY_AND_ASSIGN(UnsubscribeWayPointsRequest); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h index e1e5df2289..29bc269938 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/update_turn_list_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UPDATE_TURN_LIST_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_UPDATE_TURN_LIST_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "interfaces/MOBILE_API.h" #include "utils/macro.h" @@ -46,7 +46,7 @@ namespace commands { /** * @brief UpdateTurnListRequest command class **/ -class UpdateTurnListRequest : public app_mngr::commands::CommandRequestImpl { +class UpdateTurnListRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief UpdateTurnListRequest class constructor @@ -74,7 +74,7 @@ class UpdateTurnListRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h index 871359bc9a..17842c17ba 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_pending_resumption_handler.h @@ -47,7 +47,7 @@ class WayPointsPendingResumptionHandler app_mngr::ApplicationManager& application_manager); // EventObserver interface - void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE; void HandleResumptionSubscriptionRequest( app_mngr::AppExtension& extension, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc index a6e95f9f72..3429bd6059 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_get_system_time_request.cc @@ -51,7 +51,7 @@ BasicCommunicationGetSystemTimeRequest::BasicCommunicationGetSystemTimeRequest( hmi_capabilities, policy_handler) {} -void BasicCommunicationGetSystemTimeRequest::onTimeOut() { +void BasicCommunicationGetSystemTimeRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); application_manager_.protocol_handler().NotifyOnGetSystemTimeFailed(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc index d9c7901c67..2cda09dadc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/button_get_capabilities_request.cc @@ -31,6 +31,7 @@ */ #include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h" + #include "utils/logger.h" namespace sdl_rpc_plugin { @@ -60,7 +61,7 @@ void ButtonGetCapabilitiesRequest::Run() { SendRequest(); } -void ButtonGetCapabilitiesRequest::onTimeOut() { +void ButtonGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::Buttons_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc index 1b42abd055..33651426c9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_system_info_request.cc @@ -61,7 +61,7 @@ void GetSystemInfoRequest::Run() { SendRequest(); } -void GetSystemInfoRequest::onTimeOut() { +void GetSystemInfoRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateCachedCapabilities(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc index 05d0a4e8f2..7d030f9c66 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc @@ -53,7 +53,6 @@ AudioStartStreamRequest::AudioStartStreamRequest( rpc_service, hmi_capabilities, policy_handle) - , EventObserver(application_manager.event_dispatcher()) , retry_number_(0) { SDL_LOG_AUTO_TRACE(); std::pair stream_retry = @@ -138,7 +137,7 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) { } } -void AudioStartStreamRequest::onTimeOut() { +void AudioStartStreamRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); RetryStartSession(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc index 850f292972..7eb2233202 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_is_ready_request.cc @@ -49,8 +49,7 @@ NaviIsReadyRequest::NaviIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} NaviIsReadyRequest::~NaviIsReadyRequest() {} @@ -86,7 +85,7 @@ void NaviIsReadyRequest::on_event(const event_engine::Event& event) { } } -void NaviIsReadyRequest::onTimeOut() { +void NaviIsReadyRequest::OnTimeOut() { hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::Navigation_IsReady); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc index 613dfc24a3..a660887019 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_set_video_config_request.cc @@ -31,6 +31,7 @@ */ #include "sdl_rpc_plugin/commands/hmi/navi_set_video_config_request.h" + #include #include @@ -51,8 +52,7 @@ NaviSetVideoConfigRequest::NaviSetVideoConfigRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} NaviSetVideoConfigRequest::~NaviSetVideoConfigRequest() {} @@ -132,7 +132,7 @@ void NaviSetVideoConfigRequest::on_event(const event_engine::Event& event) { } } -void NaviSetVideoConfigRequest::onTimeOut() { +void NaviSetVideoConfigRequest::OnTimeOut() { SDL_LOG_WARN("Timed out while waiting for SetVideoConfig response"); ApplicationSharedPtr app = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc index c671b11282..d2db777e94 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc @@ -53,7 +53,6 @@ NaviStartStreamRequest::NaviStartStreamRequest( rpc_service, hmi_capabilities, policy_handle) - , EventObserver(application_manager.event_dispatcher()) , retry_number_(0) { SDL_LOG_AUTO_TRACE(); std::pair stream_retry = @@ -140,7 +139,7 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) { } } -void NaviStartStreamRequest::onTimeOut() { +void NaviStartStreamRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); RetryStartSession(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc index 7305ae37b1..63735d84db 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_subscribe_way_points_request.cc @@ -60,7 +60,7 @@ void NaviSubscribeWayPointsRequest::Run() { SendRequest(); } -void NaviSubscribeWayPointsRequest::onTimeOut() { +void NaviSubscribeWayPointsRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc index 774acf54f1..63aa4b11ef 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_get_capabilities_request.cc @@ -59,7 +59,7 @@ void RCGetCapabilitiesRequest::Run() { SendRequest(); } -void RCGetCapabilitiesRequest::onTimeOut() { +void RCGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::RC_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc index 3d31953474..725a55c2b5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc @@ -53,8 +53,7 @@ RCIsReadyRequest::RCIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} RCIsReadyRequest::~RCIsReadyRequest() {} @@ -99,7 +98,7 @@ void RCIsReadyRequest::on_event(const event_engine::Event& event) { } } -void RCIsReadyRequest::onTimeOut() { +void RCIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::RC_IsReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 4de8b17b8d..a8b34bf2d4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -272,7 +272,7 @@ void SDLActivateAppRequest::Run() { } #endif // EXTERNAL_PROPRIETARY_MODE -void SDLActivateAppRequest::onTimeOut() { +void SDLActivateAppRequest::OnTimeOut() { using namespace hmi_apis::FunctionID; using namespace hmi_apis::Common_Result; using namespace application_manager; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc index b1699534bc..5a2420b223 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/subscribe_button_request.cc @@ -53,8 +53,7 @@ SubscribeButtonRequest::SubscribeButtonRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) { + policy_handle) { hmi_apis::Common_ButtonName::eType button_name = static_cast( (*message_)[app_mngr::strings::msg_params] @@ -133,7 +132,7 @@ void SubscribeButtonRequest::on_event(const event_engine::Event& event) { } } -void SubscribeButtonRequest::onTimeOut() { +void SubscribeButtonRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); application_manager_.AddExpiredButtonRequest( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc index 3bca6c05c1..9b5eb6f14b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_capabilities_request.cc @@ -59,7 +59,7 @@ void TTSGetCapabilitiesRequest::Run() { SendRequest(); } -void TTSGetCapabilitiesRequest::onTimeOut() { +void TTSGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc index 2b409c68de..42de944da3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_language_request.cc @@ -59,7 +59,7 @@ void TTSGetLanguageRequest::Run() { SendRequest(); } -void TTSGetLanguageRequest::onTimeOut() { +void TTSGetLanguageRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetLanguage); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc index 87df2402bb..2fb74fbb46 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_get_supported_languages_request.cc @@ -59,7 +59,7 @@ void TTSGetSupportedLanguagesRequest::Run() { SendRequest(); } -void TTSGetSupportedLanguagesRequest::onTimeOut() { +void TTSGetSupportedLanguagesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_GetSupportedLanguages); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc index 5ff7bc5a50..6a09616926 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc @@ -50,8 +50,7 @@ TTSIsReadyRequest::TTSIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handler) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handler) {} TTSIsReadyRequest::~TTSIsReadyRequest() {} @@ -92,7 +91,7 @@ void TTSIsReadyRequest::on_event(const event_engine::Event& event) { } } -void TTSIsReadyRequest::onTimeOut() { +void TTSIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::TTS_IsReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc index 35059bf48d..574230ee11 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_set_global_properties_request.cc @@ -60,7 +60,7 @@ void TTSSetGlobalPropertiesRequest::Run() { SendRequest(); } -void TTSSetGlobalPropertiesRequest::onTimeOut() { +void TTSSetGlobalPropertiesRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( correlation_id(), diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc index 067ada3153..2cd40b1705 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_command_request.cc @@ -60,7 +60,7 @@ void UIAddCommandRequest::Run() { SendRequest(); } -void UIAddCommandRequest::onTimeOut() { +void UIAddCommandRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc index 275c411eae..8b9ecf4932 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_add_submenu_request.cc @@ -60,7 +60,7 @@ void UIAddSubmenuRequest::Run() { SendRequest(); } -void UIAddSubmenuRequest::onTimeOut() { +void UIAddSubmenuRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( correlation_id(), diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc index e98ad5c45e..1acbb9e682 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc @@ -60,7 +60,7 @@ void UICreateWindowRequest::Run() { SendRequest(); } -void UICreateWindowRequest::onTimeOut() { +void UICreateWindowRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc index 00a8ad761e..604f293c4a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_request.cc @@ -59,7 +59,7 @@ void UIGetCapabilitiesRequest::Run() { SendRequest(); } -void UIGetCapabilitiesRequest::onTimeOut() { +void UIGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc index bf91b7e294..597452a471 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_language_request.cc @@ -59,7 +59,7 @@ void UIGetLanguageRequest::Run() { SendRequest(); } -void UIGetLanguageRequest::onTimeOut() { +void UIGetLanguageRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetLanguage); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc index 480fa2499f..c67f552fe2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_supported_languages_request.cc @@ -59,7 +59,7 @@ void UIGetSupportedLanguagesRequest::Run() { SendRequest(); } -void UIGetSupportedLanguagesRequest::onTimeOut() { +void UIGetSupportedLanguagesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_GetSupportedLanguages); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc index f3da33c5b5..630a54e3cc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc @@ -50,8 +50,7 @@ UIIsReadyRequest::UIIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} UIIsReadyRequest::~UIIsReadyRequest() {} @@ -91,7 +90,7 @@ void UIIsReadyRequest::on_event(const event_engine::Event& event) { } } -void UIIsReadyRequest::onTimeOut() { +void UIIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::UI_IsReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc index c82a4d2131..9b664bb81c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_set_global_properties_request.cc @@ -60,7 +60,7 @@ void UISetGlobalPropertiesRequest::Run() { SendRequest(); } -void UISetGlobalPropertiesRequest::onTimeOut() { +void UISetGlobalPropertiesRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( correlation_id(), diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc index dbebf79018..e2cbb4e467 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/unsubscribe_button_request.cc @@ -53,8 +53,7 @@ UnsubscribeButtonRequest::UnsubscribeButtonRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) { + policy_handle) { hmi_apis::Common_ButtonName::eType button_name = static_cast( (*message_)[app_mngr::strings::msg_params] @@ -74,7 +73,7 @@ void UnsubscribeButtonRequest::Run() { SendRequest(); } -void UnsubscribeButtonRequest::onTimeOut() { +void UnsubscribeButtonRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); application_manager_.AddExpiredButtonRequest( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc index c8979ca62b..69bc299c7e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_add_command_request.cc @@ -60,7 +60,7 @@ void VRAddCommandRequest::Run() { SendRequest(); } -void VRAddCommandRequest::onTimeOut() { +void VRAddCommandRequest::OnTimeOut() { auto& resume_ctrl = application_manager_.resume_controller(); resume_ctrl.HandleOnTimeOut( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc index 3f528f2f58..d26d91f701 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_capabilities_request.cc @@ -59,7 +59,7 @@ void VRGetCapabilitiesRequest::Run() { SendRequest(); } -void VRGetCapabilitiesRequest::onTimeOut() { +void VRGetCapabilitiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetCapabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc index f5e9b0e848..f15ed3017b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_language_request.cc @@ -59,7 +59,7 @@ void VRGetLanguageRequest::Run() { SendRequest(); } -void VRGetLanguageRequest::onTimeOut() { +void VRGetLanguageRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetLanguage); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc index 73e68e8503..3f6a268e70 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_get_supported_languages_request.cc @@ -59,7 +59,7 @@ void VRGetSupportedLanguagesRequest::Run() { SendRequest(); } -void VRGetSupportedLanguagesRequest::onTimeOut() { +void VRGetSupportedLanguagesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_GetSupportedLanguages); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc index 2efd227add..3e8fd0b4e3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc @@ -50,8 +50,7 @@ VRIsReadyRequest::VRIsReadyRequest( application_manager, rpc_service, hmi_capabilities, - policy_handle) - , EventObserver(application_manager.event_dispatcher()) {} + policy_handle) {} VRIsReadyRequest::~VRIsReadyRequest() {} @@ -92,7 +91,7 @@ void VRIsReadyRequest::on_event(const event_engine::Event& event) { } } -void VRIsReadyRequest::onTimeOut() { +void VRIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VR_IsReady); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc index 03b0ee20fc..ddd2c9db35 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc @@ -32,6 +32,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/add_command_request.h" + #include #include "application_manager/application.h" @@ -56,24 +57,22 @@ AddCommandRequest::AddCommandRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) - , send_ui_(false) - , send_vr_(false) - , is_ui_received_(false) - , is_vr_received_(false) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) - , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} + , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) + , ui_is_sent_(false) + , vr_is_sent_(false) {} AddCommandRequest::~AddCommandRequest() {} -void AddCommandRequest::onTimeOut() { +void AddCommandRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); RemoveCommand(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); } bool AddCommandRequest::Init() { @@ -184,6 +183,7 @@ void AddCommandRequest::Run() { smart_objects::SmartObject ui_msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); + if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) { ui_msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id]; @@ -201,6 +201,9 @@ void AddCommandRequest::Run() { (*message_)[strings::msg_params][strings::cmd_icon]; } + ui_is_sent_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + if (((*message_)[strings::msg_params].keyExists( strings::secondary_image)) && ((*message_)[strings::msg_params][strings::secondary_image].keyExists( @@ -211,8 +214,6 @@ void AddCommandRequest::Run() { ui_msg_params[strings::secondary_image] = (*message_)[strings::msg_params][strings::secondary_image]; } - - send_ui_ = true; } smart_objects::SmartObject vr_msg_params = @@ -227,16 +228,15 @@ void AddCommandRequest::Run() { vr_msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; vr_msg_params[strings::grammar_id] = app->get_grammar_id(); - send_vr_ = true; + vr_is_sent_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); } - if (send_ui_) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { SendHMIRequest(hmi_apis::FunctionID::UI_AddCommand, &ui_msg_params, true); } - if (send_vr_) { - StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) { SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &vr_msg_params, true); } } @@ -322,7 +322,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_AddCommand: { SDL_LOG_INFO("Received UI_AddCommand event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - is_ui_received_ = true; ui_result_ = static_cast( message[strings::params][hmi_response::code].asInt()); GetInfo(message, ui_info_); @@ -334,7 +333,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::VR_AddCommand: { SDL_LOG_INFO("Received VR_AddCommand event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - is_vr_received_ = true; vr_result_ = static_cast( message[strings::params][hmi_response::code].asInt()); GetInfo(message, vr_info_); @@ -350,6 +348,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { } if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command still wating for HMI response"); return; } @@ -505,10 +504,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { &(message[strings::msg_params])); } -bool AddCommandRequest::IsPendingResponseExist() { - return send_ui_ != is_ui_received_ || send_vr_ != is_vr_received_; -} - bool AddCommandRequest::IsWhiteSpaceExist() { SDL_LOG_AUTO_TRACE(); const char* str = NULL; @@ -559,7 +554,7 @@ bool AddCommandRequest::IsWhiteSpaceExist() { } bool AddCommandRequest::BothSend() const { - return send_vr_ && send_ui_; + return ui_is_sent_ && vr_is_sent_; } const std::string AddCommandRequest::GenerateMobileResponseInfo() { @@ -607,17 +602,18 @@ void AddCommandRequest::RemoveCommand() { app->RemoveCommand(cmd_id); - if (BothSend() && !(is_vr_received_ || is_ui_received_)) { + if (BothSend() && (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR) && + IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI))) { // in case we have send bth UI and VR and no one respond // we have nothing to remove from HMI so no DeleteCommand expected return; } - if (BothSend() && !is_vr_received_) { + if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) { SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); } - if (BothSend() && !is_ui_received_) { + if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { msg_params[strings::grammar_id] = app->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc index 309f07e443..635734a74d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc @@ -50,11 +50,11 @@ AddSubMenuRequest::AddSubMenuRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} AddSubMenuRequest::~AddSubMenuRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc index 0e0d91f05d..89b305ae9d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_maneuver_request.cc @@ -26,8 +26,10 @@ */ #include "sdl_rpc_plugin/commands/mobile/alert_maneuver_request.h" + #include #include + #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "application_manager/policies/policy_handler.h" @@ -45,11 +47,11 @@ AlertManeuverRequest::AlertManeuverRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , tts_speak_result_code_(hmi_apis::Common_Result::INVALID_ENUM) , navi_alert_maneuver_result_code_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -171,6 +173,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_Speak: { SDL_LOG_INFO("Received TTS_Speak event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); + pending_requests_.Remove(event_id); tts_speak_result_code_ = static_cast( message[strings::params][hmi_response::code].asInt()); @@ -186,12 +189,11 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { } } - if (!pending_requests_.IsFinal(event_id)) { - SDL_LOG_DEBUG( - "There are some pending responses from HMI. " - "AlertManeuverRequest still waiting."); + if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command still wating for HMI response"); return; } + std::string return_info; mobile_apis::Result::eType result_code; const bool result = PrepareResponseParameters(result_code, return_info); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc index 26c209bf2a..aab2c8c486 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc @@ -37,7 +37,6 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" - #include "application_manager/policies/policy_handler.h" #include "smart_objects/smart_object.h" #include "utils/helpers.h" @@ -55,11 +54,11 @@ AlertRequest::AlertRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , awaiting_ui_alert_response_(false) , awaiting_tts_speak_response_(false) , awaiting_tts_stop_speaking_response_(false) @@ -121,6 +120,17 @@ void AlertRequest::Run() { } } +void AlertRequest::OnTimeOut() { + SDL_LOG_AUTO_TRACE(); + if (!(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + RequestFromMobileImpl::OnTimeOut(); + return; + } + SDL_LOG_INFO( + "Default timeout ignored. " + "AlertRequest with soft buttons wait timeout on HMI side"); +} + void AlertRequest::on_event(const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); const smart_objects::SmartObject& message = event.smart_object(); @@ -175,9 +185,11 @@ void AlertRequest::on_event(const event_engine::Event& event) { } } - if (HasHmiResponsesToWait()) { + if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command is still waiting for HMI response"); return; } + mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; std::string info; const bool result = PrepareResponseParameters(result_code, info); @@ -443,7 +455,7 @@ bool AlertRequest::CheckStrings() { return true; } -bool AlertRequest::HasHmiResponsesToWait() { +bool AlertRequest::IsPendingResponseExist() { SDL_LOG_AUTO_TRACE(); return awaiting_ui_alert_response_ || awaiting_tts_speak_response_ || awaiting_tts_stop_speaking_response_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc index 27020f2719..53511cb83f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc @@ -49,11 +49,11 @@ CancelInteractionRequest::CancelInteractionRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CancelInteractionRequest::~CancelInteractionRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc index 13a57cf9a8..47ff7cbea1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc @@ -32,8 +32,11 @@ */ #include "sdl_rpc_plugin/commands/mobile/change_registration_request.h" + #include + #include + #include "application_manager/application_impl.h" #include "application_manager/application_manager.h" #include "application_manager/message_helper.h" @@ -44,14 +47,14 @@ namespace { namespace custom_str = utils::custom_string; struct IsSameNickname { - explicit IsSameNickname(const custom_str::CustomString& app_id) - : app_id_(app_id) {} + explicit IsSameNickname(const custom_str::CustomString& app_name) + : app_name(app_name) {} bool operator()(const policy::StringArray::value_type& nickname) const { - return app_id_.CompareIgnoreCase(nickname.c_str()); + return app_name.CompareIgnoreCase(nickname.c_str()); } private: - const custom_str::CustomString app_id_; + const custom_str::CustomString& app_name; }; } // namespace @@ -68,11 +71,11 @@ ChangeRegistrationRequest::ChangeRegistrationRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -83,7 +86,6 @@ void ChangeRegistrationRequest::SendVRRequest( ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); auto function = hmi_apis::FunctionID::VR_ChangeRegistration; - pending_requests_.Add(function); smart_objects::SmartObject vr_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -102,7 +104,6 @@ void ChangeRegistrationRequest::SendTTSRequest( ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); auto function = hmi_apis::FunctionID::TTS_ChangeRegistration; - pending_requests_.Add(function); smart_objects::SmartObject tts_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -124,7 +125,6 @@ void ChangeRegistrationRequest::SendUIRequest( const int32_t hmi_language) { const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); auto function = hmi_apis::FunctionID::UI_ChangeRegistration; - pending_requests_.Add(function); // UI processing smart_objects::SmartObject ui_params = smart_objects::SmartObject(smart_objects::SmartType_Map); @@ -231,17 +231,22 @@ void ChangeRegistrationRequest::Run() { return; } if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != vr_state) { - // VR processing - SendVRRequest(app, msg_params); + StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_VR); } if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != tts_state) { - // TTS processing - SendTTSRequest(app, msg_params); + StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS); } if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != ui_state) { SendUIRequest(app, msg_params, hmi_language); } + + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) { + SendTTSRequest(app, msg_params); + } + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { + SendVRRequest(app, msg_params); + } } void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { @@ -254,7 +259,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_ChangeRegistration: { SDL_LOG_INFO("Received UI_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - pending_requests_.Remove(event_id); ui_result_ = static_cast( message[strings::params][hmi_response::code].asInt()); GetInfo(message, ui_response_info_); @@ -263,7 +267,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::VR_ChangeRegistration: { SDL_LOG_INFO("Received VR_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - pending_requests_.Remove(event_id); vr_result_ = static_cast( message[strings::params][hmi_response::code].asInt()); GetInfo(message, vr_response_info_); @@ -272,7 +275,6 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_ChangeRegistration: { SDL_LOG_INFO("Received TTS_ChangeRegistration event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); - pending_requests_.Remove(event_id); tts_result_ = static_cast( message[strings::params][hmi_response::code].asInt()); GetInfo(message, tts_response_info_); @@ -284,43 +286,39 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { } } - if (pending_requests_.IsFinal(event_id)) { - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - - if (!application) { - SDL_LOG_ERROR("NULL pointer"); - return; - } + if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command still wating for HMI response"); + return; + } - if (hmi_apis::Common_Result::SUCCESS == ui_result_) { - application->set_ui_language(static_cast( - (*message_)[strings::msg_params][strings::hmi_display_language] - .asInt())); - } + ApplicationSharedPtr application = + application_manager_.application(connection_key()); - if (hmi_apis::Common_Result::SUCCESS == vr_result_ || - hmi_apis::Common_Result::SUCCESS == tts_result_) { - application->set_language(static_cast( - (*message_)[strings::msg_params][strings::language].asInt())); - } - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - std::string response_info; - const bool result = PrepareResponseParameters(result_code, response_info); + if (!application) { + SDL_LOG_ERROR("NULL pointer"); + return; + } - (*message_)[strings::params][strings::function_id] = - mobile_apis::FunctionID::eType::ChangeRegistrationID; + if (hmi_apis::Common_Result::SUCCESS == ui_result_) { + application->set_ui_language(static_cast( + (*message_)[strings::msg_params][strings::hmi_display_language] + .asInt())); + } - SendResponse(result, - result_code, - response_info.empty() ? NULL : response_info.c_str(), - &(message[strings::msg_params])); - } else { - SDL_LOG_INFO( - "There are some pending responses from HMI." - "ChangeRegistrationRequest still waiting."); + if (hmi_apis::Common_Result::SUCCESS == vr_result_ || + hmi_apis::Common_Result::SUCCESS == tts_result_) { + application->set_language(static_cast( + (*message_)[strings::msg_params][strings::language].asInt())); } -} + + mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; + std::string response_info; + const bool result = PrepareResponseParameters(result_code, response_info); + SendResponse(result, + result_code, + response_info.empty() ? NULL : response_info.c_str(), + &(message[strings::msg_params])); +} // namespace commands namespace { void CheckInfo(std::string& str) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc index b4a09844f2..5154ace4ee 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc @@ -47,11 +47,11 @@ CloseApplicationRequest::CloseApplicationRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CloseApplicationRequest::~CloseApplicationRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 2f624efe76..98e26e1aa9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -32,6 +32,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h" + #include #include #include @@ -58,17 +59,16 @@ CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , choice_set_id_(0) , expected_chs_count_(0) , received_chs_count_(0) , should_send_warnings_(false) - , error_from_hmi_(false) - , is_timed_out_(false) {} + , error_from_hmi_(false) {} CreateInteractionChoiceSetRequest::~CreateInteractionChoiceSetRequest() { SDL_LOG_AUTO_TRACE(); @@ -406,13 +406,13 @@ void CreateInteractionChoiceSetRequest::on_event( } } -void CreateInteractionChoiceSetRequest::onTimeOut() { +void CreateInteractionChoiceSetRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); if (!error_from_hmi_) { - SendResponse(false, mobile_apis::Result::GENERIC_ERROR); + RequestFromMobileImpl::OnTimeOut(); } - CommandRequestImpl::onTimeOut(); + DeleteChoices(); auto& resume_ctrl = application_manager_.resume_controller(); @@ -421,10 +421,6 @@ void CreateInteractionChoiceSetRequest::onTimeOut() { correlation_id(), static_cast(function_id())); - // We have to keep request alive until receive all responses from HMI - // according to SDLAQ-CRS-2976 - sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_); - is_timed_out_ = true; application_manager_.TerminateRequest( connection_key(), correlation_id(), function_id()); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc index 8febbf4f60..81b8985cd5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc @@ -53,11 +53,11 @@ CreateWindowRequest::CreateWindowRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} CreateWindowRequest::~CreateWindowRequest() {} @@ -214,7 +214,7 @@ void CreateWindowRequest::on_event(const event_engine::Event& event) { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); const smart_objects::SmartObject& response_message = event.smart_object(); - const auto result_code = CommandRequestImpl::GetMobileResultCode( + const auto result_code = RequestFromMobileImpl::GetMobileResultCode( static_cast( response_message[strings::params][hmi_response::code].asInt())); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc index 358a002606..dead764811 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc @@ -52,15 +52,11 @@ DeleteCommandRequest::DeleteCommandRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) - , is_ui_send_(false) - , is_vr_send_(false) - , is_ui_received_(false) - , is_vr_received_(false) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -99,17 +95,11 @@ void DeleteCommandRequest::Run() { /* Need to set all flags before sending request to HMI * for correct processing this flags in method on_event */ if (command.keyExists(strings::menu_params)) { - is_ui_send_ = true; - } - // check vr params - if (command.keyExists(strings::vr_commands)) { - is_vr_send_ = true; - } - if (is_ui_send_) { StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params, true); } - if (is_vr_send_) { + // check vr params + if (command.keyExists(strings::vr_commands)) { // VR params msg_params[strings::grammar_id] = application->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; @@ -151,7 +141,6 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_DeleteCommand: { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - is_ui_received_ = true; ui_result_ = static_cast( message[strings::params][hmi_response::code].asInt()); SDL_LOG_DEBUG("Received UI_DeleteCommand event with result " @@ -161,7 +150,6 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::VR_DeleteCommand: { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - is_vr_received_ = true; vr_result_ = static_cast( message[strings::params][hmi_response::code].asInt()); SDL_LOG_DEBUG("Received VR_DeleteCommand event with result " @@ -216,11 +204,6 @@ bool DeleteCommandRequest::Init() { return true; } -bool DeleteCommandRequest::IsPendingResponseExist() { - SDL_LOG_AUTO_TRACE(); - return is_ui_send_ != is_ui_received_ || is_vr_send_ != is_vr_received_; -} - } // namespace commands } // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc index 127843813c..268d1fa0cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc @@ -50,11 +50,11 @@ DeleteFileRequest::DeleteFileRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} DeleteFileRequest::~DeleteFileRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc index b675042d16..eac43bb22b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -51,11 +51,11 @@ DeleteInteractionChoiceSetRequest::DeleteInteractionChoiceSetRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , response_result_codes_() {} DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {} @@ -130,11 +130,6 @@ void DeleteInteractionChoiceSetRequest::on_event( } } -void DeleteInteractionChoiceSetRequest::onTimeOut() { - SDL_LOG_AUTO_TRACE(); - SendResponse(false, mobile_apis::Result::GENERIC_ERROR); -} - bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse( ApplicationConstSharedPtr app) { SDL_LOG_AUTO_TRACE(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc index 09346dc20a..aa16c9b218 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc @@ -52,11 +52,11 @@ DeleteSubMenuRequest::DeleteSubMenuRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , requests_list_() , pending_request_corr_id_(0) {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc index 6f36f99c6c..73fa7f4774 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc @@ -47,11 +47,11 @@ DeleteWindowRequest::DeleteWindowRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} DeleteWindowRequest::~DeleteWindowRequest() {} @@ -130,7 +130,7 @@ void DeleteWindowRequest::on_event(const event_engine::Event& event) { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); const smart_objects::SmartObject& response_message = event.smart_object(); - const auto result_code = CommandRequestImpl::GetMobileResultCode( + const auto result_code = RequestFromMobileImpl::GetMobileResultCode( static_cast( response_message[strings::params][hmi_response::code].asInt())); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc index f0ef2e0028..c14eb02dae 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/dial_number_request.cc @@ -49,11 +49,11 @@ DialNumberRequest::DialNumberRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} DialNumberRequest::~DialNumberRequest() {} @@ -118,7 +118,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::BasicCommunication_DialNumber: { SDL_LOG_INFO("Received DialNumber event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); - result_code = CommandRequestImpl::GetMobileResultCode( + result_code = RequestFromMobileImpl::GetMobileResultCode( static_cast( message[strings::params][hmi_response::code].asInt())); break; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc index f5506503e9..00e75b0c26 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/end_audio_pass_thru_request.cc @@ -47,11 +47,11 @@ EndAudioPassThruRequest::EndAudioPassThruRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} EndAudioPassThruRequest::~EndAudioPassThruRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc index 585636bfa8..93da86f2be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_cloud_app_properties_request.cc @@ -14,11 +14,11 @@ GetCloudAppPropertiesRequest::GetCloudAppPropertiesRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} GetCloudAppPropertiesRequest::~GetCloudAppPropertiesRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc index 620d901f3c..d9a592adfd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_file_request.cc @@ -67,11 +67,11 @@ GetFileRequest::GetFileRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , file_name_("") , file_type_(mobile_apis::FileType::INVALID_ENUM) , length_(0) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc index 64eae885a8..b044556f64 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc @@ -50,11 +50,11 @@ GetSystemCapabilityRequest::GetSystemCapabilityRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} GetSystemCapabilityRequest::~GetSystemCapabilityRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc index 9e156bf755..e371889574 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_way_points_request.cc @@ -31,6 +31,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/get_way_points_request.h" + #include "application_manager/application_manager.h" #include "application_manager/message_helper.h" @@ -47,11 +48,11 @@ GetWayPointsRequest::GetWayPointsRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} GetWayPointsRequest::~GetWayPointsRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc index 9262466e34..9ab636aaf5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc @@ -52,11 +52,11 @@ ListFilesRequest::ListFilesRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} ListFilesRequest::~ListFilesRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc index 74b474f76b..a690c0bc9b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -32,6 +32,7 @@ */ #include "sdl_rpc_plugin/commands/mobile/perform_audio_pass_thru_request.h" + #include #include "application_manager/application_impl.h" @@ -53,21 +54,21 @@ PerformAudioPassThruRequest::PerformAudioPassThruRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , result_tts_speak_(hmi_apis::Common_Result::INVALID_ENUM) , result_ui_(hmi_apis::Common_Result::INVALID_ENUM) {} PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {} -void PerformAudioPassThruRequest::onTimeOut() { +void PerformAudioPassThruRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); FinishTTSSpeak(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); } bool PerformAudioPassThruRequest::Init() { @@ -192,7 +193,8 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { return; } } - if (IsWaitingHMIResponse()) { + if (IsPendingResponseExist()) { + SDL_LOG_DEBUG("Command still wating for HMI response"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc index da1f744689..bf0f05ba32 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc @@ -68,16 +68,14 @@ PerformInteractionRequest::PerformInteractionRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM) , ui_choice_id_received_(INVALID_CHOICE_ID) , vr_choice_id_received_(INVALID_CHOICE_ID) - , ui_response_received_(false) - , vr_response_received_(false) , app_pi_was_active_before_(false) , vr_result_code_(hmi_apis::Common_Result::INVALID_ENUM) , ui_result_code_(hmi_apis::Common_Result::INVALID_ENUM) { @@ -226,6 +224,10 @@ void PerformInteractionRequest::Run() { app->set_perform_interaction_layout(interaction_layout); // increment amount of active requests ++pi_requests_count_; + + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); + SendVRPerformInteractionRequest(app); SendUIPerformInteractionRequest(app); } @@ -238,7 +240,6 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_PerformInteraction: { SDL_LOG_DEBUG("Received UI_PerformInteraction event"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); - ui_response_received_ = true; unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); ui_result_code_ = static_cast( @@ -250,7 +251,6 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::VR_PerformInteraction: { SDL_LOG_DEBUG("Received VR_PerformInteraction"); EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); - vr_response_received_ = true; unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction); vr_result_code_ = static_cast( @@ -281,19 +281,20 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { } } -void PerformInteractionRequest::onTimeOut() { +void PerformInteractionRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); switch (interaction_mode_) { case mobile_apis::InteractionMode::BOTH: { SDL_LOG_DEBUG("Interaction Mode: BOTH"); - if (true == vr_response_received_) { + if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) { unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); } else { application_manager_.UpdateRequestTimeout( connection_key(), correlation_id(), default_timeout_); + set_current_state(RequestState::kAwaitingResponse); } break; } @@ -301,14 +302,14 @@ void PerformInteractionRequest::onTimeOut() { SDL_LOG_DEBUG("Interaction Mode: VR_ONLY"); unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); break; } case mobile_apis::InteractionMode::MANUAL_ONLY: { SDL_LOG_DEBUG("InteractionMode: MANUAL_ONLY"); unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); DisablePerformInteraction(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); break; } default: { @@ -352,7 +353,7 @@ bool PerformInteractionRequest::ProcessVRResponse( return false; } - if (!ui_response_received_ && + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) && InteractionMode::MANUAL_ONLY != interaction_mode_) { SendClosePopupRequestToHMI(); } @@ -990,7 +991,8 @@ bool PerformInteractionRequest::CheckChoiceIDFromRequest( const bool PerformInteractionRequest::HasHMIResponsesToWait() const { SDL_LOG_AUTO_TRACE(); - return !ui_response_received_ || !vr_response_received_; + return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) || + IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR); } void PerformInteractionRequest::SendBothModeResponse( @@ -1055,8 +1057,8 @@ PerformInteractionRequest::PrepareResultCodeForResponse( return mobile_ui_result_code; } - return CommandRequestImpl::PrepareResultCodeForResponse(ui_response, - vr_response); + return RequestFromMobileImpl::PrepareResultCodeForResponse(ui_response, + vr_response); } bool PerformInteractionRequest::PrepareResultForMobileResponse( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc index 5263991716..1db62f0669 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc @@ -69,11 +69,11 @@ PutFileRequest::PutFileRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , offset_(0) , sync_file_name_() , length_(0) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 53820eccbb..2224f17c4e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -134,11 +134,11 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , are_tts_chunks_invalid_(false) , are_hmi_types_invalid_(false) , is_resumption_failed_(false) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc index dd5e3d3e88..92c5d19a05 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc @@ -35,7 +35,6 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" - #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" @@ -52,11 +51,11 @@ ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) , rc_result_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -218,12 +217,6 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters( return result; } -bool ResetGlobalPropertiesRequest::IsPendingResponseExist() { - return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) || - IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) || - IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_RC); -} - } // namespace commands } // namespace sdl_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc index 7cfe5f5414..573c340201 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc @@ -54,11 +54,11 @@ ScrollableMessageRequest::ScrollableMessageRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} ScrollableMessageRequest::~ScrollableMessageRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc index 2b0a36cb9d..b5e629320a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_haptic_data_request.cc @@ -48,11 +48,11 @@ SendHapticDataRequest::SendHapticDataRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SendHapticDataRequest::~SendHapticDataRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc index fcc898b348..7cf226c968 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/send_location_request.cc @@ -48,11 +48,11 @@ SendLocationRequest::SendLocationRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SendLocationRequest::~SendLocationRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc index 9eb4c82721..8eb3b9e1ec 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc @@ -54,11 +54,11 @@ SetAppIconRequest::SetAppIconRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , is_icons_saving_enabled_(false) { const std::string path = application_manager_.get_settings().app_icons_folder(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc index 45ff0078fb..98cae4856f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_cloud_app_properties_request.cc @@ -15,11 +15,11 @@ SetCloudAppPropertiesRequest::SetCloudAppPropertiesRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SetCloudAppPropertiesRequest::~SetCloudAppPropertiesRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc index b2ca3e6cfa..ba0a20b459 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc @@ -49,11 +49,11 @@ SetDisplayLayoutRequest::SetDisplayLayoutRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SetDisplayLayoutRequest::~SetDisplayLayoutRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc index 0aab000376..b8f1e3d70f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc @@ -73,11 +73,11 @@ SetGlobalPropertiesRequest::SetGlobalPropertiesRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , is_ui_send_(false) , is_tts_send_(false) , is_rc_send_(false) @@ -426,10 +426,10 @@ bool SetGlobalPropertiesRequest::Init() { return true; } -void SetGlobalPropertiesRequest::onTimeOut() { +void SetGlobalPropertiesRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); - CommandRequestImpl::onTimeOut(); + RequestFromMobileImpl::OnTimeOut(); auto& resume_ctrl = application_manager_.resume_controller(); @@ -455,7 +455,7 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters( bool result = false; if (!is_rc_send_) { - result = CommandRequestImpl::PrepareResultForMobileResponse( + result = RequestFromMobileImpl::PrepareResultForMobileResponse( ui_properties_info, tts_properties_info); } else { result = PrepareResultForMobileResponse( @@ -476,7 +476,7 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters( } if (!is_rc_send_) { - result_code = CommandRequestImpl::PrepareResultCodeForResponse( + result_code = RequestFromMobileImpl::PrepareResultCodeForResponse( ui_properties_info, tts_properties_info); } else { result_code = PrepareResultCodeForResponse( @@ -517,8 +517,9 @@ bool SetGlobalPropertiesRequest::PrepareResultForMobileResponse( (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == first.result_code) || (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == second.result_code); - const bool final_result = CommandRequestImpl::CheckResult(both_info, third) || - CommandRequestImpl::CheckResult(third, both_info); + const bool final_result = + RequestFromMobileImpl::CheckResultCode(both_info, third) || + RequestFromMobileImpl::CheckResultCode(third, both_info); return final_result; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc index 285118749a..b2c9f46940 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_media_clock_timer_request.cc @@ -52,11 +52,11 @@ SetMediaClockRequest::SetMediaClockRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SetMediaClockRequest::~SetMediaClockRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc index fdcf9d2434..4f7a46d1e7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc @@ -47,11 +47,11 @@ ShowAppMenuRequest::ShowAppMenuRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} ShowAppMenuRequest::~ShowAppMenuRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc index e8dbe579c5..6e21861e0a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_constant_tbt_request.cc @@ -54,11 +54,11 @@ ShowConstantTBTRequest::ShowConstantTBTRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} ShowConstantTBTRequest::~ShowConstantTBTRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc index 910ab9ef23..7b7518f4d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc @@ -52,11 +52,11 @@ ShowRequest::ShowRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , core_result_code_(mobile_apis::Result::INVALID_ENUM) , current_window_id_(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) , template_config_(smart_objects::SmartType::SmartType_Null) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc index 0fdc412572..fb332970ab 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc @@ -51,11 +51,11 @@ SliderRequest::SliderRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SliderRequest::~SliderRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc index f8307f8355..593faf795e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/speak_request.cc @@ -36,6 +36,7 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" +#include "interfaces/HMI_API.h" #include "utils/helpers.h" namespace sdl_rpc_plugin { @@ -51,11 +52,11 @@ SpeakRequest::SpeakRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SpeakRequest::~SpeakRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc index 723a1ececa..da48f193e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc @@ -50,11 +50,11 @@ SubscribeButtonRequest::SubscribeButtonRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SubscribeButtonRequest::~SubscribeButtonRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc index 11cbdac14a..da9a6e2adc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_way_points_request.cc @@ -49,11 +49,11 @@ SubscribeWayPointsRequest::SubscribeWayPointsRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SubscribeWayPointsRequest::~SubscribeWayPointsRequest() {} @@ -121,7 +121,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { } } -void SubscribeWayPointsRequest::onTimeOut() { +void SubscribeWayPointsRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); if (application_manager_.GetAppServiceManager().FindWayPointsHandler() != nullptr) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc index 8491a859e6..eba1abd3ff 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subtle_alert_request.cc @@ -48,11 +48,11 @@ SubtleAlertRequest::SubtleAlertRequest( rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) , awaiting_ui_subtle_alert_response_(false) , awaiting_tts_speak_response_(false) , awaiting_tts_stop_speaking_response_(false) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc index 518c256d94..10be518409 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc @@ -411,11 +411,11 @@ SystemRequest::SystemRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} SystemRequest::~SystemRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc index 09de35773a..74eec08c46 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_button_request.cc @@ -52,11 +52,11 @@ UnsubscribeButtonRequest::UnsubscribeButtonRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} UnsubscribeButtonRequest::~UnsubscribeButtonRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc index 7aa6e2b40a..c715612ba5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/unsubscribe_way_points_request.cc @@ -49,11 +49,11 @@ UnsubscribeWayPointsRequest::UnsubscribeWayPointsRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} UnsubscribeWayPointsRequest::~UnsubscribeWayPointsRequest() {} @@ -127,7 +127,7 @@ void UnsubscribeWayPointsRequest::on_event(const event_engine::Event& event) { } } -void UnsubscribeWayPointsRequest::onTimeOut() { +void UnsubscribeWayPointsRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); if (application_manager_.GetAppServiceManager().FindWayPointsHandler() != nullptr) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc index 3da9206184..3fbaad77b0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/update_turn_list_request.cc @@ -56,11 +56,11 @@ UpdateTurnListRequest::UpdateTurnListRequest( app_mngr::rpc_service::RPCService& rpc_service, app_mngr::HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : RequestFromMobileImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} UpdateTurnListRequest::~UpdateTurnListRequest() {} diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc index af6c7f3c1d..5c0a0d746b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_pending_resumption_handler.cc @@ -140,7 +140,7 @@ void WayPointsPendingResumptionHandler::RaiseFakeSuccessfulResponse( event.raise(application_manager_.event_dispatcher()); } -void WayPointsPendingResumptionHandler::on_event( +void WayPointsPendingResumptionHandler::HandleOnEvent( const application_manager::event_engine::Event& event) { using namespace application_manager; SDL_LOG_AUTO_TRACE(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc index 7dadad59fe..e841b4ae81 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc @@ -97,6 +97,8 @@ TEST_F(ActivateAppRequestTest, Run_SUCCESS) { (*msg)[strings::msg_params][strings::activate_app_hmi_level] = mobile_apis::HMILevel::HMI_FULL; #endif + InitEventDispatcher(); + ActivateAppRequestPtr command(CreateCommand(msg)); EXPECT_CALL(app_mngr_, set_application_id(kCorrelationId, kAppId)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc index 9cd87b053d..751eb84e53 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc @@ -62,7 +62,7 @@ TEST_F(BasicCommunicationGetSystemTimeRequestTest, OnTimeout) { .WillByDefault(ReturnRef(mock_protocol_handler)); EXPECT_CALL(mock_protocol_handler, NotifyOnGetSystemTimeFailed()); - command->onTimeOut(); + command->OnTimeOut(); } } // namespace basic_communication_get_system_time_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc index f3d8dd4f93..81a105f8e8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_request_test.cc @@ -75,6 +75,9 @@ class ButtonGetCapabilitiesRequestTest TEST_F(ButtonGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + + InitEventDispatcher(); + RequestToHMIPtr command( CreateCommand(command_msg)); @@ -92,6 +95,9 @@ TEST_F(ButtonGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(ButtonGetCapabilitiesRequestTest, onTimeOut_ButtonsGetCapabilitiesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + + InitEventDispatcher(); + RequestToHMIPtr command( CreateCommand(command_msg)); @@ -101,7 +107,7 @@ TEST_F(ButtonGetCapabilitiesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc index 5b860499dd..0fa2edd9c3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc @@ -71,6 +71,8 @@ TEST_F(GetSystemInfoRequestTest, RUN_SendRequest_SUCCESS) { (*command_msg)[strings::params][strings::connection_key] = kConnectionKey; (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId; + InitEventDispatcher(); + RequestToHMIPtr command(CreateCommand(command_msg)); const uint32_t kAppId = command->application_id(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc index 64bf167f83..babfb71756 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc @@ -70,6 +70,8 @@ TEST_F(MixingAudioSupportedRequestTest, RUN_SendRequest_SUCCESS) { (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; + InitEventDispatcher(); + RequestToHMIPtr command( CreateCommand(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc index 7ce3a353e9..9bf5257676 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc @@ -199,7 +199,7 @@ TEST_F(NaviSetVideoConfigRequestTest, OnTimeout) { EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)).Times(1); - command->onTimeOut(); + command->OnTimeOut(); } } // namespace navi_set_video_config_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc index f7da89df0b..56a6cd2e2f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_request_test.cc @@ -73,6 +73,8 @@ TEST_F(RCGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; + InitEventDispatcher(); + RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); ASSERT_TRUE(command->Init()); @@ -88,6 +90,7 @@ TEST_F(RCGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(RCGetCapabilitiesRequestTest, onTimeOut_OnCapabilityInitialized_RemoveRCGetCapabilities) { MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -96,7 +99,7 @@ TEST_F(RCGetCapabilitiesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); } } // namespace rc_get_capabilities_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc index cb90859018..f4e3784642 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc @@ -217,7 +217,7 @@ TEST_F(RCIsReadyRequestTest, Run_ErrorMessage_StateNotAvailable) { TEST_F(RCIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) { HMICapabilitiesExpectations(); ExpectSendMessagesToHMI(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace rc_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index a2dc705f60..443050b47f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -59,6 +59,7 @@ namespace hmi_response = am::hmi_response; using am::ApplicationSet; using am::commands::MessageSharedPtr; using am::event_engine::Event; +using application_manager::event_engine::EventObserver; using connection_handler_test::MockConnectionHandler; using policy_test::MockPolicyHandlerInterface; using sdl_rpc_plugin::commands::SDLActivateAppRequest; @@ -504,10 +505,11 @@ TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) { std::shared_ptr command( CreateCommand(msg)); - ON_CALL(mock_event_dispatcher_, remove_observer(_, _)); + ON_CALL(mock_event_dispatcher_, + remove_observer(_, testing::Matcher(_))); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); - command->onTimeOut(); + command->OnTimeOut(); } TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidEventId_UNSUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc index 21260250ae..482ca93f3e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc @@ -114,6 +114,7 @@ using event_engine_test::MockEventDispatcher; class RequestToHMITest : public CommandsTest {}; TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) { + InitEventDispatcher(); std::shared_ptr command( CreateCommand()); @@ -124,6 +125,8 @@ TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) { } TEST_F(RequestToHMITest, SendRequest_SUCCESS) { + InitEventDispatcher(); + std::shared_ptr command( CreateCommand()); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(NotNull())); @@ -222,6 +225,8 @@ TYPED_TEST_CASE(RequestToHMICommandsTest3, RequestCommandsList3); TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; + this->InitEventDispatcher(); + std::shared_ptr command = this->template CreateCommand(); @@ -233,6 +238,8 @@ TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; + this->InitEventDispatcher(); + std::shared_ptr command = this->template CreateCommand(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull())); @@ -243,6 +250,8 @@ TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) { TYPED_TEST(RequestToHMICommandsTest3, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; + EXPECT_CALL(this->event_dispatcher_, remove_observer(_)); + std::shared_ptr command = this->template CreateCommand(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull())); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc index d339a4acf8..61214d64a3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc @@ -141,7 +141,7 @@ TEST_F(HMISubscribeButtonRequestTest, .WillByDefault(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(kCorrelationId, kFunctionID)); - command->onTimeOut(); + command->OnTimeOut(); } TEST_F(HMISubscribeButtonRequestTest, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc index bae6b6082e..b3ba2d30a9 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_request_test.cc @@ -77,6 +77,7 @@ class TTSGetCapabilitiesRequestTest TEST_F(TTSGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand(command_msg)); @@ -93,6 +94,7 @@ TEST_F(TTSGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(TTSGetCapabilitiesRequestTest, onTimeOut_TTSGetCapabilitiesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand(command_msg)); @@ -102,7 +104,7 @@ TEST_F(TTSGetCapabilitiesRequestTest, onTimeOut_TTSGetCapabilitiesUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc index a0bf0887db..275f4a18ff 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_request_test.cc @@ -77,6 +77,7 @@ class TTSGetLanguageRequestTest TEST_F(TTSGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(TTSGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(TTSGetLanguageRequestTest, onTimeOut_TTSGetLanguageUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(TTSGetLanguageRequestTest, onTimeOut_TTSGetLanguageUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc index 1561e1def5..373d217ee6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_request_test.cc @@ -77,6 +77,7 @@ class TTSGetSupportedLanguagesRequestTest TEST_F(TTSGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand(command_msg)); @@ -94,6 +95,7 @@ TEST_F(TTSGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(TTSGetSupportedLanguagesRequestTest, onTimeOut_TTSGetSupportedLanguagesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand(command_msg)); @@ -103,7 +105,7 @@ TEST_F(TTSGetSupportedLanguagesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc index e758bfca1f..3428cc8923 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_request_test.cc @@ -242,7 +242,7 @@ TEST_F(TTSIsReadyRequestTest, ASSERT_TRUE(command_->Init()); command_->Run(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace tts_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc index 1057a89cc6..ca568ba630 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_request_test.cc @@ -77,6 +77,7 @@ class UIGetCapabilitiesRequestTest TEST_F(UIGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(UIGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(UIGetCapabilitiesRequestTest, onTimeOut_UIGetCapabilitiesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(UIGetCapabilitiesRequestTest, onTimeOut_UIGetCapabilitiesUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc index c944f1b49b..6cdcd6eb00 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_request_test.cc @@ -77,6 +77,7 @@ class UIGetLanguageRequestTest TEST_F(UIGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(UIGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(UIGetLanguageRequestTest, onTimeOut_UIGetLanguageUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(UIGetLanguageRequestTest, onTimeOut_UIGetLanguageUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc index 251b6b7d58..69d0f6d117 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_request_test.cc @@ -77,6 +77,7 @@ class UIGetSupportedLanguagesRequestTest TEST_F(UIGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand(command_msg)); @@ -94,6 +95,7 @@ TEST_F(UIGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(UIGetSupportedLanguagesRequestTest, onTimeOut_UIGetSupportedLanguagesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand(command_msg)); @@ -103,7 +105,7 @@ TEST_F(UIGetSupportedLanguagesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc index a82ad39d83..4db9f5cf62 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc @@ -208,7 +208,7 @@ TEST_F(UIIsReadyRequestTest, TEST_F(UIIsReadyRequestTest, OnTimeout_SUCCESS_CacheIsAbsent) { HMICapabilitiesExpectations(); ExpectSendMessagesToHMI(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace ui_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc index 3236987d14..434738a2e1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc @@ -112,7 +112,7 @@ TEST_F(HMIUnsubscribeButtonRequestTest, .WillByDefault(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); - command->onTimeOut(); + command->OnTimeOut(); } TEST_F(HMIUnsubscribeButtonRequestTest, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc index 9760462d05..0c95013964 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc @@ -64,6 +64,7 @@ namespace strings = am::strings; namespace hmi_response = am::hmi_response; using am::commands::CommandImpl; using am::event_engine::Event; +using application_manager::event_engine::EventObserver; using sdl_rpc_plugin::commands::UpdateDeviceListRequest; typedef std::shared_ptr UpdateDeviceListRequestPtr; @@ -90,6 +91,8 @@ class UpdateDeviceListRequestTest }; TEST_F(UpdateDeviceListRequestTest, RUN_LaunchHMIReturnsFalse) { + InitEventDispatcher(); + MessageSharedPtr command_msg = CreateCommandMsg(); UpdateDeviceListRequestPtr command( @@ -111,6 +114,8 @@ TEST_F(UpdateDeviceListRequestTest, RUN_LaunchHMIReturnsFalse) { } TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsTrue_SUCCESS) { + InitEventDispatcher(); + MessageSharedPtr command_msg = CreateCommandMsg(); UpdateDeviceListRequestPtr command( @@ -132,6 +137,8 @@ TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsTrue_SUCCESS) { } TEST_F(UpdateDeviceListRequestTest, RUN_HMICooperatingReturnsFalse_UNSUCCESS) { + InitEventDispatcher(); + MessageSharedPtr command_msg = CreateCommandMsg(); UpdateDeviceListRequestPtr command( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc index 92e3fa1187..b6aa134dfc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc @@ -69,6 +69,8 @@ TEST_F(UpdateSDLRequestTest, RUN_SUCCESS) { (*command_msg)[strings::params][strings::connection_key] = kConnectionKey; (*command_msg)[strings::params][strings::correlation_id] = kCorrelationId; + InitEventDispatcher(); + UpdateSDLRequestPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_policy_handler_, PTExchangeAtUserRequest(kCorrelationId)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc index cef87f06b4..2933b6aa44 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_request_test.cc @@ -77,6 +77,7 @@ class VRGetCapabilitiesRequestTest TEST_F(VRGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(VRGetCapabilitiesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(VRGetCapabilitiesRequestTest, onTimeOut_VRGetCapabilitiesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(VRGetCapabilitiesRequestTest, onTimeOut_VRGetCapabilitiesUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc index 6235b41691..fffc56b979 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_request_test.cc @@ -77,6 +77,7 @@ class VRGetLanguageRequestTest TEST_F(VRGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -92,6 +93,7 @@ TEST_F(VRGetLanguageRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(VRGetLanguageRequestTest, onTimeOut_VRGetLanguageUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command(CreateCommand(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, @@ -100,7 +102,7 @@ TEST_F(VRGetLanguageRequestTest, onTimeOut_VRGetLanguageUpdated) { ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc index 73657528e9..af2faa12e6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_request_test.cc @@ -77,7 +77,7 @@ class VRGetSupportedLanguagesRequestTest TEST_F(VRGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); - + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand(command_msg)); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); @@ -94,6 +94,7 @@ TEST_F(VRGetSupportedLanguagesRequestTest, RUN_SendRequest_SUCCESS) { TEST_F(VRGetSupportedLanguagesRequestTest, onTimeOut_VRGetSupportedLanguagesUpdated) { MessageSharedPtr command_msg = CreateCommandMsg(); + InitEventDispatcher(); RequestToHMIPtr command( CreateCommand(command_msg)); @@ -103,7 +104,7 @@ TEST_F(VRGetSupportedLanguagesRequestTest, ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ(CommandImpl::hmi_protocol_type_, (*command_msg)[strings::params][strings::protocol_type].asInt()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc index 3d2a46707e..ea1b90598e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc @@ -192,7 +192,7 @@ TEST_F(VRIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout_CacheIsAbsent) { HMICapabilitiesExpectations(); ExpectSendMessagesToHMI(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace vr_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc index 93ae813535..b4795dae21 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc @@ -74,6 +74,7 @@ using ::testing::_; using ::testing::InSequence; using ::testing::Return; using namespace smart_objects; +using app_mngr::commands::RequestFromMobileImpl; namespace custom_str = utils::custom_string; namespace strings = ::application_manager::strings; @@ -222,10 +223,9 @@ class AddCommandRequestTest mock_rpc_service_, ManageMobileCommand(response, am::commands::Command::CommandSource::SOURCE_SDL)); - - std::shared_ptr base_class_request = - static_cast >(request_ptr); - base_class_request->onTimeOut(); + std::shared_ptr base_class_request = + static_cast >(request_ptr); + base_class_request->OnTimeOut(); } MessageSharedPtr msg_; @@ -608,22 +608,41 @@ TEST_F(AddCommandRequestTest, OnTimeOut_EXPECT_UI_DeleteCommand) { } TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) { - MessageSharedPtr command_msg = CreateMessage(SmartType_Map); - (*command_msg)[params][connection_key] = kConnectionKey; - MessageSharedPtr event_msg = CreateMessage(SmartType_Map); - (*event_msg)[params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS; - (*event_msg)[msg_params][cmd_id] = kCmdId; + CreateBasicParamsVRRequest(); + CreateBasicParamsUIRequest(); + SmartObject& params = (*msg_)[strings::params]; + params[hmi_response::code] = hmi_apis::Common_Result::WARNINGS; + SmartObject& image = (*msg_)[msg_params][cmd_icon]; + EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _)) + .WillOnce(Return(mobile_apis::Result::SUCCESS)); Event event_ui(hmi_apis::FunctionID::UI_AddCommand); - event_ui.set_smart_object(*event_msg); - + event_ui.set_smart_object(*msg_); Event event_vr(hmi_apis::FunctionID::VR_AddCommand); - event_vr.set_smart_object(*event_msg); + event_vr.set_smart_object(*msg_); + + am::CommandsMap commands_map; + EXPECT_CALL(*mock_app_, commands_map()) + .WillRepeatedly(Return(DataAccessor( + commands_map, lock_ptr_))); + + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand), _)) + .WillOnce(Return(true)); + EXPECT_CALL( + mock_rpc_service_, + ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand), _)) + .WillOnce(Return(true)); + + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandAdded(kCmdId, _, false)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0); std::shared_ptr request_ptr = - CreateCommand(command_msg); + CreateCommand(msg_); request_ptr->Run(); request_ptr->on_event(event_ui); request_ptr->on_event(event_vr); @@ -1097,11 +1116,10 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( response, am::commands::Command::CommandSource::SOURCE_SDL)); - - std::shared_ptr base_class_request = - static_cast >( + std::shared_ptr base_class_request = + static_cast >( CreateCommand(msg_)); - base_class_request->onTimeOut(); + base_class_request->OnTimeOut(); } TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { @@ -1148,10 +1166,9 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( response, am::commands::Command::CommandSource::SOURCE_SDL)); - - std::shared_ptr base_class_request = - static_cast >(request_ptr); - base_class_request->onTimeOut(); + std::shared_ptr base_class_request = + static_cast >(request_ptr); + base_class_request->OnTimeOut(); } } // namespace add_command_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc index 9130fa52a0..233a99a8cd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc @@ -56,6 +56,7 @@ using am::MockMessageHelper; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::event_engine::Event; +using app_mngr::commands::RequestFromMobileImpl; using policy_test::MockPolicyHandlerInterface; using sdl_rpc_plugin::commands::AlertRequest; using ::testing::_; @@ -207,7 +208,7 @@ TEST_F(AlertRequestTest, OnTimeout_GENERIC_ERROR) { ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success] .asBool(), false); @@ -259,13 +260,13 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) { class CallOnTimeOut { public: - CallOnTimeOut(CommandRequestImpl& command) : command_(command) {} + CallOnTimeOut(RequestFromMobileImpl& command) : command_(command) {} void operator()() { - command_.onTimeOut(); + command_.OnTimeOut(); } - CommandRequestImpl& command_; + RequestFromMobileImpl& command_; }; TEST_F(AlertRequestTest, Init_DurationExists_SUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc index d77e0588f8..3f8ac0028b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc @@ -165,11 +165,6 @@ class CreateInteractionChoiceSetResponseTest : public CommandsTest {}; TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) { - MessageSharedPtr msg_vr = CreateMessage(smart_objects::SmartType_Map); - (*msg_vr)[strings::msg_params][strings::result_code] = - am::mobile_api::Result::GENERIC_ERROR; - (*msg_vr)[strings::msg_params][strings::success] = false; - std::shared_ptr req_vr = CreateCommand(); @@ -179,6 +174,8 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) { ON_CALL(*mock_app, get_grammar_id()).WillByDefault(Return(kConnectionKey)); ON_CALL(*mock_app, RemoveCommand(_)).WillByDefault(Return()); + InitNegativeResponse(); + MessageSharedPtr vr_command_result; EXPECT_CALL( @@ -191,7 +188,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) { .WillOnce(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); - req_vr->onTimeOut(); + req_vr->OnTimeOut(); EXPECT_EQ( (*vr_command_result)[strings::msg_params][strings::success].asBool(), false); @@ -706,6 +703,8 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidErrorFromHMI_UNSUCCESS) { EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); + InitNegativeResponse(); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), @@ -716,8 +715,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, .WillOnce(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); - - command_->onTimeOut(); + command_->OnTimeOut(); } TEST_F(CreateInteractionChoiceSetRequestTest, @@ -766,7 +764,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _)); - command_->onTimeOut(); + command_->OnTimeOut(); } TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) { @@ -811,12 +809,13 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(invalid_app)); EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)).Times(0); + resumption_test::MockResumeCtrl mock_resume_ctrl; EXPECT_CALL(app_mngr_, resume_controller()) .WillOnce(ReturnRef(mock_resume_ctrl)); EXPECT_CALL(mock_resume_ctrl, HandleOnTimeOut(_, _)); - command_->onTimeOut(); + command_->OnTimeOut(); } TEST_F(CreateInteractionChoiceSetRequestTest, @@ -871,7 +870,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest, .WillOnce(Return(mock_app_)); EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)); - command_->onTimeOut(); + InitNegativeResponse(); + + command_->OnTimeOut(); } TEST_F(CreateInteractionChoiceSetResponseTest, Run_SuccessFalse_UNSUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc index c7627b7e55..b23e8eefeb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -184,7 +184,7 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) { ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true))); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ((*vr_command_result)[am::strings::msg_params][am::strings::success] .asBool(), false); @@ -732,10 +732,20 @@ TEST_F(PerformAudioPassThruRequestTest, // For setting current_state_ -> kCompleted EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); - command_sptr_->SendResponse(true, am::mobile_api::Result::SUCCESS); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0); - command_sptr_->onTimeOut(); + MessageSharedPtr timeout_response = + CreateMessage(smart_objects::SmartType_Map); + (*timeout_response)[am::strings::msg_params][am::strings::result_code] = + am::mobile_api::Result::GENERIC_ERROR; + (*timeout_response)[am::strings::msg_params][am::strings::success] = false; + + EXPECT_CALL( + mock_message_helper_, + CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR)) + .WillOnce(Return(timeout_response)); + + command_sptr_->OnTimeOut(); } TEST_F(PerformAudioPassThruRequestTest, @@ -806,7 +816,7 @@ TEST_F(PerformAudioPassThruRequestTest, HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking), _)) .WillOnce(Return(false)); - command_sptr_->onTimeOut(); + command_sptr_->OnTimeOut(); } } // namespace perform_audio_pass_thru_request diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc index 193229eeb0..196c83d144 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc @@ -173,6 +173,26 @@ class PerformInteractionRequestTest performinteraction_choice_set_lock_ptr_; }; +class PerformInteractionRequestTestClass : public PerformInteractionRequest { + public: + PerformInteractionRequestTestClass( + const app_mngr::commands::MessageSharedPtr& message, + app_mngr::ApplicationManager& application_manager, + app_mngr::rpc_service::RPCService& rpc_service, + app_mngr::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : PerformInteractionRequest(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} + + void StartAwaitForInterfaces() { + StartAwaitForInterface(am::HmiInterfaces::HMI_INTERFACE_VR); + StartAwaitForInterface(am::HmiInterfaces::HMI_INTERFACE_UI); + } +}; + TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { MessageSharedPtr response_msg_vr = CreateMessage(smart_objects::SmartType_Map); @@ -182,8 +202,8 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { MessageSharedPtr request_msg = CreateMessage(smart_objects::SmartType_Map); (*request_msg)[strings::msg_params][strings::interaction_mode] = mobile_apis::InteractionMode::BOTH; - std::shared_ptr command = - CreateCommand(request_msg); + std::shared_ptr command = + CreateCommand(request_msg); MockAppPtr mock_app; ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); @@ -192,6 +212,7 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { event.set_smart_object(*response_msg_vr); command->Init(); + command->StartAwaitForInterfaces(); command->on_event(event); MessageSharedPtr response_to_mobile = CreateMessage(smart_objects::SmartType_Map); @@ -208,7 +229,7 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true))); - command->onTimeOut(); + command->OnTimeOut(); EXPECT_EQ( (*vr_command_result)[strings::msg_params][strings::success].asBool(), @@ -222,8 +243,8 @@ TEST_F(PerformInteractionRequestTest, OnEvent_BOTHMode_UIChoiceIdReceivedFirst) { MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); @@ -244,6 +265,8 @@ TEST_F(PerformInteractionRequestTest, ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); + command->StartAwaitForInterfaces(); + command->on_event(event_ui); command->on_event(event_vr); @@ -256,8 +279,8 @@ TEST_F(PerformInteractionRequestTest, OnEvent_BOTHMode_VRChoiceIdReceivedFirst) { MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); @@ -278,6 +301,8 @@ TEST_F(PerformInteractionRequestTest, _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true))); + command->StartAwaitForInterfaces(); + command->on_event(event_vr); EXPECT_EQ(hmi_apis::FunctionID::UI_ClosePopUp, (*request_to_hmi)[strings::params][strings::function_id].asInt()); @@ -298,11 +323,13 @@ TEST_F(PerformInteractionRequestTest, OnEvent_VRHmiSendSuccess_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MockAppPtr mock_app; EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app)); @@ -344,11 +371,13 @@ TEST_F(PerformInteractionRequestTest, OnEvent_UIHmiSendSuccess_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MockAppPtr mock_app; EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app)); @@ -387,11 +416,13 @@ TEST_F( MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MockAppPtr mock_app; EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app)); @@ -429,11 +460,13 @@ TEST_F( auto msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, "VR is not supported by system"); @@ -478,11 +511,13 @@ TEST_F( MessageSharedPtr msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessageWithChoiceID( hmi_apis::Common_Result::SUCCESS, "", kVrChoiceID); MessageSharedPtr response_msg_ui = CreateHMIResponseMessageWithChoiceID( @@ -526,11 +561,13 @@ TEST_F( auto msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::VR_ONLY); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage( hmi_apis::Common_Result::WARNINGS, "WARNING MESSAGE"); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); @@ -574,11 +611,13 @@ TEST_F( auto msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, ""); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); @@ -622,11 +661,13 @@ TEST_F( auto msg_from_mobile = CreateRequestMessage(mobile_apis::InteractionMode::BOTH); - std::shared_ptr command = - CreateCommand(msg_from_mobile); + std::shared_ptr command = + CreateCommand(msg_from_mobile); ASSERT_TRUE(command->Init()); + command->StartAwaitForInterfaces(); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage( hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, "VR error message"); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc index f62f6b4682..f1bb7b64ca 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc @@ -440,7 +440,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, ManageMobileCommand( MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), am::commands::Command::SOURCE_SDL)); - command->onTimeOut(); + command->OnTimeOut(); } TEST_F(ResetGlobalPropertiesRequestTest, @@ -507,7 +507,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, ManageMobileCommand( MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), am::commands::Command::SOURCE_SDL)); - command_->onTimeOut(); + command_->OnTimeOut(); } TEST_F(ResetGlobalPropertiesRequestTest, @@ -564,7 +564,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, ManageMobileCommand( MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), am::commands::Command::SOURCE_SDL)); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace reset_global_properties diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc index d9bffc6b4a..e9077cb7f5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc @@ -55,6 +55,7 @@ namespace am = application_manager; using am::MockMessageHelper; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; +using app_mngr::commands::RequestFromMobileImpl; using policy_test::MockPolicyHandlerInterface; using sdl_rpc_plugin::commands::SliderRequest; using ::testing::_; @@ -182,13 +183,13 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { class CallOnTimeOut { public: - CallOnTimeOut(CommandRequestImpl& command) : command_(command) {} + CallOnTimeOut(RequestFromMobileImpl& command) : command_(command) {} void operator()() { - command_.onTimeOut(); + command_.OnTimeOut(); } - CommandRequestImpl& command_; + RequestFromMobileImpl& command_; }; TEST_F(SliderRequestTest, Init_SUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h index 74f12c07d4..2edf9358c4 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_get_vehicle_type_request.h @@ -61,7 +61,7 @@ class VIGetVehicleTypeRequest : public app_mngr::commands::RequestToHMI { void Run() OVERRIDE; - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VIGetVehicleTypeRequest); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h index 96f8c8ecb8..3a835caa5c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_is_ready_request.h @@ -44,8 +44,7 @@ namespace commands { /** * @brief VIIsReadyRequest command class **/ -class VIIsReadyRequest : public app_mngr::commands::RequestToHMI, - public app_mngr::event_engine::EventObserver { +class VIIsReadyRequest : public app_mngr::commands::RequestToHMI { public: /** * @brief VIIsReadyRequest class constructor @@ -73,7 +72,7 @@ class VIIsReadyRequest : public app_mngr::commands::RequestToHMI, /** * @brief onTimeOut from requrst Controller */ - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(VIIsReadyRequest); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h index 7fc84b7986..b066fa9654 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/hmi/vi_subscribe_vehicle_data_request.h @@ -66,7 +66,7 @@ class VISubscribeVehicleDataRequest : public app_mngr::commands::RequestToHMI { **/ virtual void Run(); - void onTimeOut() OVERRIDE; + void OnTimeOut() OVERRIDE; private: CustomVehicleDataManager& custom_vehicle_data_manager_; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h index 56f0e39621..2c78086cfd 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/diagnostic_message_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAGNOSTIC_MESSAGE_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DIAGNOSTIC_MESSAGE_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/vehicle_info_command_params.h" @@ -46,7 +46,8 @@ namespace commands { /** * @brief DiagnosticMessageRequest command class **/ -class DiagnosticMessageRequest : public app_mngr::commands::CommandRequestImpl { +class DiagnosticMessageRequest + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief DiagnosticMessageRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h index 562d7f236b..6643c1e158 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_dtcs_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_DTCS_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_DTCS_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/vehicle_info_command_params.h" @@ -46,7 +46,7 @@ namespace commands { /** * @brief GetDTCsRequest command class **/ -class GetDTCsRequest : public app_mngr::commands::CommandRequestImpl { +class GetDTCsRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief GetDTCsRequest class constructor @@ -71,7 +71,7 @@ class GetDTCsRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(GetDTCsRequest); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h index 8a594b0647..5e6e4c0227 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/get_vehicle_data_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_VEHICLE_DATA_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_GET_VEHICLE_DATA_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/vehicle_info_command_params.h" @@ -46,7 +46,7 @@ namespace commands { /** * @brief GetVehicleDataRequest command class **/ -class GetVehicleDataRequest : public app_mngr::commands::CommandRequestImpl { +class GetVehicleDataRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief GetVehicleDataRequest class constructor @@ -67,7 +67,7 @@ class GetVehicleDataRequest : public app_mngr::commands::CommandRequestImpl { virtual void Run(); protected: - virtual void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; private: /** diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h index 8566075504..0e27e7402d 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/read_did_request.h @@ -34,7 +34,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_READ_DID_REQUEST_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_READ_DID_REQUEST_H_ -#include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/vehicle_info_command_params.h" namespace vehicle_info_plugin { @@ -45,7 +45,7 @@ namespace commands { /** * @brief ReadDIDRequest command class **/ -class ReadDIDRequest : public app_mngr::commands::CommandRequestImpl { +class ReadDIDRequest : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief ReadDIDRequest class constructor @@ -65,7 +65,7 @@ class ReadDIDRequest : public app_mngr::commands::CommandRequestImpl { * * @param event The received event */ - void on_event(const app_mngr::event_engine::Event& event); + void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; /** * @brief Execute command diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h index 663e64f2a0..4a92d736a3 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/subscribe_vehicle_data_request.h @@ -39,6 +39,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/custom_vehicle_data_manager.h" #include "vehicle_info_plugin/vehicle_info_app_extension.h" @@ -53,7 +54,7 @@ namespace commands { * @brief SubscribeVehicleDataRequest command class **/ class SubscribeVehicleDataRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief SubscribeVehicleDataRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h index 4f2a01244f..f728c44753 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/commands/mobile/unsubscribe_vehicle_data_request.h @@ -36,6 +36,7 @@ #include "application_manager/application.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "utils/macro.h" #include "vehicle_info_plugin/custom_vehicle_data_manager.h" #include "vehicle_info_plugin/vehicle_info_app_extension.h" @@ -50,7 +51,7 @@ namespace commands { * @brief UnsubscribeVehicleDataRequest command class **/ class UnsubscribeVehicleDataRequest - : public app_mngr::commands::CommandRequestImpl { + : public app_mngr::commands::RequestFromMobileImpl { public: /** * @brief UnsubscribeVehicleDataRequest class constructor diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h index 78f8f685cc..271f950d03 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_pending_resumption_handler.h @@ -52,7 +52,7 @@ class VehicleInfoPendingResumptionHandler app_mngr::ApplicationManager& application_manager, CustomVehicleDataManager& custom_vehicle_data_manager); - void on_event(const app_mngr::event_engine::Event& event) OVERRIDE; + void HandleOnEvent(const app_mngr::event_engine::Event& event) OVERRIDE; void HandleResumptionSubscriptionRequest(app_mngr::AppExtension& extension, app_mngr::Application& app) OVERRIDE; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc index 26a9990079..808b8c85c2 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_get_vehicle_type_request.cc @@ -56,7 +56,7 @@ void VIGetVehicleTypeRequest::Run() { SendRequest(); } -void VIGetVehicleTypeRequest::onTimeOut() { +void VIGetVehicleTypeRequest::OnTimeOut() { SDL_LOG_AUTO_TRACE(); hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VehicleInfo_GetVehicleType); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc index 2c9ac78523..cbbf8a2a3f 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc @@ -51,8 +51,7 @@ VIIsReadyRequest::VIIsReadyRequest( params.application_manager_, params.rpc_service_, params.hmi_capabilities_, - params.policy_handler_) - , EventObserver(application_manager_.event_dispatcher()) {} + params.policy_handler_) {} VIIsReadyRequest::~VIIsReadyRequest() {} @@ -99,7 +98,7 @@ void VIIsReadyRequest::on_event(const event_engine::Event& event) { } } -void VIIsReadyRequest::onTimeOut() { +void VIIsReadyRequest::OnTimeOut() { // Note(dtrunov): According to new requirment APPLINK-27956 hmi_capabilities_.UpdateRequestsRequiredForCapabilities( hmi_apis::FunctionID::VehicleInfo_IsReady); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc index da925e68e7..ee0fac65e7 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_subscribe_vehicle_data_request.cc @@ -77,7 +77,7 @@ void VISubscribeVehicleDataRequest::Run() { SendRequest(); } -void VISubscribeVehicleDataRequest::onTimeOut() { +void VISubscribeVehicleDataRequest::OnTimeOut() { event_engine::Event timeout_event( hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData); SDL_LOG_AUTO_TRACE(); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc index 762528c51b..37f99857e2 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/diagnostic_message_request.cc @@ -49,11 +49,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") DiagnosticMessageRequest::DiagnosticMessageRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) {} + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) {} DiagnosticMessageRequest::~DiagnosticMessageRequest() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc index 2f236dd8b2..9044e0a1aa 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_dtcs_request.cc @@ -47,11 +47,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") GetDTCsRequest::GetDTCsRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) {} + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) {} GetDTCsRequest::~GetDTCsRequest() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc index 854d78b684..3cc1645825 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/get_vehicle_data_request.cc @@ -54,11 +54,11 @@ namespace str = strings; GetVehicleDataRequest::GetVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {} GetVehicleDataRequest::~GetVehicleDataRequest() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc index c718d18965..443bcd3e8c 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/read_did_request.cc @@ -48,11 +48,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") ReadDIDRequest::ReadDIDRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) {} + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) {} ReadDIDRequest::~ReadDIDRequest() {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc index 9e35e96ce3..db3922e1a2 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -47,11 +47,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") SubscribeVehicleDataRequest::SubscribeVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, VehicleInfoCommandParams params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {} SubscribeVehicleDataRequest::~SubscribeVehicleDataRequest() {} @@ -103,7 +103,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { } EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); if (!app) { SDL_LOG_ERROR("NULL pointer."); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc index 7d81701a64..e04e529a67 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -52,11 +52,11 @@ SDL_CREATE_LOG_VARIABLE("Commands") UnsubscribeVehicleDataRequest::UnsubscribeVehicleDataRequest( const application_manager::commands::MessageSharedPtr& message, const VehicleInfoCommandParams& params) - : CommandRequestImpl(message, - params.application_manager_, - params.rpc_service_, - params.hmi_capabilities_, - params.policy_handler_) + : RequestFromMobileImpl(message, + params.application_manager_, + params.rpc_service_, + params.hmi_capabilities_, + params.policy_handler_) , custom_vehicle_data_manager_(params.custom_vehicle_data_manager_) {} UnsubscribeVehicleDataRequest::~UnsubscribeVehicleDataRequest() {} @@ -189,7 +189,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); ApplicationSharedPtr app = - application_manager_.application(CommandRequestImpl::connection_key()); + application_manager_.application(RequestFromMobileImpl::connection_key()); if (!app) { SDL_LOG_ERROR("NULL pointer."); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc index 6721d93658..c9affa5760 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_pending_resumption_handler.cc @@ -205,7 +205,7 @@ void VehicleInfoPendingResumptionHandler::TriggerPendingResumption() { } } -void VehicleInfoPendingResumptionHandler::on_event( +void VehicleInfoPendingResumptionHandler::HandleOnEvent( const application_manager::event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); sync_primitives::AutoLock lock(pending_resumption_lock_); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc index 20bf34f2ca..75f5ea3b83 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_type_request_test.cc @@ -99,7 +99,7 @@ TEST_F( ASSERT_TRUE(command->Init()); command->Run(); - command->onTimeOut(); + command->OnTimeOut(); } } // namespace vi_get_vehicle_type_request diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc index f207faad77..5828630f24 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc @@ -210,7 +210,7 @@ TEST_F(VIIsReadyRequestTest, Run_HMIDoestRespond_SendMessageToHMIByTimeout) { ASSERT_TRUE(command_->Init()); command_->Run(); - command_->onTimeOut(); + command_->OnTimeOut(); } } // namespace vi_is_ready_request diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc index 5b2f4d5e25..82c5aaeafa 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/vehicle_info_pending_resumption_test.cc @@ -380,7 +380,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, raise_event(EventCheck(subscribed_correlation_id, expected_data_in_event))); - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -427,7 +427,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, expected_data_in_event))); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -469,7 +469,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -506,7 +506,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -550,7 +550,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, TwoAppsOneSharedDataSuccess) { resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); @@ -599,7 +599,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_TRUE(ext->isSubscribedToVehicleInfo("speed")); EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps")); @@ -648,7 +648,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, resumption_handler_->HandleResumptionSubscriptionRequest(*ext, *mock_app); resumption_handler_->HandleResumptionSubscriptionRequest(*ext2, *mock_app2); // TODO check that raized the same fid and cid as subscribed - resumption_handler_->on_event(event); + resumption_handler_->HandleOnEvent(event); const std::map second_subscriptions_result = { @@ -661,7 +661,7 @@ TEST_F(VehicleInfoPendingResumptionHandlerTest, VehicleInfo_SubscribeVehicleData); second_event.set_smart_object(second_response); - resumption_handler_->on_event(second_event); + resumption_handler_->HandleOnEvent(second_event); EXPECT_FALSE(ext->isSubscribedToVehicleInfo("gps")); EXPECT_TRUE(ext2->isSubscribedToVehicleInfo("gps")); EXPECT_EQ(ext->PendingSubscriptions().GetData().size(), 0u); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index bfb83d8de8..55c437d506 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -175,7 +175,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( , request_timeout_handler_( new request_controller::RequestTimeoutHandlerImpl(*this)) , request_ctrl_(new request_controller::RequestControllerImpl( - am_settings, *request_timeout_handler_)) + am_settings, *request_timeout_handler_, event_dispatcher_)) , mobile_correlation_id_(0) , correlation_id_(0) , max_correlation_id_(UINT_MAX) @@ -5033,6 +5033,22 @@ void ApplicationManagerImpl::ChangeAppsHMILevel( } } +bool ApplicationManagerImpl::RetainRequestInstance( + const uint32_t connection_key, const uint32_t correlation_id) { + return request_ctrl_->RetainRequestInstance(connection_key, correlation_id); +} + +bool ApplicationManagerImpl::RemoveRetainedRequest( + const uint32_t connection_key, const uint32_t correlation_id) { + return request_ctrl_->RemoveRetainedRequest(connection_key, correlation_id); +} + +bool ApplicationManagerImpl::IsStillWaitingForResponse( + const uint32_t connection_key, const uint32_t correlation_id) const { + return request_ctrl_->IsStillWaitingForResponse(connection_key, + correlation_id); +} + void ApplicationManagerImpl::AddExpiredButtonRequest( const uint32_t app_id, const int32_t corr_id, diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 8751823e85..8eb7171274 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -39,12 +39,6 @@ namespace application_manager { namespace { -struct AppExtensionPredicate { - AppExtensionUID uid; - bool operator()(const ApplicationSharedPtr app) { - return app ? (app->QueryInterface(uid).use_count() != 0) : false; - } -}; /** * @brief Functor for build info string @@ -132,6 +126,8 @@ bool CommandImpl::CleanUp() { void CommandImpl::Run() {} +void CommandImpl::OnUpdateTimeOut() {} + uint32_t CommandImpl::default_timeout() const { return default_timeout_; } @@ -157,6 +153,8 @@ uint32_t CommandImpl::connection_key() const { return (*message_)[strings::params][strings::connection_key].asUInt(); } +void CommandImpl::HandleTimeOut() {} + void CommandImpl::set_warning_info(const std::string info) { warning_info_ = info; } @@ -165,8 +163,6 @@ std::string CommandImpl::warning_info() const { return warning_info_; } -void CommandImpl::onTimeOut() {} - bool CommandImpl::AllowedToTerminate() { return allowed_to_terminate_; } diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 65fbf7e66f..2929144883 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -30,144 +30,18 @@ POSSIBILITY OF SUCH DAMAGE. */ -#include -#include -#include -#include "utils/macro.h" - #include "application_manager/commands/command_request_impl.h" -#include "application_manager/app_service_manager.h" -#include "application_manager/application_manager.h" +#include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "application_manager/rpc_service.h" -#include "smart_objects/smart_object.h" - #include "smart_objects/enum_schema_item.h" -#include "utils/helpers.h" +#include "smart_objects/smart_object.h" namespace application_manager { - namespace commands { -SDL_CREATE_LOG_VARIABLE("Commands"); - -std::string MergeInfos(const ResponseInfo& first_info, - const std::string& first_str, - const ResponseInfo& second_info, - const std::string& second_str) { - if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && - (second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && - !second_str.empty()) { - return second_str; - } - - if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && - (first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && - !first_str.empty()) { - return first_str; - } - - return MergeInfos(first_str, second_str); -} - -std::string MergeInfos(const std::string& first, const std::string& second) { - return first + ((!first.empty() && !second.empty()) ? ", " : "") + second; -} - -std::string MergeInfos(const std::string& first, - const std::string& second, - const std::string& third) { - std::string result = MergeInfos(first, second); - return MergeInfos(result, third); -} - -const std::string CreateInfoForUnsupportedResult( - HmiInterfaces::InterfaceID interface) { - switch (interface) { - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VR): { - return "VR is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): { - return "TTS is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): { - return "UI is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): { - return "Navigation is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): { - return "VehicleInfo is not supported by system"; - } - case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): { - return "RC is not supported by system"; - } - default: - SDL_LOG_WARN( - "Could not create info because" - " interface isn't valid. Interface is:" - << static_cast(interface)); - return ""; - } -} - -bool CommandRequestImpl::CheckResult(const ResponseInfo& first, - const ResponseInfo& second) const { - if (first.is_ok && second.is_unsupported_resource) { - return true; - } - if (first.is_ok && second.is_not_used) { - return true; - } - if (first.is_ok && second.is_ok) { - return true; - } - return false; -} - -bool IsResultCodeWarning(const ResponseInfo& first, - const ResponseInfo& second) { - const bool first_is_ok_second_is_warn = - (first.is_ok || first.is_not_used) && - hmi_apis::Common_Result::WARNINGS == second.result_code; - - const bool both_warnings = - hmi_apis::Common_Result::WARNINGS == first.result_code && - hmi_apis::Common_Result::WARNINGS == second.result_code; - - return first_is_ok_second_is_warn || both_warnings; -} - -ResponseInfo::ResponseInfo() - : result_code(hmi_apis::Common_Result::INVALID_ENUM) - , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM) - , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) - , is_ok(false) - , is_unsupported_resource(false) - , is_not_used(false) {} - -ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result, - const HmiInterfaces::InterfaceID hmi_interface, - ApplicationManager& application_manager) - : result_code(result) - , interface(hmi_interface) - , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) - , is_ok(false) - , is_unsupported_resource(false) - , is_not_used(false) { - using namespace helpers; - - interface_state = - application_manager.hmi_interfaces().GetInterfaceState(hmi_interface); - - is_ok = IsHMIResultSuccess(result_code); - - is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code; - - is_unsupported_resource = - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code; -} +SDL_CREATE_LOG_VARIABLE("Commands") CommandRequestImpl::CommandRequestImpl( const MessageSharedPtr& message, @@ -181,266 +55,25 @@ CommandRequestImpl::CommandRequestImpl( hmi_capabilities, policy_handler) , EventObserver(application_manager.event_dispatcher()) - , current_state_(kAwaitingHMIResponse) - , hash_update_mode_(kSkipHashUpdate) - , is_success_result_(false) {} + , current_state_(RequestState::kAwaitingResponse) {} CommandRequestImpl::~CommandRequestImpl() { - UpdateHash(); -} - -bool CommandRequestImpl::Init() { - return true; -} - -bool CommandRequestImpl::CheckPermissions() { - return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE); -} - -bool CommandRequestImpl::CleanUp() { - return true; + CleanUp(); } void CommandRequestImpl::Run() {} -void CommandRequestImpl::onTimeOut() { - SDL_LOG_AUTO_TRACE(); - - unsubscribe_from_all_hmi_events(); - unsubscribe_from_all_mobile_events(); - { - // FIXME (dchmerev@luxoft.com): atomic_xchg fits better - sync_primitives::AutoLock auto_lock(state_lock_); - if (kCompleted == current_state_) { - SDL_LOG_DEBUG("current_state_ = kCompleted"); - // don't send timeout if request completed - return; - } - - current_state_ = kTimedOut; - } - - smart_objects::SmartObjectSPtr response = - MessageHelper::CreateNegativeResponse(connection_key(), - function_id(), - correlation_id(), - mobile_api::Result::GENERIC_ERROR); - AddTimeOutComponentInfoToMessage(*response); - rpc_service_.ManageMobileCommand(response, SOURCE_SDL); -} - -void CommandRequestImpl::on_event(const event_engine::Event& event) {} - -void CommandRequestImpl::on_event(const event_engine::MobileEvent& event) {} - -void CommandRequestImpl::SendResponse( - const bool success, - const mobile_apis::Result::eType& result_code, - const char* info, - const smart_objects::SmartObject* response_params, - const std::vector binary_data) { - SDL_LOG_AUTO_TRACE(); - { - sync_primitives::AutoLock auto_lock(state_lock_); - if (kTimedOut == current_state_) { - // don't send response if request timeout expired - return; - } - - current_state_ = kCompleted; - } - - smart_objects::SmartObjectSPtr result = - std::make_shared(); - - smart_objects::SmartObject& response = *result; - - response[strings::params][strings::message_type] = MessageType::kResponse; - response[strings::params][strings::correlation_id] = correlation_id(); - response[strings::params][strings::protocol_type] = - CommandImpl::mobile_protocol_type_; - response[strings::params][strings::protocol_version] = - CommandImpl::protocol_version_; - response[strings::params][strings::connection_key] = connection_key(); - response[strings::params][strings::function_id] = function_id(); - if (!binary_data.empty()) { - response[strings::params][strings::binary_data] = binary_data; - } - if (response_params) { - response[strings::msg_params] = *response_params; - } - - if (info && *info != '\0') { - response[strings::msg_params][strings::info] = std::string(info); - } - - // Add disallowed parameters and info from request back to response with - // appropriate reasons (VehicleData result codes) - if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED && - result_code != mobile_apis::Result::INVALID_DATA) { - FormatResponse(response); - } - - response[strings::msg_params][strings::success] = success; - if ((result_code == mobile_apis::Result::SUCCESS || - result_code == mobile_apis::Result::WARNINGS) && - !warning_info().empty()) { - response[strings::msg_params][strings::info] = - (info && *info != '\0') ? std::string(info) + "\n" + warning_info() - : warning_info(); - response[strings::msg_params][strings::result_code] = - mobile_apis::Result::WARNINGS; - } else if (mobile_apis::Result::INVALID_ENUM == result_code) { - response[strings::msg_params][strings::result_code] = - mobile_apis::Result::GENERIC_ERROR; - response[strings::msg_params][strings::info] = - "Invalid result received from vehicle"; - } else { - response[strings::msg_params][strings::result_code] = result_code; - } - - is_success_result_ = success; - - rpc_service_.ManageMobileCommand(result, SOURCE_SDL); -} - -smart_objects::SmartObject CreateUnsupportedResourceResponse( - const hmi_apis::FunctionID::eType function_id, - const uint32_t hmi_correlation_id, - HmiInterfaces::InterfaceID interface) { - smart_objects::SmartObject response(smart_objects::SmartType_Map); - smart_objects::SmartObject& params = response[strings::params]; - params[strings::message_type] = MessageType::kResponse; - params[strings::correlation_id] = hmi_correlation_id; - params[strings::protocol_type] = CommandImpl::hmi_protocol_type_; - params[strings::protocol_version] = CommandImpl::protocol_version_; - params[strings::function_id] = function_id; - params[hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - smart_objects::SmartObject& msg_params = response[strings::msg_params]; - msg_params[strings::info] = CreateInfoForUnsupportedResult(interface); - return response; -} - -bool CommandRequestImpl::ProcessHMIInterfacesAvailability( - const uint32_t hmi_correlation_id, - const hmi_apis::FunctionID::eType& function_id) { - SDL_LOG_AUTO_TRACE(); - HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - HmiInterfaces::InterfaceID interface = - hmi_interfaces.GetInterfaceFromFunction(function_id); - DCHECK(interface != HmiInterfaces::HMI_INTERFACE_INVALID_ENUM); - const HmiInterfaces::InterfaceState state = - hmi_interfaces.GetInterfaceState(interface); - if (HmiInterfaces::STATE_NOT_AVAILABLE == state) { - event_engine::Event event(function_id); - event.set_smart_object(CreateUnsupportedResourceResponse( - function_id, hmi_correlation_id, interface)); - event.raise(application_manager_.event_dispatcher()); - return false; - } - return true; -} - -void CommandRequestImpl::UpdateHash() { - SDL_LOG_AUTO_TRACE(); - if (hash_update_mode_ == kSkipHashUpdate) { - SDL_LOG_DEBUG("Hash update is disabled for " << function_id()); - return; - } - - if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) { - SDL_LOG_ERROR("UI interface has not responded. Hash won't be updated."); - return; - } - - if (!is_success_result_) { - SDL_LOG_WARN("Command is not succeeded. Hash won't be updated."); - return; - } - - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - if (!application) { - SDL_LOG_ERROR("Application with connection key " - << connection_key() - << " not found. Not able to update hash."); - return; - } - - SDL_LOG_DEBUG( - "Updating hash for application with connection key " - << connection_key() << " while processing function id " - << MessageHelper::StringifiedFunctionID( - static_cast(function_id()))); - - application->UpdateHash(); -} - -void CommandRequestImpl::SendProviderRequest( - const mobile_apis::FunctionID::eType& mobile_function_id, - const hmi_apis::FunctionID::eType& hmi_function_id, - const smart_objects::SmartObject* msg, - bool use_events) { +bool CommandRequestImpl::CheckAllowedParameters( + const Command::CommandSource source) { SDL_LOG_AUTO_TRACE(); - bool hmi_destination = false; - ApplicationSharedPtr app; - // Default error code and error message - std::string error_msg = "No app service provider available"; - mobile_apis::Result::eType error_code = - mobile_apis::Result::DATA_NOT_AVAILABLE; - - if ((*msg)[strings::msg_params].keyExists(strings::service_type)) { - std::string service_type = - (*msg)[strings::msg_params][strings::service_type].asString(); - application_manager_.GetAppServiceManager().GetProviderByType( - service_type, true, app, hmi_destination); - error_msg = "No app service provider with serviceType: " + service_type + - " is available"; - error_code = mobile_apis::Result::DATA_NOT_AVAILABLE; - } else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) { - std::string service_id = - (*msg)[strings::msg_params][strings::service_id].asString(); - application_manager_.GetAppServiceManager().GetProviderByID( - service_id, true, app, hmi_destination); - error_msg = "No app service provider with serviceId: " + service_id + - " is available"; - error_code = mobile_apis::Result::INVALID_ID; - } - - if (hmi_destination) { - SDL_LOG_DEBUG("Sending Request to HMI Provider"); - application_manager_.IncreaseForwardedRequestTimeout(connection_key(), - correlation_id()); - SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events); - return; - } - - if (!app) { - SDL_LOG_DEBUG("Invalid App Provider pointer"); - SendResponse(false, error_code, error_msg.c_str()); - return; - } - if (connection_key() == app->app_id()) { - SendResponse(false, - mobile_apis::Result::IGNORED, - "Consumer app is same as producer app"); - return; + // RegisterAppInterface should always be allowed + if (mobile_apis::FunctionID::RegisterAppInterfaceID == + static_cast(function_id())) { + return true; } - smart_objects::SmartObjectSPtr new_msg = - std::make_shared(); - smart_objects::SmartObject& request = *new_msg; - - request[strings::params] = (*msg)[strings::params]; - request[strings::msg_params] = (*msg)[strings::msg_params]; - request[strings::params][strings::connection_key] = app->app_id(); - - application_manager_.IncreaseForwardedRequestTimeout(connection_key(), - correlation_id()); - SendMobileRequest(mobile_function_id, new_msg, use_events); + return CommandImpl::CheckAllowedParameters(source); } void CommandRequestImpl::SendMobileRequest( @@ -465,325 +98,91 @@ void CommandRequestImpl::SendMobileRequest( } } -uint32_t CommandRequestImpl::SendHMIRequest( - const hmi_apis::FunctionID::eType& function_id, - const smart_objects::SmartObject* msg_params, - bool use_events) { - SDL_LOG_AUTO_TRACE(); - smart_objects::SmartObjectSPtr result = - std::make_shared(); +void CommandRequestImpl::OnTimeOut() {} - const uint32_t hmi_correlation_id = - application_manager_.GetNextHMICorrelationID(); +void CommandRequestImpl::on_event(const event_engine::Event&) {} +void CommandRequestImpl::on_event(const event_engine::MobileEvent&) {} - smart_objects::SmartObject& request = *result; - request[strings::params][strings::message_type] = MessageType::kRequest; - request[strings::params][strings::function_id] = function_id; - request[strings::params][strings::correlation_id] = hmi_correlation_id; - request[strings::params][strings::protocol_version] = - CommandImpl::protocol_version_; - request[strings::params][strings::protocol_type] = - CommandImpl::hmi_protocol_type_; - - if (msg_params) { - request[strings::msg_params] = *msg_params; - } - - if (use_events) { - SDL_LOG_DEBUG("SendHMIRequest subscribe_on_event " << function_id << " " - << hmi_correlation_id); - subscribe_on_event(function_id, hmi_correlation_id); - } - if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { - if (rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { - AddRequestToTimeoutHandler(request); - } else { - SDL_LOG_ERROR("Unable to send request"); - SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); - } - } else { - SDL_LOG_DEBUG("Interface is not available"); - } - return hmi_correlation_id; -} - -void CommandRequestImpl::CreateHMINotification( - const hmi_apis::FunctionID::eType& function_id, - const ns_smart::SmartObject& msg_params) const { - smart_objects::SmartObjectSPtr result = - std::make_shared(); - if (!result) { - SDL_LOG_ERROR("Memory allocation failed."); - return; - } - smart_objects::SmartObject& notify = *result; - - notify[strings::params][strings::message_type] = - static_cast(application_manager::MessageType::kNotification); - notify[strings::params][strings::protocol_version] = - CommandImpl::protocol_version_; - notify[strings::params][strings::protocol_type] = - CommandImpl::hmi_protocol_type_; - notify[strings::params][strings::function_id] = function_id; - notify[strings::msg_params] = msg_params; - - if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { - SDL_LOG_ERROR("Unable to send HMI notification"); - } -} - -mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode( - const hmi_apis::Common_Result::eType& hmi_code) const { - mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR; - switch (hmi_code) { - case hmi_apis::Common_Result::SUCCESS: { - mobile_result = mobile_apis::Result::SUCCESS; - break; - } - case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: { - mobile_result = mobile_apis::Result::UNSUPPORTED_REQUEST; - break; - } - case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: { - mobile_result = mobile_apis::Result::UNSUPPORTED_RESOURCE; - break; - } - case hmi_apis::Common_Result::DISALLOWED: { - mobile_result = mobile_apis::Result::DISALLOWED; - break; - } - case hmi_apis::Common_Result::REJECTED: { - mobile_result = mobile_apis::Result::REJECTED; - break; - } - case hmi_apis::Common_Result::ABORTED: { - mobile_result = mobile_apis::Result::ABORTED; - break; - } - case hmi_apis::Common_Result::IGNORED: { - mobile_result = mobile_apis::Result::IGNORED; - break; - } - case hmi_apis::Common_Result::RETRY: { - mobile_result = mobile_apis::Result::RETRY; - break; - } - case hmi_apis::Common_Result::IN_USE: { - mobile_result = mobile_apis::Result::IN_USE; - break; - } - case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: { - mobile_result = mobile_apis::Result::VEHICLE_DATA_NOT_AVAILABLE; - break; - } - case hmi_apis::Common_Result::TIMED_OUT: { - mobile_result = mobile_apis::Result::TIMED_OUT; - break; - } - case hmi_apis::Common_Result::INVALID_DATA: { - mobile_result = mobile_apis::Result::INVALID_DATA; - break; - } - case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: { - mobile_result = mobile_apis::Result::CHAR_LIMIT_EXCEEDED; - break; - } - case hmi_apis::Common_Result::INVALID_ID: { - mobile_result = mobile_apis::Result::INVALID_ID; - break; - } - case hmi_apis::Common_Result::DUPLICATE_NAME: { - mobile_result = mobile_apis::Result::DUPLICATE_NAME; - break; - } - case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: { - mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; - break; - } - case hmi_apis::Common_Result::WRONG_LANGUAGE: { - mobile_result = mobile_apis::Result::WRONG_LANGUAGE; - break; - } - case hmi_apis::Common_Result::OUT_OF_MEMORY: { - mobile_result = mobile_apis::Result::OUT_OF_MEMORY; - break; - } - case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: { - mobile_result = mobile_apis::Result::TOO_MANY_PENDING_REQUESTS; - break; - } - case hmi_apis::Common_Result::NO_APPS_REGISTERED: { - mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; - break; - } - case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: { - mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; - break; - } - case hmi_apis::Common_Result::WARNINGS: { - mobile_result = mobile_apis::Result::WARNINGS; - break; - } - case hmi_apis::Common_Result::GENERIC_ERROR: { - mobile_result = mobile_apis::Result::GENERIC_ERROR; - break; - } - case hmi_apis::Common_Result::USER_DISALLOWED: { - mobile_result = mobile_apis::Result::USER_DISALLOWED; - break; - } - case hmi_apis::Common_Result::SAVED: { - mobile_result = mobile_apis::Result::SAVED; - break; - } - case hmi_apis::Common_Result::READ_ONLY: { - mobile_result = mobile_apis::Result::READ_ONLY; - break; - } - default: { - SDL_LOG_ERROR("Unknown HMI result code " << hmi_code); - break; +void CommandRequestImpl::HandleTimeOut() { + SDL_LOG_AUTO_TRACE(); + { + sync_primitives::AutoLock auto_lock(state_lock_); + if (RequestState::kProcessEvent == current_state()) { + SDL_LOG_DEBUG("Current request state is: " + << current_state() << ". Timeout request ignored"); + return; } + set_current_state(RequestState::kTimedOut); } - return mobile_result; + OnTimeOut(); } -bool CommandRequestImpl::CheckAllowedParameters( - const Command::CommandSource source) { +bool CommandRequestImpl::StartOnEventHandling() { SDL_LOG_AUTO_TRACE(); - // RegisterAppInterface should always be allowed - if (mobile_apis::FunctionID::RegisterAppInterfaceID == - static_cast(function_id())) { - return true; + { + sync_primitives::AutoLock auto_lock(state_lock_); + if (RequestState::kTimedOut == current_state()) { + SDL_LOG_DEBUG("current_state_ = kTimedOut"); + return false; + } + set_current_state(RequestState::kProcessEvent); } - return CommandImpl::CheckAllowedParameters(source); + return true; } -bool CommandRequestImpl::CheckHMICapabilities( - const mobile_apis::ButtonName::eType button) const { - SDL_LOG_AUTO_TRACE(); - - using namespace smart_objects; - using namespace mobile_apis; - - if (!hmi_capabilities_.is_ui_cooperating()) { - SDL_LOG_ERROR("UI is not supported by HMI"); - return false; - } - - auto button_capabilities = hmi_capabilities_.button_capabilities(); - if (!button_capabilities) { - SDL_LOG_ERROR("Invalid button capabilities object"); - return false; - } +void CommandRequestImpl::FinalizeOnEventHandling() { + const auto conn_key = connection_key(); + const auto corr_id = correlation_id(); - for (size_t i = 0; i < button_capabilities->length(); ++i) { - const SmartObject& capabilities = (*button_capabilities)[i]; - const ButtonName::eType current_button = static_cast( - capabilities.getElement(hmi_response::button_name).asInt()); - if (current_button == button) { - SDL_LOG_DEBUG("Button capabilities for " << button << " was found"); - return true; - } + if (application_manager_.IsStillWaitingForResponse(conn_key, corr_id)) { + SDL_LOG_DEBUG("Request (" << conn_key << ", " << corr_id + << ") is still waiting for repsonse"); + set_current_state(RequestState::kAwaitingResponse); } - - SDL_LOG_DEBUG("Button capabilities for " << button << " was not found"); - return false; -} - -bool CommandRequestImpl::HasDisallowedParams() const { - return ((!removed_parameters_permissions_.disallowed_params.empty()) || - (!removed_parameters_permissions_.undefined_params.empty())); } -bool CommandRequestImpl::PrepareResultForMobileResponse( - hmi_apis::Common_Result::eType result_code, - HmiInterfaces::InterfaceID interface) const { +void CommandRequestImpl::HandleOnEvent(const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); - return IsHMIResultSuccess(result_code, interface); -} -bool CommandRequestImpl::PrepareResultForMobileResponse( - ResponseInfo& out_first, ResponseInfo& out_second) const { - SDL_LOG_AUTO_TRACE(); - bool result = - CheckResult(out_first, out_second) || CheckResult(out_second, out_first); - return result; + if (StartOnEventHandling()) { + on_event(event); + FinalizeOnEventHandling(); + } } -bool CommandRequestImpl::PrepareResultForMobileResponse( - ResponseInfo& out_first, - ResponseInfo& out_second, - ResponseInfo& out_third) const { +void CommandRequestImpl::HandleOnEvent(const event_engine::MobileEvent& event) { SDL_LOG_AUTO_TRACE(); - bool result = (PrepareResultForMobileResponse(out_first, out_second) || - PrepareResultForMobileResponse(out_second, out_third)) && - PrepareResultForMobileResponse(out_first, out_third); - return result; -} -void CommandRequestImpl::GetInfo( - const smart_objects::SmartObject& response_from_hmi, - std::string& out_info) { - if (response_from_hmi[strings::msg_params].keyExists(strings::info)) { - if (!response_from_hmi[strings::msg_params][strings::info].empty()) { - out_info = - response_from_hmi[strings::msg_params][strings::info].asString(); - } + if (StartOnEventHandling()) { + on_event(event); + FinalizeOnEventHandling(); } } -mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( - const ResponseInfo& first, const ResponseInfo& second) { +bool CommandRequestImpl::IncrementReferenceCount() const { SDL_LOG_AUTO_TRACE(); - if (IsResultCodeUnsupported(first, second) || - IsResultCodeUnsupported(second, first)) { - return mobile_apis::Result::UNSUPPORTED_RESOURCE; - } - if (IsResultCodeWarning(first, second) || - IsResultCodeWarning(second, first)) { - return mobile_apis::Result::WARNINGS; - } - // If response contains erroneous result code SDL need return erroneus - // result code. - hmi_apis::Common_Result::eType first_result = - hmi_apis::Common_Result::INVALID_ENUM; - hmi_apis::Common_Result::eType second_result = - hmi_apis::Common_Result::INVALID_ENUM; - if (!first.is_unsupported_resource) { - first_result = first.result_code; - } - if (!second.is_unsupported_resource) { - second_result = second.result_code; - } - mobile_apis::Result::eType result_code = - MessageHelper::HMIToMobileResult(std::max(first_result, second_result)); - return result_code; + const auto conn_key = connection_key(); + const auto corr_id = correlation_id(); + return application_manager_.RetainRequestInstance(conn_key, corr_id); } -mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( - const ResponseInfo& first, - const ResponseInfo& second, - const ResponseInfo& third) { +bool CommandRequestImpl::DecrementReferenceCount() const { SDL_LOG_AUTO_TRACE(); - - const auto first_comparison = PrepareResultCodeForResponse(first, second); - const auto second_comparison = PrepareResultCodeForResponse(second, third); - const auto third_comparison = PrepareResultCodeForResponse(first, third); - - return std::max({first_comparison, second_comparison, third_comparison}); + const auto conn_key = connection_key(); + const auto corr_id = correlation_id(); + return application_manager_.RemoveRetainedRequest(conn_key, corr_id); } -const CommandParametersPermissions& CommandRequestImpl::parameters_permissions() - const { - return parameters_permissions_; +void CommandRequestImpl::OnUpdateTimeOut() { + SDL_LOG_AUTO_TRACE(); + set_current_state(RequestState::kAwaitingResponse); } void CommandRequestImpl::StartAwaitForInterface( - const HmiInterfaces::InterfaceID interface_id) { + const HmiInterfaces::InterfaceID& interface_id) { sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); awaiting_response_interfaces_.insert(interface_id); } @@ -791,139 +190,31 @@ void CommandRequestImpl::StartAwaitForInterface( bool CommandRequestImpl::IsInterfaceAwaited( const HmiInterfaces::InterfaceID& interface_id) const { sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); - std::set::const_iterator it = - awaiting_response_interfaces_.find(interface_id); - return (it != awaiting_response_interfaces_.end()); + + return helpers::in_range(awaiting_response_interfaces_, interface_id); } void CommandRequestImpl::EndAwaitForInterface( const HmiInterfaces::InterfaceID& interface_id) { sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); - std::set::const_iterator it = - awaiting_response_interfaces_.find(interface_id); - if (it != awaiting_response_interfaces_.end()) { - awaiting_response_interfaces_.erase(it); - } else { - SDL_LOG_WARN( - "EndAwaitForInterface called on interface \ - which was not put into await state: " - << interface_id); - } -} - -bool CommandRequestImpl::IsResultCodeUnsupported( - const ResponseInfo& first, const ResponseInfo& second) const { - const bool first_ok_second_unsupported = - (first.is_ok || first.is_not_used) && second.is_unsupported_resource; - const bool both_unsupported = - first.is_unsupported_resource && second.is_unsupported_resource; - return first_ok_second_unsupported || both_unsupported; -} - -std::string GetComponentNameFromInterface( - const HmiInterfaces::InterfaceID& interface) { - switch (interface) { - case HmiInterfaces::HMI_INTERFACE_Buttons: - return hmi_interface::buttons; - case HmiInterfaces::HMI_INTERFACE_BasicCommunication: - return hmi_interface::basic_communication; - case HmiInterfaces::HMI_INTERFACE_VR: - return hmi_interface::vr; - case HmiInterfaces::HMI_INTERFACE_TTS: - return hmi_interface::tts; - case HmiInterfaces::HMI_INTERFACE_UI: - return hmi_interface::ui; - case HmiInterfaces::HMI_INTERFACE_Navigation: - return hmi_interface::navigation; - case HmiInterfaces::HMI_INTERFACE_VehicleInfo: - return hmi_interface::vehicle_info; - case HmiInterfaces::HMI_INTERFACE_SDL: - return hmi_interface::sdl; - case HmiInterfaces::HMI_INTERFACE_RC: - return hmi_interface::rc; - case HmiInterfaces::HMI_INTERFACE_AppService: - return hmi_interface::app_service; - default: - return "Unknown type"; - } -} - -const std::string InfoInterfaceSeparator( - const std::string& sum, const HmiInterfaces::InterfaceID container_value) { - return sum.empty() - ? GetComponentNameFromInterface(container_value) - : sum + ", " + GetComponentNameFromInterface(container_value); + awaiting_response_interfaces_.erase(interface_id); } -void CommandRequestImpl::AddTimeOutComponentInfoToMessage( - smart_objects::SmartObject& response) const { - using ns_smart_device_link::ns_smart_objects::SmartObject; - SDL_LOG_AUTO_TRACE(); +bool CommandRequestImpl::IsPendingResponseExist() const { sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); - if (awaiting_response_interfaces_.empty()) { - SDL_LOG_ERROR("No interfaces awaiting, info param is empty"); - return; - } - - const std::string not_responding_interfaces_string = - std::accumulate(awaiting_response_interfaces_.begin(), - awaiting_response_interfaces_.end(), - std::string(""), - InfoInterfaceSeparator); - SDL_LOG_DEBUG( - "Not responding interfaces string: " << not_responding_interfaces_string); - if (!not_responding_interfaces_string.empty()) { - const std::string component_info = - not_responding_interfaces_string + " component does not respond"; - response[strings::msg_params][strings::info] = component_info; - } + return !awaiting_response_interfaces_.empty(); } -void CommandRequestImpl::AddRequestToTimeoutHandler( - const smart_objects::SmartObject& request_to_hmi) const { - auto function_id = static_cast( - request_to_hmi[strings::params][strings::function_id].asUInt()); - // SDL must not apply "default timeout for RPCs processing" for - // BasicCommunication.DialNumber RPC (that is, SDL must always wait for HMI - // response to BC.DialNumber as long as it takes and not return GENERIC_ERROR - // to mobile app), so the OnResetTimeout logic is not applicable for - // DialNumber RPC - if (helpers::Compare( - function_id, - hmi_apis::FunctionID::BasicCommunication_DialNumber, - hmi_apis::FunctionID::INVALID_ENUM)) { - SDL_LOG_DEBUG( - "Current RPC is DialNumber or Invalid, OnResetTimeout " - "logic is not applicable in this case"); - return; - } - - // If soft buttons are present in Alert or SubtleAlert RPC, SDL will not use - // timeout tracking for response, so the OnResetTimeout logic is not - // applicable in this case - if (helpers::Compare( - function_id, - hmi_apis::FunctionID::UI_Alert, - hmi_apis::FunctionID::UI_SubtleAlert)) { - if (request_to_hmi.keyExists(strings::msg_params)) { - if (request_to_hmi[strings::msg_params].keyExists( - strings::soft_buttons)) { - SDL_LOG_DEBUG("Soft buttons are present in " - << EnumToString(function_id) - << " RPC, OnResetTimeout " - "logic is not applicable in this case"); - return; - } - } - } +CommandRequestImpl::RequestState CommandRequestImpl::current_state() const { + sync_primitives::AutoLock auto_lock(state_lock_); + return current_state_; +} - const application_manager::request_controller::Request request{ - correlation_id(), connection_key(), static_cast(function_id)}; - application_manager_.get_request_timeout_handler().AddRequest( - request_to_hmi[strings::params][strings::correlation_id].asUInt(), - request); +void CommandRequestImpl::set_current_state( + const CommandRequestImpl::RequestState state) { + sync_primitives::AutoLock auto_lock(state_lock_); + current_state_ = state; } } // namespace commands - } // namespace application_manager diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc index fca48854e2..5a2e9f0730 100644 --- a/src/components/application_manager/src/commands/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/request_from_hmi.cc @@ -53,12 +53,11 @@ RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message, rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) - , EventObserver(application_manager.event_dispatcher()) { + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) { // Replace HMI app id with Mobile connection id ReplaceHMIWithMobileAppId(*message); } @@ -79,6 +78,8 @@ void RequestFromHMI::on_event(const event_engine::Event& event) {} void RequestFromHMI::on_event(const event_engine::MobileEvent& event) {} +void RequestFromHMI::OnTimeOut() {} + void RequestFromHMI::SendResponse( const bool success, const uint32_t correlation_id, diff --git a/src/components/application_manager/src/commands/request_from_mobile_impl.cc b/src/components/application_manager/src/commands/request_from_mobile_impl.cc new file mode 100644 index 0000000000..42df13f034 --- /dev/null +++ b/src/components/application_manager/src/commands/request_from_mobile_impl.cc @@ -0,0 +1,906 @@ +/* + Copyright (c) 2020, Ford Motor Company + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + + Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following + disclaimer in the documentation and/or other materials provided with the + distribution. + + Neither the name of the Ford Motor Company nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + */ + +#include "application_manager/commands/request_from_mobile_impl.h" + +#include +#include +#include + +#include "application_manager/app_service_manager.h" +#include "application_manager/application_manager.h" +#include "application_manager/message_helper.h" +#include "application_manager/rpc_service.h" +#include "smart_objects/smart_object.h" +#include "utils/helpers.h" +#include "utils/macro.h" + +namespace application_manager { + +namespace commands { + +SDL_CREATE_LOG_VARIABLE("Commands") + +namespace smart_objects = ns_smart_device_link::ns_smart_objects; + +std::string MergeInfos(const ResponseInfo& first_info, + const std::string& first_str, + const ResponseInfo& second_info, + const std::string& second_str) { + if ((first_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + (second_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !second_str.empty()) { + return second_str; + } + + if ((second_info.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) && + (first_info.interface_state != HmiInterfaces::STATE_NOT_AVAILABLE) && + !first_str.empty()) { + return first_str; + } + + return MergeInfos(first_str, second_str); +} + +std::string MergeInfos(const std::string& first, const std::string& second) { + return first + ((!first.empty() && !second.empty()) ? ", " : "") + second; +} + +std::string MergeInfos(const std::string& first, + const std::string& second, + const std::string& third) { + std::string result = MergeInfos(first, second); + return MergeInfos(result, third); +} + +const std::string CreateInfoForUnsupportedResult( + HmiInterfaces::InterfaceID interface) { + switch (interface) { + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VR): { + return "VR is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS): { + return "TTS is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_UI): { + return "UI is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_Navigation): { + return "Navigation is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_VehicleInfo): { + return "VehicleInfo is not supported by system"; + } + case (HmiInterfaces::InterfaceID::HMI_INTERFACE_RC): { + return "Remote control is not supported by system"; + } + default: + SDL_LOG_WARN( + "Could not create info because" + " interface isn't valid. Interface is:" + << static_cast(interface)); + return ""; + } +} + +bool RequestFromMobileImpl::CheckResultCode(const ResponseInfo& first, + const ResponseInfo& second) const { + if (first.is_ok && second.is_unsupported_resource) { + return true; + } + if (first.is_ok && second.is_not_used) { + return true; + } + if (first.is_ok && second.is_ok) { + return true; + } + return false; +} + +bool IsResultCodeWarning(const ResponseInfo& first, + const ResponseInfo& second) { + const bool first_is_ok_second_is_warn = + (first.is_ok || first.is_not_used) && + hmi_apis::Common_Result::WARNINGS == second.result_code; + + const bool both_warnings = + hmi_apis::Common_Result::WARNINGS == first.result_code && + hmi_apis::Common_Result::WARNINGS == second.result_code; + + return first_is_ok_second_is_warn || both_warnings; +} + +ResponseInfo::ResponseInfo() + : result_code(hmi_apis::Common_Result::INVALID_ENUM) + , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM) + , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) + , is_ok(false) + , is_unsupported_resource(false) + , is_not_used(false) {} + +ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result, + const HmiInterfaces::InterfaceID hmi_interface, + ApplicationManager& application_manager) + : result_code(result) + , interface(hmi_interface) + , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) + , is_ok(false) + , is_unsupported_resource(false) + , is_not_used(false) { + using namespace helpers; + + interface_state = + application_manager.hmi_interfaces().GetInterfaceState(hmi_interface); + + is_ok = IsHMIResultSuccess(result_code); + + is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code; + + is_unsupported_resource = + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code; +} + +RequestFromMobileImpl::RequestFromMobileImpl( + const MessageSharedPtr& message, + ApplicationManager& application_manager, + rpc_service::RPCService& rpc_service, + HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) + , hash_update_mode_(kSkipHashUpdate) + , is_success_result_(false) {} + +RequestFromMobileImpl::~RequestFromMobileImpl() { + UpdateHash(); +} + +bool RequestFromMobileImpl::Init() { + return true; +} + +bool RequestFromMobileImpl::CheckPermissions() { + return CheckAllowedParameters(Command::CommandSource::SOURCE_MOBILE); +} + +bool RequestFromMobileImpl::CleanUp() { + unsubscribe_from_all_mobile_events(); + unsubscribe_from_all_hmi_events(); // To prevent on_event calls + + // Cleanup for mobile requests can be done only if OnEvent/OnTimeout events + // are not processed at that moment + return kAwaitingResponse == current_state(); +} + +void RequestFromMobileImpl::Run() {} + +void RequestFromMobileImpl::OnTimeOut() { + SDL_LOG_AUTO_TRACE(); + + unsubscribe_from_all_mobile_events(); + unsubscribe_from_all_hmi_events(); + + smart_objects::SmartObjectSPtr response = + MessageHelper::CreateNegativeResponse(connection_key(), + function_id(), + correlation_id(), + mobile_api::Result::GENERIC_ERROR); + + AddTimeOutComponentInfoToMessage(*response); + + rpc_service_.ManageMobileCommand(response, SOURCE_SDL); +} + +void RequestFromMobileImpl::on_event(const event_engine::Event& event) {} + +void RequestFromMobileImpl::on_event(const event_engine::MobileEvent& event) {} + +void RequestFromMobileImpl::SendResponse( + const bool success, + const mobile_apis::Result::eType& result_code, + const char* info, + const smart_objects::SmartObject* response_params, + const std::vector binary_data) { + SDL_LOG_AUTO_TRACE(); + + smart_objects::SmartObjectSPtr result = + std::make_shared(); + + smart_objects::SmartObject& response = *result; + + response[strings::params][strings::message_type] = MessageType::kResponse; + response[strings::params][strings::correlation_id] = correlation_id(); + response[strings::params][strings::protocol_type] = + CommandImpl::mobile_protocol_type_; + response[strings::params][strings::protocol_version] = + CommandImpl::protocol_version_; + response[strings::params][strings::connection_key] = connection_key(); + response[strings::params][strings::function_id] = function_id(); + if (!binary_data.empty()) { + response[strings::params][strings::binary_data] = binary_data; + } + if (response_params) { + response[strings::msg_params] = *response_params; + } + + if (info && *info != '\0') { + response[strings::msg_params][strings::info] = std::string(info); + } + + // Add disallowed parameters and info from request back to response with + // appropriate reasons (VehicleData result codes) + if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED && + result_code != mobile_apis::Result::INVALID_DATA) { + FormatResponse(response); + } + + response[strings::msg_params][strings::success] = success; + if ((result_code == mobile_apis::Result::SUCCESS || + result_code == mobile_apis::Result::WARNINGS) && + !warning_info().empty()) { + response[strings::msg_params][strings::info] = + (info && *info != '\0') ? std::string(info) + "\n" + warning_info() + : warning_info(); + response[strings::msg_params][strings::result_code] = + mobile_apis::Result::WARNINGS; + } else if (mobile_apis::Result::INVALID_ENUM == result_code) { + response[strings::msg_params][strings::result_code] = + mobile_apis::Result::GENERIC_ERROR; + response[strings::msg_params][strings::info] = + "Invalid result received from vehicle"; + } else { + response[strings::msg_params][strings::result_code] = result_code; + } + + is_success_result_ = success; + + rpc_service_.ManageMobileCommand(result, SOURCE_SDL); +} + +smart_objects::SmartObject CreateUnsupportedResourceResponse( + const hmi_apis::FunctionID::eType function_id, + const uint32_t hmi_correlation_id, + HmiInterfaces::InterfaceID interface) { + smart_objects::SmartObject response(smart_objects::SmartType_Map); + smart_objects::SmartObject& params = response[strings::params]; + params[strings::message_type] = MessageType::kResponse; + params[strings::correlation_id] = hmi_correlation_id; + params[strings::protocol_type] = CommandImpl::hmi_protocol_type_; + params[strings::protocol_version] = CommandImpl::protocol_version_; + params[strings::function_id] = function_id; + params[hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; + smart_objects::SmartObject& msg_params = response[strings::msg_params]; + msg_params[strings::info] = CreateInfoForUnsupportedResult(interface); + return response; +} + +bool RequestFromMobileImpl::ProcessHMIInterfacesAvailability( + const uint32_t hmi_correlation_id, + const hmi_apis::FunctionID::eType& function_id) { + SDL_LOG_AUTO_TRACE(); + HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); + HmiInterfaces::InterfaceID interface = + hmi_interfaces.GetInterfaceFromFunction(function_id); + DCHECK(interface != HmiInterfaces::HMI_INTERFACE_INVALID_ENUM); + const HmiInterfaces::InterfaceState state = + hmi_interfaces.GetInterfaceState(interface); + if (HmiInterfaces::STATE_NOT_AVAILABLE == state) { + event_engine::Event event(function_id); + event.set_smart_object(CreateUnsupportedResourceResponse( + function_id, hmi_correlation_id, interface)); + event.raise(application_manager_.event_dispatcher()); + return false; + } + return true; +} + +void RequestFromMobileImpl::UpdateHash() { + SDL_LOG_AUTO_TRACE(); + if (hash_update_mode_ == kSkipHashUpdate) { + SDL_LOG_DEBUG("Hash update is disabled for " << function_id()); + return; + } + + if (HmiInterfaces::InterfaceState::STATE_NOT_RESPONSE == + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::InterfaceID::HMI_INTERFACE_UI)) { + SDL_LOG_ERROR("UI interface has not responded. Hash won't be updated."); + return; + } + + if (!is_success_result_) { + SDL_LOG_WARN("Command is not succeeded. Hash won't be updated."); + return; + } + + ApplicationSharedPtr application = + application_manager_.application(connection_key()); + if (!application) { + SDL_LOG_ERROR("Application with connection key " + << connection_key() + << " not found. Not able to update hash."); + return; + } + + SDL_LOG_DEBUG( + "Updating hash for application with connection key " + << connection_key() << " while processing function id " + << MessageHelper::StringifiedFunctionID( + static_cast(function_id()))); + + application->UpdateHash(); +} + +uint32_t RequestFromMobileImpl::SendHMIRequest( + const hmi_apis::FunctionID::eType& function_id, + const smart_objects::SmartObject* msg_params, + bool use_events) { + smart_objects::SmartObjectSPtr result = + std::make_shared(); + + const uint32_t hmi_correlation_id = + application_manager_.GetNextHMICorrelationID(); + + smart_objects::SmartObject& request = *result; + request[strings::params][strings::message_type] = MessageType::kRequest; + request[strings::params][strings::function_id] = function_id; + request[strings::params][strings::correlation_id] = hmi_correlation_id; + request[strings::params][strings::protocol_version] = + CommandImpl::protocol_version_; + request[strings::params][strings::protocol_type] = + CommandImpl::hmi_protocol_type_; + + if (msg_params) { + request[strings::msg_params] = *msg_params; + } + + if (use_events) { + SDL_LOG_DEBUG("SendHMIRequest subscribe_on_event " << function_id << " " + << hmi_correlation_id); + subscribe_on_event(function_id, hmi_correlation_id); + } + if (ProcessHMIInterfacesAvailability(hmi_correlation_id, function_id)) { + if (rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { + AddRequestToTimeoutHandler(request); + } else { + SDL_LOG_ERROR("Unable to send request"); + SendResponse(false, mobile_apis::Result::OUT_OF_MEMORY); + } + } else { + SDL_LOG_DEBUG("Interface is not available"); + } + return hmi_correlation_id; +} + +void RequestFromMobileImpl::CreateHMINotification( + const hmi_apis::FunctionID::eType& function_id, + const ns_smart_device_link::ns_smart_objects::SmartObject& msg_params) + const { + smart_objects::SmartObjectSPtr result = + std::make_shared(); + if (!result) { + SDL_LOG_ERROR("Memory allocation failed."); + return; + } + smart_objects::SmartObject& notify = *result; + + notify[strings::params][strings::message_type] = + static_cast(application_manager::MessageType::kNotification); + notify[strings::params][strings::protocol_version] = + CommandImpl::protocol_version_; + notify[strings::params][strings::protocol_type] = + CommandImpl::hmi_protocol_type_; + notify[strings::params][strings::function_id] = function_id; + notify[strings::msg_params] = msg_params; + + if (!rpc_service_.ManageHMICommand(result, SOURCE_SDL_TO_HMI)) { + SDL_LOG_ERROR("Unable to send HMI notification"); + } +} + +mobile_apis::Result::eType RequestFromMobileImpl::GetMobileResultCode( + const hmi_apis::Common_Result::eType& hmi_code) const { + mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR; + switch (hmi_code) { + case hmi_apis::Common_Result::SUCCESS: { + mobile_result = mobile_apis::Result::SUCCESS; + break; + } + case hmi_apis::Common_Result::UNSUPPORTED_REQUEST: { + mobile_result = mobile_apis::Result::UNSUPPORTED_REQUEST; + break; + } + case hmi_apis::Common_Result::UNSUPPORTED_RESOURCE: { + mobile_result = mobile_apis::Result::UNSUPPORTED_RESOURCE; + break; + } + case hmi_apis::Common_Result::DISALLOWED: { + mobile_result = mobile_apis::Result::DISALLOWED; + break; + } + case hmi_apis::Common_Result::REJECTED: { + mobile_result = mobile_apis::Result::REJECTED; + break; + } + case hmi_apis::Common_Result::ABORTED: { + mobile_result = mobile_apis::Result::ABORTED; + break; + } + case hmi_apis::Common_Result::IGNORED: { + mobile_result = mobile_apis::Result::IGNORED; + break; + } + case hmi_apis::Common_Result::RETRY: { + mobile_result = mobile_apis::Result::RETRY; + break; + } + case hmi_apis::Common_Result::IN_USE: { + mobile_result = mobile_apis::Result::IN_USE; + break; + } + case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: { + mobile_result = mobile_apis::Result::VEHICLE_DATA_NOT_AVAILABLE; + break; + } + case hmi_apis::Common_Result::TIMED_OUT: { + mobile_result = mobile_apis::Result::TIMED_OUT; + break; + } + case hmi_apis::Common_Result::INVALID_DATA: { + mobile_result = mobile_apis::Result::INVALID_DATA; + break; + } + case hmi_apis::Common_Result::CHAR_LIMIT_EXCEEDED: { + mobile_result = mobile_apis::Result::CHAR_LIMIT_EXCEEDED; + break; + } + case hmi_apis::Common_Result::INVALID_ID: { + mobile_result = mobile_apis::Result::INVALID_ID; + break; + } + case hmi_apis::Common_Result::DUPLICATE_NAME: { + mobile_result = mobile_apis::Result::DUPLICATE_NAME; + break; + } + case hmi_apis::Common_Result::APPLICATION_NOT_REGISTERED: { + mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; + break; + } + case hmi_apis::Common_Result::WRONG_LANGUAGE: { + mobile_result = mobile_apis::Result::WRONG_LANGUAGE; + break; + } + case hmi_apis::Common_Result::OUT_OF_MEMORY: { + mobile_result = mobile_apis::Result::OUT_OF_MEMORY; + break; + } + case hmi_apis::Common_Result::TOO_MANY_PENDING_REQUESTS: { + mobile_result = mobile_apis::Result::TOO_MANY_PENDING_REQUESTS; + break; + } + case hmi_apis::Common_Result::NO_APPS_REGISTERED: { + mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; + break; + } + case hmi_apis::Common_Result::NO_DEVICES_CONNECTED: { + mobile_result = mobile_apis::Result::APPLICATION_NOT_REGISTERED; + break; + } + case hmi_apis::Common_Result::WARNINGS: { + mobile_result = mobile_apis::Result::WARNINGS; + break; + } + case hmi_apis::Common_Result::GENERIC_ERROR: { + mobile_result = mobile_apis::Result::GENERIC_ERROR; + break; + } + case hmi_apis::Common_Result::USER_DISALLOWED: { + mobile_result = mobile_apis::Result::USER_DISALLOWED; + break; + } + case hmi_apis::Common_Result::SAVED: { + mobile_result = mobile_apis::Result::SAVED; + break; + } + case hmi_apis::Common_Result::READ_ONLY: { + mobile_result = mobile_apis::Result::READ_ONLY; + break; + } + default: { + SDL_LOG_ERROR("Unknown HMI result code " << hmi_code); + break; + } + } + + return mobile_result; +} + +bool RequestFromMobileImpl::CheckHMICapabilities( + const mobile_apis::ButtonName::eType button) const { + SDL_LOG_AUTO_TRACE(); + + using namespace smart_objects; + using namespace mobile_apis; + + if (!hmi_capabilities_.is_ui_cooperating()) { + SDL_LOG_ERROR("UI is not supported by HMI"); + return false; + } + + const auto button_capabilities_so = hmi_capabilities_.button_capabilities(); + if (!button_capabilities_so) { + SDL_LOG_ERROR("Invalid button capabilities object"); + return false; + } + + const SmartObject& button_capabilities = *button_capabilities_so; + for (size_t i = 0; i < button_capabilities.length(); ++i) { + const SmartObject& capabilities = button_capabilities[i]; + const ButtonName::eType current_button = static_cast( + capabilities.getElement(hmi_response::button_name).asInt()); + if (current_button == button) { + SDL_LOG_DEBUG("Button capabilities for " << button << " was found"); + return true; + } + } + + SDL_LOG_DEBUG("Button capabilities for " << button << " was not found"); + return false; +} + +void RequestFromMobileImpl::RemoveDisallowedParameters() { + SDL_LOG_AUTO_TRACE(); + + smart_objects::SmartObject& params = (*message_)[strings::msg_params]; + + // Remove from request all disallowed parameters + RPCParams::const_iterator it_disallowed = + parameters_permissions_.disallowed_params.begin(); + RPCParams::const_iterator it_disallowed_end = + parameters_permissions_.disallowed_params.end(); + for (; it_disallowed != it_disallowed_end; ++it_disallowed) { + if (params.keyExists(*it_disallowed)) { + const std::string key = *it_disallowed; + params.erase(key); + removed_parameters_permissions_.disallowed_params.insert(key); + SDL_LOG_INFO("Following parameter is disallowed by user: " << key); + } + } + + // Remove from request all undefined yet parameters + RPCParams::const_iterator it_undefined = + parameters_permissions_.undefined_params.begin(); + RPCParams::const_iterator it_undefined_end = + parameters_permissions_.undefined_params.end(); + for (; it_undefined != it_undefined_end; ++it_undefined) { + if (params.keyExists(*it_undefined)) { + const std::string key = *it_undefined; + params.erase(key); + removed_parameters_permissions_.undefined_params.insert(key); + SDL_LOG_INFO("Following parameter is disallowed by policy: " << key); + } + } + + // Remove from request all parameters missed in allowed + const VehicleData& vehicle_data = + application_manager::MessageHelper::vehicle_data(); + + VehicleData::const_iterator it_vehicle_data = vehicle_data.begin(); + VehicleData::const_iterator it_vehicle_data_end = vehicle_data.end(); + for (; it_vehicle_data != it_vehicle_data_end; ++it_vehicle_data) { + const std::string key = it_vehicle_data->first; + if (params.keyExists(key) && + parameters_permissions_.allowed_params.end() == + std::find(parameters_permissions_.allowed_params.begin(), + parameters_permissions_.allowed_params.end(), + key)) { + params.erase(key); + removed_parameters_permissions_.undefined_params.insert(key); + SDL_LOG_INFO("Following parameter is not found among allowed parameters '" + << key << "' and will be treated as disallowed."); + } + } +} + +bool RequestFromMobileImpl::HasDisallowedParams() const { + return ((!removed_parameters_permissions_.disallowed_params.empty()) || + (!removed_parameters_permissions_.undefined_params.empty())); +} + +bool RequestFromMobileImpl::PrepareResultForMobileResponse( + hmi_apis::Common_Result::eType result_code, + HmiInterfaces::InterfaceID interface) const { + SDL_LOG_AUTO_TRACE(); + + return IsHMIResultSuccess(result_code, interface); +} + +bool RequestFromMobileImpl::PrepareResultForMobileResponse( + ResponseInfo& out_first, ResponseInfo& out_second) const { + SDL_LOG_AUTO_TRACE(); + bool result = CheckResultCode(out_first, out_second) || + CheckResultCode(out_second, out_first); + return result; +} + +bool RequestFromMobileImpl::PrepareResultForMobileResponse( + ResponseInfo& out_first, + ResponseInfo& out_second, + ResponseInfo& out_third) const { + SDL_LOG_AUTO_TRACE(); + bool result = (PrepareResultForMobileResponse(out_first, out_second) || + PrepareResultForMobileResponse(out_second, out_third)) && + PrepareResultForMobileResponse(out_first, out_third); + return result; +} + +void RequestFromMobileImpl::GetInfo( + const smart_objects::SmartObject& response_from_hmi, + std::string& out_info) const { + if (response_from_hmi[strings::msg_params].keyExists(strings::info)) { + if (!response_from_hmi[strings::msg_params][strings::info].empty()) { + out_info = + response_from_hmi[strings::msg_params][strings::info].asString(); + } + } +} + +mobile_apis::Result::eType RequestFromMobileImpl::PrepareResultCodeForResponse( + const ResponseInfo& first, const ResponseInfo& second) { + SDL_LOG_AUTO_TRACE(); + if (IsResultCodeUnsupported(first, second) || + IsResultCodeUnsupported(second, first)) { + return mobile_apis::Result::UNSUPPORTED_RESOURCE; + } + if (IsResultCodeWarning(first, second) || + IsResultCodeWarning(second, first)) { + return mobile_apis::Result::WARNINGS; + } + // If response contains erroneous result code SDL need return erroneus + // result code. + hmi_apis::Common_Result::eType first_result = + hmi_apis::Common_Result::INVALID_ENUM; + hmi_apis::Common_Result::eType second_result = + hmi_apis::Common_Result::INVALID_ENUM; + if (!first.is_unsupported_resource) { + first_result = first.result_code; + } + if (!second.is_unsupported_resource) { + second_result = second.result_code; + } + mobile_apis::Result::eType result_code = + MessageHelper::HMIToMobileResult(std::max(first_result, second_result)); + return result_code; +} + +mobile_apis::Result::eType RequestFromMobileImpl::PrepareResultCodeForResponse( + const ResponseInfo& first, + const ResponseInfo& second, + const ResponseInfo& third) { + SDL_LOG_AUTO_TRACE(); + + const auto first_comparison = PrepareResultCodeForResponse(first, second); + const auto second_comparison = PrepareResultCodeForResponse(second, third); + const auto third_comparison = PrepareResultCodeForResponse(first, third); + + return std::max({first_comparison, second_comparison, third_comparison}); +} + +const CommandParametersPermissions& +RequestFromMobileImpl::parameters_permissions() const { + return parameters_permissions_; +} + +void RequestFromMobileImpl::SendProviderRequest( + const mobile_apis::FunctionID::eType& mobile_function_id, + const hmi_apis::FunctionID::eType& hmi_function_id, + const smart_objects::SmartObject* msg, + bool use_events) { + SDL_LOG_AUTO_TRACE(); + bool hmi_destination = false; + ApplicationSharedPtr app; + // Default error code and error message + std::string error_msg = "No app service provider available"; + mobile_apis::Result::eType error_code = + mobile_apis::Result::DATA_NOT_AVAILABLE; + + if ((*msg)[strings::msg_params].keyExists(strings::service_type)) { + std::string service_type = + (*msg)[strings::msg_params][strings::service_type].asString(); + application_manager_.GetAppServiceManager().GetProviderByType( + service_type, true, app, hmi_destination); + error_msg = "No app service provider with serviceType: " + service_type + + " is available"; + error_code = mobile_apis::Result::DATA_NOT_AVAILABLE; + } else if ((*msg)[strings::msg_params].keyExists(strings::service_id)) { + std::string service_id = + (*msg)[strings::msg_params][strings::service_id].asString(); + application_manager_.GetAppServiceManager().GetProviderByID( + service_id, true, app, hmi_destination); + error_msg = "No app service provider with serviceId: " + service_id + + " is available"; + error_code = mobile_apis::Result::INVALID_ID; + } + + if (hmi_destination) { + SDL_LOG_DEBUG("Sending Request to HMI Provider"); + application_manager_.IncreaseForwardedRequestTimeout(connection_key(), + correlation_id()); + SendHMIRequest(hmi_function_id, &(*msg)[strings::msg_params], use_events); + return; + } + + if (!app) { + SDL_LOG_DEBUG("Invalid App Provider pointer"); + SendResponse(false, error_code, error_msg.c_str()); + return; + } + + if (connection_key() == app->app_id()) { + SendResponse(false, + mobile_apis::Result::IGNORED, + "Consumer app is same as producer app"); + return; + } + + smart_objects::SmartObjectSPtr new_msg = + std::make_shared(); + smart_objects::SmartObject& request = *new_msg; + + request[strings::params] = (*msg)[strings::params]; + request[strings::msg_params] = (*msg)[strings::msg_params]; + request[strings::params][strings::connection_key] = app->app_id(); + + application_manager_.IncreaseForwardedRequestTimeout(connection_key(), + correlation_id()); + SendMobileRequest(mobile_function_id, new_msg, use_events); +} + +bool RequestFromMobileImpl::IsResultCodeUnsupported( + const ResponseInfo& first, const ResponseInfo& second) const { + const bool first_ok_second_unsupported = + (first.is_ok || first.is_not_used) && second.is_unsupported_resource; + const bool both_unsupported = + first.is_unsupported_resource && second.is_unsupported_resource; + return first_ok_second_unsupported || both_unsupported; +} + +std::string GetComponentNameFromInterface( + const HmiInterfaces::InterfaceID& interface) { + switch (interface) { + case HmiInterfaces::HMI_INTERFACE_Buttons: + return hmi_interface::buttons; + case HmiInterfaces::HMI_INTERFACE_BasicCommunication: + return hmi_interface::basic_communication; + case HmiInterfaces::HMI_INTERFACE_VR: + return hmi_interface::vr; + case HmiInterfaces::HMI_INTERFACE_TTS: + return hmi_interface::tts; + case HmiInterfaces::HMI_INTERFACE_UI: + return hmi_interface::ui; + case HmiInterfaces::HMI_INTERFACE_Navigation: + return hmi_interface::navigation; + case HmiInterfaces::HMI_INTERFACE_VehicleInfo: + return hmi_interface::vehicle_info; + case HmiInterfaces::HMI_INTERFACE_SDL: + return hmi_interface::sdl; + case HmiInterfaces::HMI_INTERFACE_RC: + return hmi_interface::rc; + case HmiInterfaces::HMI_INTERFACE_AppService: + return hmi_interface::app_service; + default: + return "Unknown type"; + } +} + +const std::string InfoInterfaceSeparator( + const std::string& sum, const HmiInterfaces::InterfaceID container_value) { + return sum.empty() + ? GetComponentNameFromInterface(container_value) + : sum + ", " + GetComponentNameFromInterface(container_value); +} + +void RequestFromMobileImpl::AddTimeOutComponentInfoToMessage( + smart_objects::SmartObject& response) const { + using ns_smart_device_link::ns_smart_objects::SmartObject; + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); + if (awaiting_response_interfaces_.empty()) { + SDL_LOG_ERROR("No interfaces awaiting, info param is empty"); + return; + } + + const std::string not_responding_interfaces_string = + std::accumulate(awaiting_response_interfaces_.begin(), + awaiting_response_interfaces_.end(), + std::string(""), + InfoInterfaceSeparator); + SDL_LOG_DEBUG( + "Not responding interfaces string: " << not_responding_interfaces_string); + if (!not_responding_interfaces_string.empty()) { + const std::string component_info = + not_responding_interfaces_string + " component does not respond"; + response[strings::msg_params][strings::info] = component_info; + } +} + +void RequestFromMobileImpl::AddRequestToTimeoutHandler( + const smart_objects::SmartObject& request_to_hmi) const { + auto function_id = static_cast( + request_to_hmi[strings::params][strings::function_id].asUInt()); + // SDL must not apply "default timeout for RPCs processing" for + // BasicCommunication.DialNumber RPC (that is, SDL must always wait for HMI + // response to BC.DialNumber as long as it takes and not return GENERIC_ERROR + // to mobile app), so the OnResetTimeout logic is not applicable for + // DialNumber RPC + if (helpers::Compare( + function_id, + hmi_apis::FunctionID::BasicCommunication_DialNumber, + hmi_apis::FunctionID::INVALID_ENUM)) { + SDL_LOG_DEBUG( + "Current RPC is DialNumber or Invalid, OnResetTimeout " + "logic is not applicable in this case"); + return; + } + + // If soft buttons are present in Alert or SubtleAlert RPC, SDL will not use + // timeout tracking for response, so the OnResetTimeout logic is not + // applicable in this case + if (helpers::Compare( + function_id, + hmi_apis::FunctionID::UI_Alert, + hmi_apis::FunctionID::UI_SubtleAlert)) { + if (request_to_hmi.keyExists(strings::msg_params)) { + if (request_to_hmi[strings::msg_params].keyExists( + strings::soft_buttons)) { + SDL_LOG_DEBUG("Soft buttons are present in " + << EnumToString(function_id) + << " RPC, OnResetTimeout " + "logic is not applicable in this case"); + return; + } + } + } + + const application_manager::request_controller::Request request{ + correlation_id(), connection_key(), static_cast(function_id)}; + application_manager_.get_request_timeout_handler().AddRequest( + request_to_hmi[strings::params][strings::correlation_id].asUInt(), + request); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc index 3c411b1605..ac6bda0557 100644 --- a/src/components/application_manager/src/commands/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/request_to_hmi.cc @@ -123,11 +123,11 @@ RequestToHMI::RequestToHMI(const MessageSharedPtr& message, rpc_service::RPCService& rpc_service, HMICapabilities& hmi_capabilities, policy::PolicyHandlerInterface& policy_handler) - : CommandImpl(message, - application_manager, - rpc_service, - hmi_capabilities, - policy_handler) {} + : CommandRequestImpl(message, + application_manager, + rpc_service, + hmi_capabilities, + policy_handler) {} RequestToHMI::~RequestToHMI() {} diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc index 7392731d70..0d7dc9cfe0 100644 --- a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc +++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc @@ -66,7 +66,11 @@ void EventDispatcherImpl::raise_event(const Event& event) { EventObserver* temp = *observers.begin(); observers.erase(observers.begin()); AutoUnlock unlock_observer(observer_lock); - temp->on_event(event); + + if (temp->IncrementReferenceCount()) { + temp->HandleOnEvent(event); + temp->DecrementReferenceCount(); + } } } @@ -88,6 +92,15 @@ struct IdCheckFunctor { const unsigned long target_id; }; +void EventDispatcherImpl::remove_observer(const Event::EventID& event_id, + const int32_t hmi_correlation_id) { + AutoLock auto_lock(state_lock_); + auto& observers = observers_event_[event_id][hmi_correlation_id]; + for (auto observer : observers) { + remove_observer_from_vector(*observer); + } +} + void EventDispatcherImpl::remove_observer(const Event::EventID& event_id, EventObserver& observer) { remove_observer_from_vector(observer); @@ -148,7 +161,11 @@ void EventDispatcherImpl::raise_mobile_event(const MobileEvent& event) { EventObserver* temp = *mobile_observers_.begin(); mobile_observers_.erase(mobile_observers_.begin()); AutoUnlock unlock_observer(observer_lock); - temp->on_event(event); + + if (temp->IncrementReferenceCount()) { + temp->HandleOnEvent(event); + temp->DecrementReferenceCount(); + } } } diff --git a/src/components/application_manager/src/event_engine/event_observer.cc b/src/components/application_manager/src/event_engine/event_observer.cc index e17203f2f2..6b6d6def35 100644 --- a/src/components/application_manager/src/event_engine/event_observer.cc +++ b/src/components/application_manager/src/event_engine/event_observer.cc @@ -75,7 +75,15 @@ void EventObserver::unsubscribe_from_all_mobile_events() { event_dispatcher_.remove_mobile_observer(*this); } -void EventObserver::on_event(const event_engine::MobileEvent& event) {} +void EventObserver::HandleOnEvent(const event_engine::MobileEvent& event) {} + +bool EventObserver::IncrementReferenceCount() const { + return true; +} + +bool EventObserver::DecrementReferenceCount() const { + return true; +} } // namespace event_engine } // namespace application_manager diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc index 2d9c7cb48a..776595a040 100644 --- a/src/components/application_manager/src/hmi_language_handler.cc +++ b/src/components/application_manager/src/hmi_language_handler.cc @@ -31,6 +31,7 @@ */ #include "application_manager/hmi_language_handler.h" + #include "application_manager/application_manager.h" #include "application_manager/hmi_capabilities.h" #include "application_manager/message_helper.h" @@ -119,7 +120,7 @@ hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for( return Common_Language::INVALID_ENUM; } -void HMILanguageHandler::on_event(const event_engine::Event& event) { +void HMILanguageHandler::HandleOnEvent(const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); smart_objects::SmartObject msg = event.smart_object(); switch (event.id()) { diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc index 75fa48b049..7b8deb5e8c 100644 --- a/src/components/application_manager/src/policies/policy_event_observer.cc +++ b/src/components/application_manager/src/policies/policy_event_observer.cc @@ -55,9 +55,10 @@ void PolicyEventObserver::set_policy_handler( policy_handler_ = policy_handler; } -void PolicyEventObserver::on_event(const event_engine::MobileEvent& event) {} +void PolicyEventObserver::HandleOnEvent( + const event_engine::MobileEvent& event) {} -void PolicyEventObserver::on_event(const event_engine::Event& event) { +void PolicyEventObserver::HandleOnEvent(const event_engine::Event& event) { sync_primitives::AutoLock auto_lock(policy_handler_lock_); if (!policy_handler_) { return; diff --git a/src/components/application_manager/src/request_controller_impl.cc b/src/components/application_manager/src/request_controller_impl.cc index 10f0f64b4e..76d4a70330 100644 --- a/src/components/application_manager/src/request_controller_impl.cc +++ b/src/components/application_manager/src/request_controller_impl.cc @@ -30,12 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "utils/logger.h" +#include "application_manager/request_controller.h" #include "application_manager/commands/command_request_impl.h" +#include "application_manager/commands/request_from_mobile_impl.h" #include "application_manager/commands/request_to_hmi.h" #include "application_manager/request_controller_impl.h" - +#include "utils/logger.h" #include "utils/timer_task_impl.h" namespace application_manager { @@ -48,8 +49,10 @@ SDL_CREATE_LOG_VARIABLE("RequestController") RequestControllerImpl::RequestControllerImpl( const RequestControlerSettings& settings, - RequestTimeoutHandler& request_timeout_handler) - : pool_state_(TPoolState::UNDEFINED) + RequestTimeoutHandler& request_timeout_handler, + event_engine::EventDispatcher& event_dispatcher) + : threads::AsyncRunner("RequestController async runner") + , pool_state_(TPoolState::UNDEFINED) , pool_size_(settings.thread_pool_size()) , request_tracker_(settings) , duplicate_message_count_() @@ -59,7 +62,8 @@ RequestControllerImpl::RequestControllerImpl( , timer_stop_flag_(false) , is_low_voltage_(false) , settings_(settings) - , request_timeout_handler_(request_timeout_handler) { + , request_timeout_handler_(request_timeout_handler) + , event_dispatcher_(event_dispatcher) { SDL_LOG_AUTO_TRACE(); InitializeThreadpool(); timer_.Start(0, timer::kSingleShot); @@ -83,6 +87,9 @@ void RequestControllerImpl::Stop() { DestroyThreadpool(); } + SDL_LOG_DEBUG("Stopping async runner"); + AsyncRunner::Stop(); + SDL_LOG_DEBUG("Stopping timeout tracker"); timer_.Stop(); } @@ -248,6 +255,50 @@ void RequestControllerImpl::RemoveNotification( SDL_LOG_DEBUG("Cannot find notification"); } +bool RequestControllerImpl::RetainRequestInstance( + const uint32_t connection_key, const uint32_t correlation_id) { + SDL_LOG_AUTO_TRACE(); + auto request = waiting_for_response_.Find(connection_key, correlation_id); + if (request) { + retained_mobile_requests_.insert(request); + SDL_LOG_DEBUG("Request (" << connection_key << ", " << correlation_id + << ") has been retained"); + } + SDL_LOG_DEBUG( + "Total retained requests: " << retained_mobile_requests_.size()); + + return static_cast(request); +} + +bool RequestControllerImpl::RemoveRetainedRequest( + const uint32_t connection_key, const uint32_t correlation_id) { + SDL_LOG_AUTO_TRACE(); + for (auto it = retained_mobile_requests_.begin(); + it != retained_mobile_requests_.end(); + ++it) { + if ((*it)->request()->connection_key() == connection_key && + (*it)->request()->correlation_id() == correlation_id) { + SDL_LOG_DEBUG("Removing request (" << connection_key << ", " + << correlation_id << ")"); + retained_mobile_requests_.erase(it); + + SDL_LOG_DEBUG( + "Total retained requests: " << retained_mobile_requests_.size()); + return true; + } + } + + SDL_LOG_ERROR("Can't find request (" << connection_key << ", " + << correlation_id << ")"); + return false; +} + +bool RequestControllerImpl::IsStillWaitingForResponse( + const uint32_t connection_key, const uint32_t correlation_id) const { + auto request = waiting_for_response_.Find(connection_key, correlation_id); + return static_cast(request); +} + void RequestControllerImpl::TerminateRequest(const uint32_t correlation_id, const uint32_t connection_key, const int32_t function_id, @@ -284,13 +335,17 @@ void RequestControllerImpl::TerminateRequest(const uint32_t correlation_id, return; } if (force_terminate || request->request()->AllowedToTerminate()) { + event_dispatcher_.remove_observer( + static_cast(function_id), correlation_id); waiting_for_response_.RemoveRequest(request); if (RequestInfo::HMIRequest == request->request_type()) { request_timeout_handler_.RemoveRequest(request->requestId()); } } else { - SDL_LOG_WARN("Request was not terminated"); + SDL_LOG_WARN("Request was not terminated " + << "correlation_id = " << correlation_id + << " function_id = " << function_id); } NotifyTimer(); } @@ -327,12 +382,51 @@ void RequestControllerImpl::TerminateWaitingForExecutionAppRequests( SDL_LOG_DEBUG("Waiting for execution " << mobile_request_list_.size()); } +void RequestControllerImpl::scheduleRequestsCleanup( + const RequestInfoPtrs& requests) { + SDL_LOG_AUTO_TRACE(); + AsyncRun(new RequestCleanerDelegate(requests)); +} + void RequestControllerImpl::TerminateWaitingForResponseAppRequests( const uint32_t app_id) { SDL_LOG_AUTO_TRACE(); - waiting_for_response_.RemoveByConnectionKey(app_id); - SDL_LOG_DEBUG( - "Waiting for response count : " << waiting_for_response_.Size()); + SDL_LOG_DEBUG("Waiting for response count before cleanup: " + << waiting_for_response_.Size()); + + RequestInfoPtrs requests_to_terminate; + + auto pending_requests = + waiting_for_response_.GetRequestsByConnectionKey(app_id); + for (auto it = pending_requests.begin(); it != pending_requests.end(); ++it) { + auto request_ptr = (*it)->request(); + if (!request_ptr->CleanUp()) { + SDL_LOG_WARN("Request with corr_id: " + << request_ptr->correlation_id() + << " can't be terminated right now. Keep in the queue"); + continue; + } + + SDL_LOG_DEBUG( + "Removing request with corr_id: " << request_ptr->correlation_id()); + requests_to_terminate.push_back(*it); + waiting_for_response_.RemoveRequest(*it); + } + + SDL_LOG_DEBUG("Waiting for response count after cleanup: " + << waiting_for_response_.Size()); + + // It is necessary to release requests references after some short amount of + // time because here might be a possible data races in event dispatcher + // between GetNextObserver() and IncrementReferenceCount() when reference to + // corresponding request is destroyed by that function right after CleanUp() + // This micro delay gives a time to event dispatcher to figure out that + // request was finalized and event should not be handled + if (!requests_to_terminate.empty()) { + SDL_LOG_DEBUG("Scheduling cleanup for " << requests_to_terminate.size() + << " requests for app " << app_id); + scheduleRequestsCleanup(requests_to_terminate); + } } void RequestControllerImpl::TerminateAppRequests(const uint32_t app_id) { @@ -467,7 +561,8 @@ void RequestControllerImpl::TimeoutThread() { const uint32_t expired_request_id = probably_expired->requestId(); const uint32_t expired_app_id = probably_expired->app_id(); - probably_expired->request()->onTimeOut(); + probably_expired->request()->HandleTimeOut(); + if (RequestInfo::kHmiConnectionKey == probably_expired->app_id()) { SDL_LOG_DEBUG("Erase HMI request: " << probably_expired->requestId()); waiting_for_response_.RemoveRequest(probably_expired); @@ -530,8 +625,8 @@ void RequestControllerImpl::Worker::threadMain() { std::make_shared(request_ptr, timeout_in_mseconds); if (!request_controller_->waiting_for_response_.Add(request_info_ptr)) { - commands::CommandRequestImpl* cmd_request = - dynamic_cast(request_ptr.get()); + commands::RequestFromMobileImpl* cmd_request = + dynamic_cast(request_ptr.get()); if (cmd_request != NULL) { uint32_t corr_id = cmd_request->correlation_id(); request_controller_->duplicate_message_count_lock_.Acquire(); @@ -577,6 +672,32 @@ void RequestControllerImpl::Worker::exitThreadMain() { // FIXME (dchmerev@luxoft.com): There is no waiting } +RequestControllerImpl::RequestCleanerDelegate::RequestCleanerDelegate( + const RequestInfoPtrs& requests) + : requests_(requests) {} + +RequestControllerImpl::RequestCleanerDelegate::~RequestCleanerDelegate() { + SDL_LOG_AUTO_TRACE(); +} + +void RequestControllerImpl::RequestCleanerDelegate::exitThreadMain() { + sync_primitives::AutoLock lock(state_lock_); + state_cond_.NotifyOne(); +} + +void RequestControllerImpl::RequestCleanerDelegate::threadMain() { + SDL_LOG_DEBUG("Prepare to cleanup of " << requests_.size() << " requests"); + + { + SDL_LOG_DEBUG("Waiting..."); + sync_primitives::AutoLock lock(state_lock_); + state_cond_.WaitFor(lock, 50); + } + + SDL_LOG_DEBUG("Releasing references"); + requests_.clear(); +} + void RequestControllerImpl::NotifyTimer() { SDL_LOG_AUTO_TRACE(); timer_condition_.NotifyOne(); diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index 6770e839b3..60d00b65de 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -92,6 +92,7 @@ void application_manager::request_controller::RequestInfo::updateEndTime() { void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) { timeout_msec_ = timeout_msec; updateEndTime(); + request_->OnUpdateTimeOut(); } bool RequestInfo::isExpired() { @@ -197,6 +198,22 @@ RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() { return result; } +std::list RequestInfoSet::GetRequestsByConnectionKey( + const uint32_t connection_key) { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock lock(pending_requests_lock_); + + std::list output_list; + AppIdCompararator comparator(AppIdCompararator::Equal, connection_key); + + std::copy_if(hash_sorted_pending_requests_.begin(), + hash_sorted_pending_requests_.end(), + std::back_inserter(output_list), + comparator); + + return output_list; +} + bool RequestInfoSet::Erase(const RequestInfoPtr request_info) { DCHECK(request_info); if (!request_info) { diff --git a/src/components/application_manager/src/request_timeout_handler_impl.cc b/src/components/application_manager/src/request_timeout_handler_impl.cc index f246693d56..1ac72393a0 100644 --- a/src/components/application_manager/src/request_timeout_handler_impl.cc +++ b/src/components/application_manager/src/request_timeout_handler_impl.cc @@ -80,7 +80,8 @@ bool RequestTimeoutHandlerImpl::IsTimeoutUpdateRequired( return true; } -void RequestTimeoutHandlerImpl::on_event(const event_engine::Event& event) { +void RequestTimeoutHandlerImpl::HandleOnEvent( + const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); const auto event_id = event.id(); if (hmi_apis::FunctionID::BasicCommunication_OnResetTimeout == event_id) { diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc index 598b7a6ccb..b8462a533a 100644 --- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc +++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc @@ -347,7 +347,8 @@ void ResumptionDataProcessorImpl::HandleOnTimeOut( ProcessResponseFromHMI(*error_response, function_id, corr_id); } -void ResumptionDataProcessorImpl::on_event(const event_engine::Event& event) { +void ResumptionDataProcessorImpl::HandleOnEvent( + const event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); SDL_LOG_DEBUG( "Handling response message from HMI " diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index 89dac83165..b8dbb69f50 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -31,12 +31,13 @@ */ #include "application_manager/state_controller_impl.h" + #include + #include "application_manager/rpc_service.h" #include "application_manager/usage_statistics.h" -#include "utils/helpers.h" - #include "connection_handler/connection_handler.h" +#include "utils/helpers.h" namespace application_manager { @@ -720,7 +721,8 @@ void StateControllerImpl::UpdateAppWindowsStreamingState( } } -void StateControllerImpl::on_event(const event_engine::MobileEvent& event) { +void StateControllerImpl::HandleOnEvent( + const event_engine::MobileEvent& event) { using namespace mobile_apis; SDL_LOG_AUTO_TRACE(); @@ -765,9 +767,9 @@ void StateControllerImpl::on_event(const event_engine::MobileEvent& event) { default: break; } -} +} // namespace application_manager -void StateControllerImpl::on_event(const event_engine::Event& event) { +void StateControllerImpl::HandleOnEvent(const event_engine::Event& event) { using event_engine::Event; using smart_objects::SmartObject; using namespace hmi_apis; diff --git a/src/components/application_manager/src/system_time/system_time_handler_impl.cc b/src/components/application_manager/src/system_time/system_time_handler_impl.cc index 3aee6d7e21..d66c70478b 100644 --- a/src/components/application_manager/src/system_time/system_time_handler_impl.cc +++ b/src/components/application_manager/src/system_time/system_time_handler_impl.cc @@ -121,7 +121,7 @@ void SystemTimeHandlerImpl::SendTimeRequest() { awaiting_get_system_time_ = true; } -void SystemTimeHandlerImpl::on_event( +void SystemTimeHandlerImpl::HandleOnEvent( const application_manager::event_engine::Event& event) { SDL_LOG_AUTO_TRACE(); using namespace application_manager; diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc index b7b0801167..b12e67ceba 100644 --- a/src/components/application_manager/test/commands/command_impl_test.cc +++ b/src/components/application_manager/test/commands/command_impl_test.cc @@ -157,7 +157,7 @@ TEST_F(CommandImplTest, GetMethods_SUCCESS) { EXPECT_EQ(kConnectionKey, command->connection_key()); EXPECT_EQ(kFunctionId, command->function_id()); EXPECT_NO_THROW(command->Run()); - EXPECT_NO_THROW(command->onTimeOut()); + EXPECT_NO_THROW(command->HandleTimeOut()); } TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_NoAppIdInMessage_UNSUCCESS) { diff --git a/src/components/application_manager/test/commands/command_mobile_request_impl_test.cc b/src/components/application_manager/test/commands/command_mobile_request_impl_test.cc new file mode 100644 index 0000000000..5129f09a96 --- /dev/null +++ b/src/components/application_manager/test/commands/command_mobile_request_impl_test.cc @@ -0,0 +1,699 @@ +/* + * Copyright (c) 2016, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include "application_manager/commands/command_impl.h" +#include "application_manager/commands/command_request_test.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/request_from_mobile_impl.h" +#include "gtest/gtest.h" +#include "utils/lock.h" + +#include "application_manager/application_manager.h" +#include "application_manager/event_engine/event.h" +#include "application_manager/mock_application.h" +#include "application_manager/mock_hmi_interface.h" +#include "application_manager/mock_message_helper.h" +#include "application_manager/smart_object_keys.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" +#include "utils/data_accessor.h" + +#include "application_manager/mock_app_service_manager.h" +#include "resumption/last_state_impl.h" +#include "resumption/last_state_wrapper_impl.h" + +namespace test { +namespace components { +namespace commands_test { +namespace command_request_impl { + +namespace am = application_manager; +namespace strings = am::strings; +namespace hmi_response = am::hmi_response; + +using ::testing::_; +using ::testing::DoAll; +using ::testing::Return; +using ::testing::SaveArg; +using ::testing::SetArgReferee; + +using am::ApplicationManager; +using am::ApplicationSet; +using am::CommandParametersPermissions; +using am::MockHmiInterfaces; +using am::RPCParams; +using am::commands::CommandImpl; +using am::commands::CommandRequestImpl; +using am::commands::MessageSharedPtr; +using am::commands::RequestFromMobileImpl; +using am::event_engine::EventObserver; +using test::components::application_manager_test::MockAppServiceManager; + +typedef am::commands::CommandRequestImpl::RequestState RequestState; + +namespace { +const uint32_t kConnectionKey = 5u; +const uint32_t kCorrelationId = 3u; +const hmi_apis::FunctionID::eType kInvalidFunctionId = + hmi_apis::FunctionID::INVALID_ENUM; +const std::string kPolicyAppId = "Test"; +const mobile_apis::Result::eType kMobResultSuccess = + mobile_apis::Result::SUCCESS; +const std::string kDisallowedParam1 = "disallowed_param1"; +const std::string kDisallowedParam2 = "disallowed_param2"; +const std::string kAllowedParam = "allowed_param"; +const std::string kUndefinedParam = "undefined_params"; +const std::string kMissedParam = "missed_param"; +const std::string kAppStorageFolder = "app_storage_folder"; +const std::string kAppStorageFile = "./app_info.dat"; +const std::string kAppInfoStorage = "app_info_storage"; +} // namespace + +class RequestFromMobileImplTest + : public CommandRequestTest { + public: + RequestFromMobileImplTest() + : app_set_lock_ptr_(std::make_shared()) {} + + class UnwrappedRequestFromMobileImpl + : public am::commands::RequestFromMobileImpl { + public: + UnwrappedRequestFromMobileImpl( + const MessageSharedPtr& message, + ApplicationManager& ap_man, + am::rpc_service::RPCService& rpc_service, + am::HMICapabilities& hmi_capabilities, + policy::PolicyHandlerInterface& policy_handler) + : am::commands::RequestFromMobileImpl( + message, ap_man, rpc_service, hmi_capabilities, policy_handler) {} + + const RequestState get_current_state() const { + return am::commands::CommandRequestImpl::current_state(); + } + + void change_current_state(const RequestState state) { + am::commands::CommandRequestImpl::set_current_state(state); + } + + CommandParametersPermissions& parameters_permissions() { + return parameters_permissions_; + } + + CommandParametersPermissions& removed_parameters_permissions() { + return removed_parameters_permissions_; + } + + void SetHashUpdateMode(RequestFromMobileImpl::HashUpdateMode mode) { + hash_update_mode_ = mode; + } + + void RemoveDisallowedParameters() { + am::commands::RequestFromMobileImpl::RemoveDisallowedParameters(); + } + + bool HasDisallowedParams() { + return am::commands::RequestFromMobileImpl::HasDisallowedParams(); + } + + void AddDisallowedParameters(smart_objects::SmartObject& response) { + am::commands::RequestFromMobileImpl::AddDisallowedParameters(response); + } + }; + + MockAppPtr InitAppSetDataAccessor(std::shared_ptr& app_set) { + app_set = (!app_set ? std::make_shared() : app_set); + MockAppPtr app(CreateMockApp()); + app_set->insert(app); + EXPECT_CALL(app_mngr_, applications()) + .WillOnce( + Return(DataAccessor(*app_set, app_set_lock_ptr_))); + return app; + } + + std::shared_ptr app_set_lock_ptr_; +}; + +typedef RequestFromMobileImplTest::UnwrappedRequestFromMobileImpl + URequestFromMobileImpl; +typedef std::shared_ptr CommandPtr; + +TEST_F(RequestFromMobileImplTest, WindowID_ExpectDefaultWindowID) { + auto msg = CreateMessage(); + const auto command = CreateCommand(msg); + EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + command->window_id()); +} + +TEST_F(RequestFromMobileImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) { + MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); + (*msg)[strings::params][strings::correlation_id] = kCorrelationId; + (*msg)[strings::params][strings::function_id] = kInvalidFunctionId; + (*msg)[strings::params][strings::connection_key] = kConnectionKey; + + CommandPtr command = CreateCommand(msg); + + MessageSharedPtr dummy_msg(CreateMessage()); + EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) + .WillOnce(Return(dummy_msg)); + + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand(dummy_msg, Command::CommandSource::SOURCE_SDL)); + + command->HandleTimeOut(); + + // If `command` not done till now, then state should change to `kTimedOut` + // and sent it to application manager to deal with it. + EXPECT_EQ(RequestState::kTimedOut, command->get_current_state()); +} + +TEST_F(RequestFromMobileImplTest, CheckSyntax_SUCCESS) { + CommandPtr command = CreateCommand(); + + // Checking message syntax. + const std::string str1("\t\n"); + EXPECT_FALSE(command->CheckSyntax(str1, false)); + const std::string str2("\\n"); + EXPECT_FALSE(command->CheckSyntax(str2, false)); + const std::string str3("\\t"); + EXPECT_FALSE(command->CheckSyntax(str3, false)); + const std::string str4(" "); + EXPECT_FALSE(command->CheckSyntax(str4, false)); + EXPECT_TRUE(command->CheckSyntax(str4, true)); +} + +TEST_F(RequestFromMobileImplTest, GetMobileResultCode_SUCCESS) { + union ResultU { + int32_t value_; + hmi_apis::Common_Result::eType hmi_; + mobile_apis::Result::eType mobile_; + }; + + CommandPtr command = CreateCommand(); + + // Run thru all possible accordance + // of HMI and Mobile result codes. + ResultU result_it; + for (result_it.hmi_ = hmi_apis::Common_Result::SUCCESS; + result_it.value_ < hmi_apis::Common_Result::TRUNCATED_DATA; + ++result_it.value_) { + if (result_it.hmi_ != hmi_apis::Common_Result::NO_DEVICES_CONNECTED && + result_it.hmi_ != hmi_apis::Common_Result::NO_APPS_REGISTERED) { + EXPECT_EQ(result_it.mobile_, + command->GetMobileResultCode(result_it.hmi_)); + } + } + EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, + command->GetMobileResultCode( + hmi_apis::Common_Result::NO_DEVICES_CONNECTED)); + EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, + command->GetMobileResultCode( + hmi_apis::Common_Result::NO_APPS_REGISTERED)); + EXPECT_EQ( + mobile_apis::Result::GENERIC_ERROR, + command->GetMobileResultCode(hmi_apis::Common_Result::TRUNCATED_DATA)); +} + +TEST_F(RequestFromMobileImplTest, BasicMethodsOverloads_SUCCESS) { + CommandPtr command = CreateCommand(); + + // Current implementation always return `true` + EXPECT_TRUE(command->Init()); + EXPECT_TRUE(command->CleanUp()); + EXPECT_NO_THROW(command->Run()); + am::event_engine::Event event(kInvalidFunctionId); + EXPECT_NO_THROW(command->on_event(event)); +} + +TEST_F(RequestFromMobileImplTest, CreateHMINotification_SUCCESS) { + CommandPtr command = CreateCommand(); + + const std::string kTestParamsKey = "test_msg_params"; + + MessageSharedPtr msg_params = CreateMessage(); + (*msg_params)[kTestParamsKey] = 0; + + MessageSharedPtr result; + + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + command->CreateHMINotification(kInvalidFunctionId, *msg_params); + + // Check if message been formed and sent to application manager. + EXPECT_TRUE((*result).keyExists(strings::msg_params)); + EXPECT_TRUE((*result)[strings::msg_params].keyExists(kTestParamsKey)); +} + +TEST_F(RequestFromMobileImplTest, SendHMIRequest_NoUseEvent_SUCCESS) { + CommandPtr command = CreateCommand(); + + EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillOnce(Return(kCorrelationId)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) + .WillRepeatedly( + Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); + // Return `true` prevents call of `SendResponse` method; + + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + + EXPECT_EQ(kCorrelationId, + command->SendHMIRequest(kInvalidFunctionId, NULL, false)); +} + +TEST_F(RequestFromMobileImplTest, SendHMIRequest_UseEvent_SUCCESS) { + CommandPtr command = CreateCommand(); + + EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) + .WillOnce(Return(kCorrelationId)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) + .WillRepeatedly( + Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); + // Return `true` prevents call of `SendResponse` method; + + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); + EXPECT_CALL(event_dispatcher_, add_observer(_, _, _)); + + EXPECT_EQ(kCorrelationId, + command->SendHMIRequest(kInvalidFunctionId, NULL, true)); +} + +TEST_F(RequestFromMobileImplTest, RemoveDisallowedParameters_SUCCESS) { + am::VehicleData vehicle_data; + vehicle_data.insert(am::VehicleData::value_type( + kMissedParam, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); + + EXPECT_CALL(mock_message_helper_, vehicle_data()) + .WillOnce(ReturnRef(vehicle_data)); + + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::msg_params][kDisallowedParam1] = 0u; + (*msg)[strings::msg_params][kDisallowedParam2] = 0u; + (*msg)[strings::msg_params][kAllowedParam] = 0u; + (*msg)[strings::msg_params][kUndefinedParam] = 0u; + (*msg)[strings::msg_params][kMissedParam] = 0u; + + CommandPtr command = CreateCommand(msg); + + CommandParametersPermissions& permission = command->parameters_permissions(); + permission.disallowed_params.insert(kDisallowedParam1); + permission.disallowed_params.insert(kDisallowedParam2); + permission.allowed_params.insert(kAllowedParam); + permission.undefined_params.insert(kUndefinedParam); + + command->RemoveDisallowedParameters(); + + EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kDisallowedParam1)); + EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kDisallowedParam2)); + EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kUndefinedParam)); + EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kMissedParam)); + EXPECT_TRUE((*msg)[strings::msg_params].keyExists(kAllowedParam)); + EXPECT_TRUE(command->HasDisallowedParams()); +} + +TEST_F(RequestFromMobileImplTest, + CheckAllowedParameters_RegisterAppInterface_SUCCESS) { + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::params][strings::function_id] = + mobile_apis::FunctionID::RegisterAppInterfaceID; + + CommandPtr command = CreateCommand(msg); + + EXPECT_CALL(app_mngr_, applications()).Times(0); + EXPECT_TRUE(command->CheckPermissions()); +} + +TEST_F(RequestFromMobileImplTest, + CheckAllowedParameters_NoAppWithSameConnectionKey_UNSUCCESS) { + MessageSharedPtr message = CreateMessage(); + CommandPtr command = CreateCommand(message); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr())); + MessageSharedPtr dummy_msg(CreateMessage()); + EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) + .WillOnce(Return(dummy_msg)); + EXPECT_FALSE(command->CheckPermissions()); +} + +TEST_F(RequestFromMobileImplTest, + CheckAllowedParameters_NoMsgParamsMap_SUCCESS) { + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + ON_CALL(*mock_app, GetWindowIds()) + .WillByDefault(Return( + am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW))); + ON_CALL(*mock_app, + WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillByDefault(Return(true)); + + MessageSharedPtr message = CreateMessage(); + (*message)[strings::msg_params] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + CommandPtr command = CreateCommand(message); + + EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) + .WillOnce(Return(kMobResultSuccess)); + + EXPECT_TRUE(command->CheckPermissions()); +} + +TEST_F(RequestFromMobileImplTest, + CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) { + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + ON_CALL(*mock_app, GetWindowIds()) + .WillByDefault(Return( + am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW))); + ON_CALL(*mock_app, + WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillByDefault(Return(true)); + + MessageSharedPtr message = CreateMessage(); + (*message)[strings::msg_params] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + (*message)[strings::params][strings::message_type] = + mobile_apis::messageType::request; + + CommandPtr command = CreateCommand(message); + + EXPECT_CALL(*mock_app, app_id()) + .Times(1) + .WillRepeatedly(Return(kConnectionKey)); + + EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) + .WillOnce(Return(mobile_apis::Result::INVALID_ENUM)); + + EXPECT_CALL(mock_message_helper_, CreateBlockedByPoliciesResponse(_, _, _, _)) + .WillOnce(Return(smart_objects::SmartObjectSPtr())); + + EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)); + EXPECT_FALSE(command->CheckPermissions()); +} + +ACTION_P(GetArg3, output) { + *output = arg3; +} + +TEST_F(RequestFromMobileImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) { + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::params][strings::connection_key] = kConnectionKey; + (*msg)[strings::msg_params][kPolicyAppId] = true; + + CommandPtr command = CreateCommand(msg); + + MockAppPtr app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); + ON_CALL(*app, GetWindowIds()) + .WillByDefault(Return( + am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW))); + ON_CALL(*app, WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillByDefault(Return(true)); + + RPCParams params; + EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) + .WillOnce(DoAll(GetArg3(¶ms), Return(kMobResultSuccess))); + + EXPECT_TRUE(command->CheckPermissions()); + EXPECT_TRUE(params.end() != + std::find(params.begin(), params.end(), kPolicyAppId)); +} + +TEST_F(RequestFromMobileImplTest, AddDisallowedParameters_SUCCESS) { + am::VehicleData vehicle_data; + vehicle_data.insert(am::VehicleData::value_type( + kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); + + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::params][strings::function_id] = + mobile_apis::FunctionID::SubscribeVehicleDataID; + + CommandPtr command = CreateCommand(msg); + + ON_CALL(mock_message_helper_, vehicle_data()) + .WillByDefault(ReturnRef(vehicle_data)); + + command->removed_parameters_permissions().disallowed_params.insert( + kDisallowedParam1); + + command->AddDisallowedParameters(*msg); + + EXPECT_TRUE((*msg)[strings::msg_params].keyExists(kDisallowedParam1)); +} + +TEST_F(RequestFromMobileImplTest, SendResponse_SUCCESS) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand(msg); + + EXPECT_TRUE(smart_objects::SmartType_Null == (*msg).getType()); + + MessageSharedPtr result; + + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + // Args do not affect on anything in this case; + command->SendResponse(true, kMobResultSuccess, NULL, NULL); + + EXPECT_TRUE(smart_objects::SmartType_Map == (*msg).getType()); +} + +TEST_F(RequestFromMobileImplTest, + SendResponse_AddDisallowedParametersToInfo_SUCCESS) { + am::VehicleData vehicle_data; + vehicle_data.insert(am::VehicleData::value_type( + kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); + + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::params][strings::function_id] = + mobile_apis::FunctionID::SubscribeVehicleDataID; + + CommandPtr command = CreateCommand(msg); + + command->removed_parameters_permissions().disallowed_params.insert( + kDisallowedParam1); + + MessageSharedPtr result; + + ON_CALL(mock_message_helper_, vehicle_data()) + .WillByDefault(ReturnRef(vehicle_data)); + + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + command->SendResponse(true, kMobResultSuccess, NULL, NULL); + + EXPECT_TRUE((*result)[strings::msg_params].keyExists(strings::info)); + EXPECT_FALSE( + (*result)[strings::msg_params][strings::info].asString().empty()); +} + +TEST_F(RequestFromMobileImplTest, HashUpdateAllowed_UpdateExpected) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand(msg); + command->SetHashUpdateMode( + RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate); + + MessageSharedPtr result; + + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + const bool is_succeeded = true; + command->SendResponse(is_succeeded, kMobResultSuccess, NULL, NULL); + + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app)); + EXPECT_CALL(*mock_app, UpdateHash()); + + command.reset(); +} + +TEST_F(RequestFromMobileImplTest, HashUpdateDisallowed_HashUpdateNotExpected) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand(msg); + command->SetHashUpdateMode( + RequestFromMobileImpl::HashUpdateMode::kSkipHashUpdate); + + MessageSharedPtr result; + + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + const bool is_succeeded = true; + command->SendResponse(is_succeeded, kMobResultSuccess, NULL, NULL); + + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(*mock_app, UpdateHash()).Times(0); + + command.reset(); +} + +TEST_F(RequestFromMobileImplTest, RequestFailed_HashUpdateNotExpected) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand(msg); + command->SetHashUpdateMode( + RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate); + + MessageSharedPtr result; + + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + const bool is_succeeded = false; + command->SendResponse(is_succeeded, kMobResultSuccess, NULL, NULL); + + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(*mock_app, UpdateHash()).Times(0); + + command.reset(); +} + +TEST_F(RequestFromMobileImplTest, AppNotFound_HashUpdateNotExpected) { + MessageSharedPtr msg; + CommandPtr command = CreateCommand(msg); + command->SetHashUpdateMode( + RequestFromMobileImpl::HashUpdateMode::kDoHashUpdate); + + MessageSharedPtr result; + + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + const bool is_succeeded = true; + command->SendResponse(is_succeeded, kMobResultSuccess, NULL, NULL); + + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr())); + EXPECT_CALL(*mock_app, UpdateHash()).Times(0); + + command.reset(); +} + +TEST_F(RequestFromMobileImplTest, SendProviderRequest_ByServiceType) { + auto last_state = std::make_shared( + std::make_shared(kAppStorageFolder, + kAppInfoStorage)); + + MockAppServiceManager app_service_manager(app_mngr_, last_state); + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager)); + EXPECT_CALL(app_service_manager, GetProviderByType("MEDIA", _, _, _)) + .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(false))); + + MessageSharedPtr result; + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::params][strings::function_id] = + mobile_apis::FunctionID::GetAppServiceDataID; + (*msg)[strings::msg_params][strings::service_type] = "MEDIA"; + + CommandPtr command = CreateCommand(msg); + command->SendProviderRequest( + mobile_apis::FunctionID::GetAppServiceDataID, + hmi_apis::FunctionID::AppService_GetAppServiceData, + &(*msg), + true); +} + +TEST_F(RequestFromMobileImplTest, SendProviderRequest_ByProviderID) { + auto last_state = std::make_shared( + std::make_shared(kAppStorageFolder, + kAppInfoStorage)); + + MockAppServiceManager app_service_manager(app_mngr_, last_state); + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager)); + EXPECT_CALL(app_service_manager, GetProviderByID("serviceid12345", _, _, _)) + .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(false))); + + MessageSharedPtr result; + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::params][strings::function_id] = + mobile_apis::FunctionID::GetAppServiceDataID; + (*msg)[strings::msg_params][strings::service_id] = "serviceid12345"; + + CommandPtr command = CreateCommand(msg); + command->SendProviderRequest( + mobile_apis::FunctionID::GetAppServiceDataID, + hmi_apis::FunctionID::AppService_GetAppServiceData, + &(*msg), + true); +} + +TEST_F(RequestFromMobileImplTest, SendProviderRequestToHMI_ByProviderID) { + auto last_state = std::make_shared( + std::make_shared(kAppStorageFolder, + kAppInfoStorage)); + + MockAppServiceManager app_service_manager(app_mngr_, last_state); + MockAppPtr mock_app = CreateMockApp(); + EXPECT_CALL(app_mngr_, GetAppServiceManager()) + .WillRepeatedly(ReturnRef(app_service_manager)); + EXPECT_CALL(app_service_manager, GetProviderByID("serviceid12345", _, _, _)) + .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(true))); + + MessageSharedPtr result; + EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) + .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); + + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::params][strings::function_id] = + mobile_apis::FunctionID::GetAppServiceDataID; + (*msg)[strings::msg_params][strings::service_id] = "serviceid12345"; + + CommandPtr command = CreateCommand(msg); + command->SendProviderRequest( + mobile_apis::FunctionID::GetAppServiceDataID, + hmi_apis::FunctionID::AppService_GetAppServiceData, + &(*msg), + true); +} + +} // namespace command_request_impl +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc deleted file mode 100644 index 7beda06d8a..0000000000 --- a/src/components/application_manager/test/commands/command_request_impl_test.cc +++ /dev/null @@ -1,710 +0,0 @@ -/* - * Copyright (c) 2016, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include - -#include "application_manager/commands/command_impl.h" -#include "application_manager/commands/command_request_impl.h" -#include "application_manager/commands/command_request_test.h" -#include "application_manager/commands/commands_test.h" -#include "gtest/gtest.h" -#include "utils/lock.h" - -#include "application_manager/application_manager.h" -#include "application_manager/event_engine/event.h" -#include "application_manager/mock_application.h" -#include "application_manager/mock_hmi_interface.h" -#include "application_manager/mock_message_helper.h" -#include "application_manager/smart_object_keys.h" -#include "interfaces/MOBILE_API.h" -#include "smart_objects/smart_object.h" -#include "utils/data_accessor.h" - -#include "application_manager/mock_app_service_manager.h" -#include "resumption/last_state_impl.h" -#include "resumption/last_state_wrapper_impl.h" - -namespace test { -namespace components { -namespace commands_test { -namespace command_request_impl { - -namespace am = application_manager; -namespace strings = am::strings; -namespace hmi_response = am::hmi_response; - -using ::testing::_; -using ::testing::DoAll; -using ::testing::Return; -using ::testing::SaveArg; -using ::testing::SetArgReferee; - -using am::ApplicationManager; -using am::ApplicationSet; -using am::CommandParametersPermissions; -using am::MockHmiInterfaces; -using am::RPCParams; -using am::commands::CommandImpl; -using am::commands::CommandRequestImpl; -using am::commands::MessageSharedPtr; -using am::event_engine::EventObserver; -using test::components::application_manager_test::MockAppServiceManager; - -typedef am::commands::CommandRequestImpl::RequestState RequestState; - -namespace { -const uint32_t kConnectionKey = 5u; -const uint32_t kCorrelationId = 3u; -const hmi_apis::FunctionID::eType kInvalidFunctionId = - hmi_apis::FunctionID::INVALID_ENUM; -const std::string kPolicyAppId = "Test"; -const mobile_apis::Result::eType kMobResultSuccess = - mobile_apis::Result::SUCCESS; -const std::string kDisallowedParam1 = "disallowed_param1"; -const std::string kDisallowedParam2 = "disallowed_param2"; -const std::string kAllowedParam = "allowed_param"; -const std::string kUndefinedParam = "undefined_params"; -const std::string kMissedParam = "missed_param"; -const std::string kAppStorageFolder = "app_storage_folder"; -const std::string kAppStorageFile = "./app_info.dat"; -const std::string kAppInfoStorage = "app_info_storage"; -} // namespace - -class CommandRequestImplTest - : public CommandRequestTest { - public: - CommandRequestImplTest() - : app_set_lock_ptr_(std::make_shared()) {} - - class UnwrappedCommandRequestImpl : public CommandRequestImpl { - public: - using CommandRequestImpl::AddDisallowedParameters; - using CommandRequestImpl::CheckAllowedParameters; - using CommandRequestImpl::HasDisallowedParams; - using CommandRequestImpl::RemoveDisallowedParameters; - - UnwrappedCommandRequestImpl(const MessageSharedPtr& message, - ApplicationManager& am, - app_mngr::rpc_service::RPCService& rpc_service, - app_mngr::HMICapabilities& hmi_capabilities, - policy::PolicyHandlerInterface& policy_handler) - : CommandRequestImpl( - message, am, rpc_service, hmi_capabilities, policy_handler) {} - - const RequestState current_state() const { - return current_state_; - } - void set_current_state(const RequestState state) { - current_state_ = state; - } - - CommandParametersPermissions& parameters_permissions() { - return parameters_permissions_; - } - - CommandParametersPermissions& removed_parameters_permissions() { - return removed_parameters_permissions_; - } - - void SetHashUpdateMode(HashUpdateMode mode) { - hash_update_mode_ = mode; - } - }; - - MockAppPtr InitAppSetDataAccessor(std::shared_ptr& app_set) { - app_set = (!app_set ? std::make_shared() : app_set); - MockAppPtr app(CreateMockApp()); - app_set->insert(app); - EXPECT_CALL(app_mngr_, applications()) - .WillOnce( - Return(DataAccessor(*app_set, app_set_lock_ptr_))); - return app; - } - - std::shared_ptr app_set_lock_ptr_; -}; - -typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl; -typedef std::shared_ptr CommandPtr; - -TEST_F(CommandRequestImplTest, WindowID_ExpectDefaultWindowID) { - auto msg = CreateMessage(); - const auto command = CreateCommand(msg); - EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW, - command->window_id()); -} - -TEST_F(CommandRequestImplTest, OnTimeOut_StateCompleted_UNSUCCESS) { - CommandPtr command = CreateCommand(); - - // Should be called twice: - // First -- on `onTimeOut` method call - // Second -- on destruction; - EXPECT_CALL(event_dispatcher_, remove_observer(_)).Times(2); - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - - // If `command` already done, then state should change to `kCompleted`. - command->set_current_state(RequestState::kCompleted); - - command->onTimeOut(); - - EXPECT_EQ(RequestState::kCompleted, command->current_state()); -} - -TEST_F(CommandRequestImplTest, OnTimeOut_StateAwaitingHMIResponse_SUCCESS) { - MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); - (*msg)[strings::params][strings::correlation_id] = kCorrelationId; - (*msg)[strings::params][strings::function_id] = kInvalidFunctionId; - (*msg)[strings::params][strings::connection_key] = kConnectionKey; - - CommandPtr command = CreateCommand(msg); - - MessageSharedPtr dummy_msg(CreateMessage()); - EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) - .WillOnce(Return(dummy_msg)); - - EXPECT_CALL( - mock_rpc_service_, - ManageMobileCommand(dummy_msg, Command::CommandSource::SOURCE_SDL)); - - command->onTimeOut(); - - // If `command` not done till now, then state should change to `kTimedOut` - // and sent it to application manager to deal with it. - EXPECT_EQ(RequestState::kTimedOut, command->current_state()); -} - -TEST_F(CommandRequestImplTest, CheckSyntax_SUCCESS) { - CommandPtr command = CreateCommand(); - - // Checking message syntax. - const std::string str1("\t\n"); - EXPECT_FALSE(command->CheckSyntax(str1, false)); - const std::string str2("\\n"); - EXPECT_FALSE(command->CheckSyntax(str2, false)); - const std::string str3("\\t"); - EXPECT_FALSE(command->CheckSyntax(str3, false)); - const std::string str4(" "); - EXPECT_FALSE(command->CheckSyntax(str4, false)); - EXPECT_TRUE(command->CheckSyntax(str4, true)); -} - -TEST_F(CommandRequestImplTest, GetMobileResultCode_SUCCESS) { - union ResultU { - int32_t value_; - hmi_apis::Common_Result::eType hmi_; - mobile_apis::Result::eType mobile_; - }; - - CommandPtr command = CreateCommand(); - - // Run thru all possible accordance - // of HMI and Mobile result codes. - ResultU result_it; - for (result_it.hmi_ = hmi_apis::Common_Result::SUCCESS; - result_it.value_ < hmi_apis::Common_Result::TRUNCATED_DATA; - ++result_it.value_) { - if (result_it.hmi_ != hmi_apis::Common_Result::NO_DEVICES_CONNECTED && - result_it.hmi_ != hmi_apis::Common_Result::NO_APPS_REGISTERED) { - EXPECT_EQ(result_it.mobile_, - command->GetMobileResultCode(result_it.hmi_)); - } - } - EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, - command->GetMobileResultCode( - hmi_apis::Common_Result::NO_DEVICES_CONNECTED)); - EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, - command->GetMobileResultCode( - hmi_apis::Common_Result::NO_APPS_REGISTERED)); - EXPECT_EQ( - mobile_apis::Result::GENERIC_ERROR, - command->GetMobileResultCode(hmi_apis::Common_Result::TRUNCATED_DATA)); -} - -TEST_F(CommandRequestImplTest, BasicMethodsOverloads_SUCCESS) { - CommandPtr command = CreateCommand(); - - // Current implementation always return `true` - EXPECT_TRUE(command->Init()); - EXPECT_TRUE(command->CleanUp()); - EXPECT_NO_THROW(command->Run()); - am::event_engine::Event event(kInvalidFunctionId); - EXPECT_NO_THROW(command->on_event(event)); -} - -TEST_F(CommandRequestImplTest, CreateHMINotification_SUCCESS) { - CommandPtr command = CreateCommand(); - - const std::string kTestParamsKey = "test_msg_params"; - - MessageSharedPtr msg_params = CreateMessage(); - (*msg_params)[kTestParamsKey] = 0; - - MessageSharedPtr result; - - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - command->CreateHMINotification(kInvalidFunctionId, *msg_params); - - // Check if message been formed and sent to application manager. - EXPECT_TRUE((*result).keyExists(strings::msg_params)); - EXPECT_TRUE((*result)[strings::msg_params].keyExists(kTestParamsKey)); -} - -TEST_F(CommandRequestImplTest, SendHMIRequest_NoUseEvent_SUCCESS) { - CommandPtr command = CreateCommand(); - - EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) - .WillOnce(Return(kCorrelationId)); - EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) - .WillRepeatedly( - Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); - EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) - .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); - // Return `true` prevents call of `SendResponse` method; - - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); - - EXPECT_EQ(kCorrelationId, - command->SendHMIRequest(kInvalidFunctionId, NULL, false)); -} - -TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) { - CommandPtr command = CreateCommand(); - - EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) - .WillOnce(Return(kCorrelationId)); - EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) - .WillRepeatedly( - Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication)); - EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) - .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); - // Return `true` prevents call of `SendResponse` method; - - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true)); - EXPECT_CALL(event_dispatcher_, add_observer(_, _, _)); - - EXPECT_EQ(kCorrelationId, - command->SendHMIRequest(kInvalidFunctionId, NULL, true)); -} - -TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) { - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::msg_params][kDisallowedParam1] = 0u; - (*msg)[strings::msg_params][kDisallowedParam2] = 0u; - (*msg)[strings::msg_params][kAllowedParam] = 0u; - (*msg)[strings::msg_params][kUndefinedParam] = 0u; - (*msg)[strings::msg_params][kMissedParam] = 0u; - - CommandPtr command = CreateCommand(msg); - CommandParametersPermissions& permission = command->parameters_permissions(); - permission.disallowed_params.insert(kDisallowedParam1); - permission.disallowed_params.insert(kDisallowedParam2); - permission.allowed_params.insert(kAllowedParam); - permission.undefined_params.insert(kUndefinedParam); - - command->RemoveDisallowedParameters(); - - EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kDisallowedParam1)); - EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kDisallowedParam2)); - EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kUndefinedParam)); - EXPECT_FALSE((*msg)[strings::msg_params].keyExists(kMissedParam)); - EXPECT_TRUE((*msg)[strings::msg_params].keyExists(kAllowedParam)); - EXPECT_TRUE(command->HasDisallowedParams()); -} - -TEST_F(CommandRequestImplTest, - CheckAllowedParameters_RegisterAppInterface_SUCCESS) { - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::function_id] = - mobile_apis::FunctionID::RegisterAppInterfaceID; - - CommandPtr command = CreateCommand(msg); - - EXPECT_CALL(app_mngr_, applications()).Times(0); - EXPECT_TRUE(command->CheckPermissions()); -} - -TEST_F(CommandRequestImplTest, - CheckAllowedParameters_NoAppWithSameConnectionKey_UNSUCCESS) { - MessageSharedPtr message = CreateMessage(); - CommandPtr command = CreateCommand(message); - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr())); - MessageSharedPtr dummy_msg(CreateMessage()); - EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) - .WillOnce(Return(dummy_msg)); - EXPECT_FALSE(command->CheckPermissions()); -} - -TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) { - MockAppPtr mock_app = CreateMockApp(); - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); - ON_CALL(*mock_app, GetWindowIds()) - .WillByDefault(Return( - am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW))); - ON_CALL(*mock_app, - WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillByDefault(Return(true)); - - MessageSharedPtr message = CreateMessage(); - (*message)[strings::msg_params] = - smart_objects::SmartObject(smart_objects::SmartType_Map); - - CommandPtr command = CreateCommand(message); - - EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) - .WillOnce(Return(kMobResultSuccess)); - - EXPECT_TRUE(command->CheckPermissions()); -} - -TEST_F(CommandRequestImplTest, - CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) { - MockAppPtr mock_app = CreateMockApp(); - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); - ON_CALL(*mock_app, GetWindowIds()) - .WillByDefault(Return( - am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW))); - ON_CALL(*mock_app, - WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillByDefault(Return(true)); - - MessageSharedPtr message = CreateMessage(); - (*message)[strings::msg_params] = - smart_objects::SmartObject(smart_objects::SmartType_Map); - (*message)[strings::params][strings::message_type] = - mobile_apis::messageType::request; - - CommandPtr command = CreateCommand(message); - - EXPECT_CALL(*mock_app, app_id()) - .Times(1) - .WillRepeatedly(Return(kConnectionKey)); - - EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) - .WillOnce(Return(mobile_apis::Result::INVALID_ENUM)); - - EXPECT_CALL(mock_message_helper_, CreateBlockedByPoliciesResponse(_, _, _, _)) - .WillOnce(Return(smart_objects::SmartObjectSPtr())); - - EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)); - EXPECT_FALSE(command->CheckPermissions()); -} - -ACTION_P(GetArg3, output) { - *output = arg3; -} - -TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) { - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::connection_key] = kConnectionKey; - (*msg)[strings::msg_params][kPolicyAppId] = true; - - CommandPtr command = CreateCommand(msg); - - MockAppPtr app = CreateMockApp(); - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); - ON_CALL(*app, GetWindowIds()) - .WillByDefault(Return( - am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW))); - ON_CALL(*app, WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillByDefault(Return(true)); - - RPCParams params; - EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _)) - .WillOnce(DoAll(GetArg3(¶ms), Return(kMobResultSuccess))); - - EXPECT_TRUE(command->CheckPermissions()); - EXPECT_TRUE(params.end() != - std::find(params.begin(), params.end(), kPolicyAppId)); -} - -TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) { - am::VehicleData vehicle_data; - vehicle_data.insert(am::VehicleData::value_type( - kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); - - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::function_id] = - mobile_apis::FunctionID::SubscribeVehicleDataID; - - CommandPtr command = CreateCommand(msg); - - ON_CALL(mock_message_helper_, vehicle_data()) - .WillByDefault(ReturnRef(vehicle_data)); - - command->removed_parameters_permissions().disallowed_params.insert( - kDisallowedParam1); - - command->AddDisallowedParameters(*msg); - - EXPECT_TRUE((*msg)[strings::msg_params].keyExists(kDisallowedParam1)); -} - -TEST_F(CommandRequestImplTest, SendResponse_TimedOut_UNSUCCESS) { - CommandPtr command = CreateCommand(); - - command->set_current_state(RequestState::kTimedOut); - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - - // Args do not affect on anything in this case; - command->SendResponse(true, kMobResultSuccess, NULL, NULL); - - EXPECT_EQ(RequestState::kTimedOut, command->current_state()); -} - -TEST_F(CommandRequestImplTest, SendResponse_SUCCESS) { - MessageSharedPtr msg; - CommandPtr command = CreateCommand(msg); - - EXPECT_TRUE(smart_objects::SmartType_Null == (*msg).getType()); - - MessageSharedPtr result; - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - // Args do not affect on anything in this case; - command->SendResponse(true, kMobResultSuccess, NULL, NULL); - - EXPECT_EQ(RequestState::kCompleted, command->current_state()); - - EXPECT_TRUE(smart_objects::SmartType_Map == (*msg).getType()); -} - -TEST_F(CommandRequestImplTest, - SendResponse_AddDisallowedParametersToInfo_SUCCESS) { - am::VehicleData vehicle_data; - vehicle_data.insert(am::VehicleData::value_type( - kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); - - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::function_id] = - mobile_apis::FunctionID::SubscribeVehicleDataID; - - CommandPtr command = CreateCommand(msg); - - command->removed_parameters_permissions().disallowed_params.insert( - kDisallowedParam1); - - MessageSharedPtr result; - - ON_CALL(mock_message_helper_, vehicle_data()) - .WillByDefault(ReturnRef(vehicle_data)); - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - command->SendResponse(true, kMobResultSuccess, NULL, NULL); - - EXPECT_EQ(RequestState::kCompleted, command->current_state()); - - EXPECT_TRUE((*result)[strings::msg_params].keyExists(strings::info)); - EXPECT_FALSE( - (*result)[strings::msg_params][strings::info].asString().empty()); -} - -TEST_F(CommandRequestImplTest, HashUpdateAllowed_UpdateExpected) { - MessageSharedPtr msg; - CommandPtr command = CreateCommand(msg); - command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); - - MessageSharedPtr result; - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - const bool is_succeeded = true; - command->SendResponse(is_succeeded, kMobResultSuccess, NULL, NULL); - - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app)); - EXPECT_CALL(*mock_app, UpdateHash()); - - command.reset(); -} - -TEST_F(CommandRequestImplTest, HashUpdateDisallowed_HashUpdateNotExpected) { - MessageSharedPtr msg; - CommandPtr command = CreateCommand(msg); - command->SetHashUpdateMode( - CommandRequestImpl::HashUpdateMode::kSkipHashUpdate); - - MessageSharedPtr result; - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - const bool is_succeeded = true; - command->SendResponse(is_succeeded, kMobResultSuccess, NULL, NULL); - - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(*mock_app, UpdateHash()).Times(0); - - command.reset(); -} - -TEST_F(CommandRequestImplTest, RequestFailed_HashUpdateNotExpected) { - MessageSharedPtr msg; - CommandPtr command = CreateCommand(msg); - command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); - - MessageSharedPtr result; - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - const bool is_succeeded = false; - command->SendResponse(is_succeeded, kMobResultSuccess, NULL, NULL); - - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(*mock_app, UpdateHash()).Times(0); - - command.reset(); -} - -TEST_F(CommandRequestImplTest, AppNotFound_HashUpdateNotExpected) { - MessageSharedPtr msg; - CommandPtr command = CreateCommand(msg); - command->SetHashUpdateMode(CommandRequestImpl::HashUpdateMode::kDoHashUpdate); - - MessageSharedPtr result; - - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - const bool is_succeeded = true; - command->SendResponse(is_succeeded, kMobResultSuccess, NULL, NULL); - - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(MockAppPtr())); - EXPECT_CALL(*mock_app, UpdateHash()).Times(0); - - command.reset(); -} - -TEST_F(CommandRequestImplTest, SendProviderRequest_ByServiceType) { - auto last_state = std::make_shared( - std::make_shared(kAppStorageFolder, - kAppInfoStorage)); - - MockAppServiceManager app_service_manager(app_mngr_, last_state); - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, GetAppServiceManager()) - .WillRepeatedly(ReturnRef(app_service_manager)); - EXPECT_CALL(app_service_manager, GetProviderByType("MEDIA", _, _, _)) - .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(false))); - - MessageSharedPtr result; - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::function_id] = - mobile_apis::FunctionID::GetAppServiceDataID; - (*msg)[strings::msg_params][strings::service_type] = "MEDIA"; - - CommandPtr command = CreateCommand(msg); - command->SendProviderRequest( - mobile_apis::FunctionID::GetAppServiceDataID, - hmi_apis::FunctionID::AppService_GetAppServiceData, - &(*msg), - true); -} - -TEST_F(CommandRequestImplTest, SendProviderRequest_ByProviderID) { - auto last_state = std::make_shared( - std::make_shared(kAppStorageFolder, - kAppInfoStorage)); - - MockAppServiceManager app_service_manager(app_mngr_, last_state); - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, GetAppServiceManager()) - .WillRepeatedly(ReturnRef(app_service_manager)); - EXPECT_CALL(app_service_manager, GetProviderByID("serviceid12345", _, _, _)) - .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(false))); - - MessageSharedPtr result; - EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::function_id] = - mobile_apis::FunctionID::GetAppServiceDataID; - (*msg)[strings::msg_params][strings::service_id] = "serviceid12345"; - - CommandPtr command = CreateCommand(msg); - command->SendProviderRequest( - mobile_apis::FunctionID::GetAppServiceDataID, - hmi_apis::FunctionID::AppService_GetAppServiceData, - &(*msg), - true); -} - -TEST_F(CommandRequestImplTest, SendProviderRequestToHMI_ByProviderID) { - auto last_state = std::make_shared( - std::make_shared(kAppStorageFolder, - kAppInfoStorage)); - - MockAppServiceManager app_service_manager(app_mngr_, last_state); - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, GetAppServiceManager()) - .WillRepeatedly(ReturnRef(app_service_manager)); - EXPECT_CALL(app_service_manager, GetProviderByID("serviceid12345", _, _, _)) - .WillOnce(DoAll(SetArgReferee<2>(mock_app), SetArgReferee<3>(true))); - - MessageSharedPtr result; - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)) - .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - - MessageSharedPtr msg = CreateMessage(); - (*msg)[strings::params][strings::function_id] = - mobile_apis::FunctionID::GetAppServiceDataID; - (*msg)[strings::msg_params][strings::service_id] = "serviceid12345"; - - CommandPtr command = CreateCommand(msg); - command->SendProviderRequest( - mobile_apis::FunctionID::GetAppServiceDataID, - hmi_apis::FunctionID::AppService_GetAppServiceData, - &(*msg), - true); -} - -} // namespace command_request_impl -} // namespace commands_test -} // namespace components -} // namespace test diff --git a/src/components/application_manager/test/event_engine_test.cc b/src/components/application_manager/test/event_engine_test.cc index 6746e0d5ec..506eed1870 100644 --- a/src/components/application_manager/test/event_engine_test.cc +++ b/src/components/application_manager/test/event_engine_test.cc @@ -125,7 +125,7 @@ class EventEngineTest : public testing::Test { event_id, correlation_id, event_observer_mock_); event_->set_smart_object(so); - EXPECT_CALL(event_observer_mock_, on_event(An())) + EXPECT_CALL(event_observer_mock_, HandleOnEvent(An())) .Times(calls_number); event_dispatcher_instance_->raise_event(*event_); } diff --git a/src/components/application_manager/test/hmi_language_handler_test.cc b/src/components/application_manager/test/hmi_language_handler_test.cc index 59913b19be..368f77ce8a 100644 --- a/src/components/application_manager/test/hmi_language_handler_test.cc +++ b/src/components/application_manager/test/hmi_language_handler_test.cc @@ -143,10 +143,10 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllLanguageIsReceivedAndSame_SUCCESS) { // Repeatedly add events to set `is_*_language_received_` flags up Event ui_event(hmi_apis::FunctionID::UI_GetLanguage); - hmi_language_handler_->on_event(ui_event); + hmi_language_handler_->HandleOnEvent(ui_event); Event vr_event(hmi_apis::FunctionID::VR_GetLanguage); - hmi_language_handler_->on_event(vr_event); + hmi_language_handler_->HandleOnEvent(vr_event); // After last flag gets up, `VerifyWithPersistedLanguages` // method been called to and then will call `hmi_capabilities` @@ -173,14 +173,14 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllLanguageIsReceivedAndSame_SUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0); Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage); - hmi_language_handler_->on_event(tts_event); + hmi_language_handler_->HandleOnEvent(tts_event); } TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_SUCCESS) { Event ui_event(hmi_apis::FunctionID::UI_GetLanguage); - hmi_language_handler_->on_event(ui_event); + hmi_language_handler_->HandleOnEvent(ui_event); Event vr_event(hmi_apis::FunctionID::VR_GetLanguage); - hmi_language_handler_->on_event(vr_event); + hmi_language_handler_->HandleOnEvent(vr_event); ON_CALL(app_manager_, hmi_capabilities()) .WillByDefault(ReturnRef(hmi_capabilities_)); @@ -212,14 +212,14 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_SUCCESS) { EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0); Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage); - hmi_language_handler_->on_event(tts_event); + hmi_language_handler_->HandleOnEvent(tts_event); } TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_UNSUCCESS) { Event ui_event(hmi_apis::FunctionID::UI_GetLanguage); - hmi_language_handler_->on_event(ui_event); + hmi_language_handler_->HandleOnEvent(ui_event); Event vr_event(hmi_apis::FunctionID::VR_GetLanguage); - hmi_language_handler_->on_event(vr_event); + hmi_language_handler_->HandleOnEvent(vr_event); ON_CALL(app_manager_, hmi_capabilities()) .WillByDefault(ReturnRef(hmi_capabilities_)); @@ -242,7 +242,7 @@ TEST_F(HmiLanguageHandlerTest, OnEvent_AllReceivedLanguagesMismatch_UNSUCCESS) { ON_CALL(app_manager_, applications()).WillByDefault(Return(data_accessor)); Event tts_event(hmi_apis::FunctionID::TTS_GetLanguage); - hmi_language_handler_->on_event(tts_event); + hmi_language_handler_->HandleOnEvent(tts_event); } TEST_F(HmiLanguageHandlerTest, @@ -299,7 +299,7 @@ TEST_F(HmiLanguageHandlerTest, event.set_smart_object(msg); EXPECT_CALL(app_manager_, hmi_capabilities()).Times(0); - hmi_language_handler_->on_event(event); + hmi_language_handler_->HandleOnEvent(event); EXPECT_CALL(app_manager_, hmi_capabilities()) .WillOnce(ReturnRef(hmi_capabilities_)); @@ -327,7 +327,7 @@ TEST_F(HmiLanguageHandlerTest, .WillRepeatedly(ReturnRef(mock_rpc_service_)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(2); EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(1); - hmi_language_handler_->on_event(event); + hmi_language_handler_->HandleOnEvent(event); } TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) { @@ -339,7 +339,7 @@ TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) { event.set_smart_object(msg); EXPECT_CALL(app_manager_, hmi_capabilities()).Times(0); - hmi_language_handler_->on_event(event); + hmi_language_handler_->HandleOnEvent(event); hmi_language_handler_->OnUnregisterApplication(app_id); @@ -356,7 +356,7 @@ TEST_F(HmiLanguageHandlerTest, OnUnregisterApp_SUCCESS) { EXPECT_CALL(app_manager_, GetRPCService()).Times(0); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(app_manager_, UnregisterApplication(_, _, _, _)).Times(0); - hmi_language_handler_->on_event(event); + hmi_language_handler_->HandleOnEvent(event); } } // namespace hmi_language_handler } // namespace components diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h index 2087ef8f28..b7d4608a25 100644 --- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h @@ -41,6 +41,7 @@ #include "application_manager/mock_application_manager.h" #include "application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_rpc_service.h" #include "application_manager/policies/mock_policy_handler_interface.h" @@ -69,6 +70,7 @@ using ::test::components::application_manager_test::MockApplication; using ::test::components::application_manager_test::MockApplicationManager; using ::test::components::application_manager_test:: MockApplicationManagerSettings; +using ::test::components::event_engine_test::MockEventDispatcher; // Depending on the value type will be selected template @@ -146,6 +148,23 @@ class CommandsTest : public ::testing::Test { mock_policy_handler_); } + void InitEventDispatcher() { + ON_CALL(app_mngr_, event_dispatcher()) + .WillByDefault(ReturnRef(event_dispatcher_)); + } + + void InitNegativeResponse() { + MessageSharedPtr timeout_response = + CommandsTest::CreateMessage(smart_objects::SmartType_Map); + (*timeout_response)[am::strings::msg_params][am::strings::result_code] = + am::mobile_api::Result::GENERIC_ERROR; + (*timeout_response)[am::strings::msg_params][am::strings::success] = false; + + ON_CALL(mock_message_helper_, + CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR)) + .WillByDefault(Return(timeout_response)); + } + enum { kDefaultTimeout_ = 100, kDefaultTimeoutCompensation_ = 10 }; MockAppManager app_mngr_; @@ -155,6 +174,7 @@ class CommandsTest : public ::testing::Test { testing::NiceMock mock_policy_handler_; MockAppManagerSettings app_mngr_settings_; + MockEventDispatcher event_dispatcher_; MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; am::MockMessageHelper& mock_message_helper_; diff --git a/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h index b345f53c1c..f0f8bd8dd1 100644 --- a/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h +++ b/src/components/application_manager/test/include/application_manager/mock_event_dispatcher.h @@ -57,6 +57,10 @@ class MockEventDispatcher remove_observer, void(const ::application_manager::event_engine::Event::EventID& event_id, ::application_manager::event_engine::EventObserver& observer)); + MOCK_METHOD2( + remove_observer, + void(const ::application_manager::event_engine::Event::EventID& event_id, + int32_t hmi_correlation_id)); MOCK_METHOD1( remove_observer, void(::application_manager::event_engine::EventObserver& observer)); diff --git a/src/components/application_manager/test/include/application_manager/mock_event_observer.h b/src/components/application_manager/test/include/application_manager/mock_event_observer.h index 1357d67a65..7ac9223e41 100644 --- a/src/components/application_manager/test/include/application_manager/mock_event_observer.h +++ b/src/components/application_manager/test/include/application_manager/mock_event_observer.h @@ -50,8 +50,10 @@ class MockEventObserver MOCK_METHOD1(on_event, void(const application_manager::event_engine::Event& event)); MOCK_METHOD1( - on_event, + HandleOnEvent, void(const application_manager::event_engine::MobileEvent& event)); + MOCK_METHOD1(HandleOnEvent, + void(const application_manager::event_engine::Event& event)); }; } // namespace event_engine_test diff --git a/src/components/application_manager/test/include/application_manager/mock_request.h b/src/components/application_manager/test/include/application_manager/mock_request.h index c1cc7f601f..4348e39020 100644 --- a/src/components/application_manager/test/include/application_manager/mock_request.h +++ b/src/components/application_manager/test/include/application_manager/mock_request.h @@ -56,9 +56,10 @@ class MockRequest : public application_manager::commands::Command { MOCK_CONST_METHOD0(default_timeout, uint32_t()); MOCK_CONST_METHOD0(function_id, int32_t()); MOCK_CONST_METHOD0(window_id, application_manager::WindowID()); + MOCK_METHOD0(HandleTimeOut, void()); + MOCK_METHOD0(OnUpdateTimeOut, void()); MOCK_METHOD1(set_warning_info, void(const std::string info)); MOCK_CONST_METHOD0(warning_info, std::string()); - MOCK_METHOD0(onTimeOut, void()); MOCK_METHOD0(AllowedToTerminate, bool()); MOCK_METHOD1(SetAllowedToTerminate, void(bool is_allowed)); diff --git a/src/components/application_manager/test/mobile_event_engine_test.cc b/src/components/application_manager/test/mobile_event_engine_test.cc index cad1ff14ff..56824b7020 100644 --- a/src/components/application_manager/test/mobile_event_engine_test.cc +++ b/src/components/application_manager/test/mobile_event_engine_test.cc @@ -116,7 +116,7 @@ class MobileEventEngineTest : public testing::Test { event_dispatcher_instance_->add_mobile_observer( event_id, correlation_id, event_observer_mock_); event_->set_smart_object(so); - EXPECT_CALL(event_observer_mock_, on_event(An())) + EXPECT_CALL(event_observer_mock_, HandleOnEvent(An())) .Times(calls_number); event_dispatcher_instance_->raise_mobile_event(*event_); } diff --git a/src/components/application_manager/test/policy_event_observer_test.cc b/src/components/application_manager/test/policy_event_observer_test.cc index 22d7a8cfa0..e42c7648b9 100644 --- a/src/components/application_manager/test/policy_event_observer_test.cc +++ b/src/components/application_manager/test/policy_event_observer_test.cc @@ -89,7 +89,7 @@ class PolicyEventObserverTest : public ::testing::Test { EXPECT_CALL(policy_handler_mock_, PTUpdatedAt(Counters::KILOMETERS, field_value)) .Times(pt_updated_calls_number); - policy_event_observer_->on_event(*event_); + policy_event_observer_->HandleOnEvent(*event_); } void DeleteEvent() { diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index 1836e2e87f..353f3f05b7 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -199,7 +199,9 @@ class PolicyHandlerTest : public ::testing::Test { virtual void TearDown() OVERRIDE { Mock::VerifyAndClearExpectations(&mock_message_helper_); - ON_CALL(mock_event_dispatcher_, remove_observer(_, _)); + ON_CALL( + mock_event_dispatcher_, + remove_observer(_, testing::Matcher(_))); } void ChangePolicyManagerToMock() { diff --git a/src/components/application_manager/test/request_controller/request_controller_test.cc b/src/components/application_manager/test/request_controller/request_controller_test.cc index ccb7788b3d..2de2a69cf7 100644 --- a/src/components/application_manager/test/request_controller/request_controller_test.cc +++ b/src/components/application_manager/test/request_controller/request_controller_test.cc @@ -51,6 +51,7 @@ #include "application_manager/policies/policy_handler.h" #include "application_manager/resumption/resume_ctrl.h" #include "application_manager/state_controller.h" +#include "application_manager/test/include/application_manager/mock_event_dispatcher.h" #include "resumption/last_state.h" #include "utils/test_async_waiter.h" @@ -63,6 +64,7 @@ using ::application_manager::request_controller::RequestControllerImpl; using ::application_manager::request_controller::RequestInfo; using test::components::application_manager_test::MockRequestTimeoutHandler; +using ::test::components::event_engine_test::MockEventDispatcher; using ::testing::_; using ::testing::NiceMock; using ::testing::Return; @@ -109,7 +111,9 @@ class RequestControllerTestClass : public ::testing::Test { ON_CALL(mock_request_controller_settings_, thread_pool_size()) .WillByDefault(Return(kThreadPoolSize)); request_ctrl_ = std::make_shared( - mock_request_controller_settings_, mock_request_timeout_handler_); + mock_request_controller_settings_, + mock_request_timeout_handler_, + mock_event_dispatcher_); } RequestPtr GetMockRequest( @@ -159,6 +163,7 @@ class RequestControllerTestClass : public ::testing::Test { NiceMock mock_request_controller_settings_; + NiceMock mock_event_dispatcher_; MockRequestTimeoutHandler mock_request_timeout_handler_; RequestControllerSPtr request_ctrl_; RequestPtr empty_mock_request_; @@ -294,7 +299,7 @@ TEST_F(RequestControllerTestClass, OnTimer_SUCCESS) { mock_request, RequestInfo::RequestType::MobileRequest)); - EXPECT_CALL(*mock_request, onTimeOut()) + EXPECT_CALL(*mock_request, HandleTimeOut()) .WillOnce(NotifyTestAsyncWaiter(waiter)); // Waiting for call of `onTimeOut` for `kTimeScale` seconds diff --git a/src/components/application_manager/test/request_timeout_handler_test.cc b/src/components/application_manager/test/request_timeout_handler_test.cc index c045a653aa..b1acec5eb3 100644 --- a/src/components/application_manager/test/request_timeout_handler_test.cc +++ b/src/components/application_manager/test/request_timeout_handler_test.cc @@ -173,7 +173,7 @@ TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_SUCCESS) { ASSERT_TRUE(command->Init()); command->Run(); - request_timeout_handler_->on_event(event); + request_timeout_handler_->HandleOnEvent(event); } TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_MissedResetPeriod) { @@ -221,7 +221,7 @@ TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_MissedResetPeriod) { ASSERT_TRUE(command->Init()); command->Run(); - request_timeout_handler_->on_event(event); + request_timeout_handler_->HandleOnEvent(event); } TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidRequestId) { @@ -260,7 +260,7 @@ TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidRequestId) { ASSERT_TRUE(command->Init()); command->Run(); - request_timeout_handler_->on_event(event); + request_timeout_handler_->HandleOnEvent(event); } TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidMethodName) { @@ -299,7 +299,7 @@ TEST_F(RequestTimeoutHandlerTest, OnEvent_OnResetTimeout_InvalidMethodName) { ASSERT_TRUE(command->Init()); command->Run(); - request_timeout_handler_->on_event(event); + request_timeout_handler_->HandleOnEvent(event); } } // namespace request_timeout_handler_test } // namespace components diff --git a/src/components/application_manager/test/rpc_service_impl_test.cc b/src/components/application_manager/test/rpc_service_impl_test.cc index 76f1f05342..cdfc6114e9 100644 --- a/src/components/application_manager/test/rpc_service_impl_test.cc +++ b/src/components/application_manager/test/rpc_service_impl_test.cc @@ -43,6 +43,7 @@ #include "application_manager/mock_application_manager.h" #include "application_manager/mock_command_factory.h" #include "application_manager/mock_command_holder.h" +#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_message_helper.h" #include "application_manager/mock_request.h" #include "application_manager/mock_request_controller_settings.h" @@ -69,6 +70,7 @@ typedef smart_objects::SmartObjectSPtr MessageSharedPtr; typedef utils::Optional PluginOpt; using test::components::application_manager_test::MockAppServiceManager; using test::components::application_manager_test::MockRequestTimeoutHandler; +using test::components::event_engine_test::MockEventDispatcher; using ::testing::_; using ::testing::NiceMock; using ::testing::Return; @@ -90,7 +92,8 @@ class RPCServiceImplTest : public ::testing::Test { public: RPCServiceImplTest() : request_controller_(mock_request_controler_, - mock_request_timeout_handler_) + mock_request_timeout_handler_, + mock_event_dispatcher_) , mock_rpc_protection_manager_( std::make_shared< testing::NiceMock >()) @@ -151,6 +154,7 @@ class RPCServiceImplTest : public ::testing::Test { testing::NiceMock mock_protocol_handler_; am::request_controller::RequestControllerImpl request_controller_; testing::NiceMock mock_hmi_handler_; + MockEventDispatcher mock_event_dispatcher_; testing::NiceMock mock_command_holder_; std::shared_ptr mock_rpc_protection_manager_; std::shared_ptr rpc_service_; diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc index fa301e73ca..b6ec4fc8ef 100644 --- a/src/components/application_manager/test/state_controller/state_controller_test.cc +++ b/src/components/application_manager/test/state_controller/state_controller_test.cc @@ -1303,12 +1303,12 @@ class StateControllerImplTest : public ::testing::Test { switch (state_id) { case am::HmiState::StateID::STATE_ID_VR_SESSION: { Event vr_start_event(FunctionID::VR_Started); - state_ctrl_->on_event(vr_start_event); + state_ctrl_->HandleOnEvent(vr_start_event); break; } case am::HmiState::StateID::STATE_ID_TTS_SESSION: { Event tts_start_event(FunctionID::TTS_Started); - state_ctrl_->on_event(tts_start_event); + state_ctrl_->HandleOnEvent(tts_start_event); break; } case am::HmiState::StateID::STATE_ID_PHONE_CALL: { @@ -1319,7 +1319,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; phone_call_event.set_smart_object(message); - state_ctrl_->on_event(phone_call_event); + state_ctrl_->HandleOnEvent(phone_call_event); break; } case am::HmiState::StateID::STATE_ID_SAFETY_MODE: { @@ -1330,7 +1330,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMERGENCY_EVENT; emergency_event.set_smart_object(message); - state_ctrl_->on_event(emergency_event); + state_ctrl_->HandleOnEvent(emergency_event); break; } case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: { @@ -1374,12 +1374,12 @@ class StateControllerImplTest : public ::testing::Test { switch (state_id) { case am::HmiState::StateID::STATE_ID_VR_SESSION: { Event vr_start_event(FunctionID::VR_Started); - state_ctrl_->on_event(vr_start_event); + state_ctrl_->HandleOnEvent(vr_start_event); break; } case am::HmiState::StateID::STATE_ID_TTS_SESSION: { Event tts_start_event(FunctionID::TTS_Started); - state_ctrl_->on_event(tts_start_event); + state_ctrl_->HandleOnEvent(tts_start_event); break; } case am::HmiState::StateID::STATE_ID_PHONE_CALL: { @@ -1390,7 +1390,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; phone_call_event.set_smart_object(message); - state_ctrl_->on_event(phone_call_event); + state_ctrl_->HandleOnEvent(phone_call_event); break; } case am::HmiState::StateID::STATE_ID_SAFETY_MODE: { @@ -1401,7 +1401,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMERGENCY_EVENT; emergency_event.set_smart_object(message); - state_ctrl_->on_event(emergency_event); + state_ctrl_->HandleOnEvent(emergency_event); break; } case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: { @@ -1427,12 +1427,12 @@ class StateControllerImplTest : public ::testing::Test { switch (state_id) { case am::HmiState::StateID::STATE_ID_VR_SESSION: { Event vr_stop_event(FunctionID::VR_Stopped); - state_ctrl_->on_event(vr_stop_event); + state_ctrl_->HandleOnEvent(vr_stop_event); break; } case am::HmiState::StateID::STATE_ID_TTS_SESSION: { Event tts_stop_event(FunctionID::TTS_Stopped); - state_ctrl_->on_event(tts_stop_event); + state_ctrl_->HandleOnEvent(tts_stop_event); break; } case am::HmiState::StateID::STATE_ID_PHONE_CALL: { @@ -1443,7 +1443,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; phone_call_event.set_smart_object(message); - state_ctrl_->on_event(phone_call_event); + state_ctrl_->HandleOnEvent(phone_call_event); break; } case am::HmiState::StateID::STATE_ID_SAFETY_MODE: { @@ -1454,7 +1454,7 @@ class StateControllerImplTest : public ::testing::Test { message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMERGENCY_EVENT; emergency_event.set_smart_object(message); - state_ctrl_->on_event(emergency_event); + state_ctrl_->HandleOnEvent(emergency_event); break; } case am::HmiState::StateID::STATE_ID_NAVI_STREAMING: { @@ -2295,7 +2295,7 @@ TEST_F(StateControllerImplTest, ActivateAppSuccessReceivedFromHMI) { am::event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_ActivateApp); event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } } @@ -2357,7 +2357,7 @@ TEST_F(StateControllerImplTest, SendEventBCActivateApp_HMIReceivesError) { message[am::strings::params][am::strings::correlation_id] = corr_id; am::event_engine::Event event(FunctionID::BasicCommunication_ActivateApp); event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } } @@ -2381,7 +2381,7 @@ TEST_F(StateControllerImplTest, ActivateAppInvalidCorrelationId) { message[am::strings::params][am::strings::correlation_id] = corr_id; am::event_engine::Event event(FunctionID::BasicCommunication_ActivateApp); event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, ApplyTempStatesForSimpleApp) { @@ -2875,7 +2875,7 @@ TEST_F(StateControllerImplTest, // Precondition am::event_engine::Event event(hmi_apis::FunctionID::VR_Started); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); HmiStatePtr check_state = FullNotAudibleState(); @@ -2909,10 +2909,10 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) { // Precondition am::event_engine::Event prev_event(hmi_apis::FunctionID::VR_Started); - state_ctrl_->on_event(prev_event); + state_ctrl_->HandleOnEvent(prev_event); am::event_engine::Event next_event(hmi_apis::FunctionID::VR_Stopped); - state_ctrl_->on_event(next_event); + state_ctrl_->HandleOnEvent(next_event); // Set state of non-media app after vr has stopped HmiStatePtr check_state = FullNotAudibleState(); @@ -2973,7 +2973,7 @@ TEST_F(StateControllerImplTest, Common_EventTypes::EMERGENCY_EVENT; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); // Non-media app can't have LIMITED-AUDIO state HmiStatePtr check_state = FullNotAudibleState(); @@ -3021,7 +3021,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr check_state = FullAudibleState(); @@ -3057,7 +3057,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr hmi_state = FullAudibleState(); @@ -3091,7 +3091,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr hmi_state = FullAudibleState(); @@ -3128,7 +3128,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr hmi_state = FullAudibleState(); @@ -3165,7 +3165,7 @@ TEST_F(StateControllerImplTest, hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(message); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); am::HmiStatePtr hmi_state = FullAudibleState(); @@ -3220,7 +3220,7 @@ TEST_F(StateControllerImplTest, am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_FULL); EXPECT_EQ(new_state->audio_streaming_state(), @@ -3255,7 +3255,7 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) { am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_BACKGROUND); EXPECT_EQ(new_state->audio_streaming_state(), @@ -3287,7 +3287,7 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceNavAppToLimited) { am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*navi_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); EXPECT_EQ(new_state->hmi_level(), mobile_apis::HMILevel::HMI_LIMITED); EXPECT_EQ(new_state->audio_streaming_state(), @@ -3308,12 +3308,13 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectHmiLevel) { .WillOnce(Return(simple_app_)); EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId)) .WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND)); + EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0); am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) { @@ -3327,7 +3328,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) { EXPECT_CALL(app_manager_mock_, application(_)) .WillOnce(Return(incorrect_app)); EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId)).Times(0); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) { @@ -3361,7 +3362,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) { am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) { @@ -3396,7 +3397,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) { am::WindowIds window_ids = {kDefaultWindowId}; EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids)); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) { @@ -3411,7 +3412,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) { EXPECT_CALL(app_manager_mock_, application(_)) .WillOnce(Return(incorrect_app)); EXPECT_CALL(*simple_app_ptr_, app_id()).Times(0); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } TEST_F(StateControllerImplTest, OnEventOnAppActivated) { @@ -3449,7 +3450,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivated) { std::make_shared(); (*activate_app)[am::strings::params][am::strings::correlation_id] = kCorrID; SetBCActivateAppRequestToHMI(hmi_apis::Common_HMILevel::FULL, kCorrID); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); } } @@ -3485,7 +3486,7 @@ TEST_F(StateControllerImplTest, IsStateActiveApplyNotCorrectTempStates) { const hmi_apis::FunctionID::eType event_id = hmi_apis::FunctionID::VR_Started; am::event_engine::Event event(event_id); event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); EXPECT_FALSE(state_ctrl_->IsStateActive(HmiState::STATE_ID_AUDIO_SOURCE)); } @@ -3502,19 +3503,19 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) { msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::AUDIO_SOURCE; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::DEACTIVATE_HMI; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMBEDDED_NAVI; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); const am::HmiStatePtr old_state = CreateHmiStateByHmiStateType( mobile_apis::HMILevel::HMI_FULL, @@ -3565,11 +3566,11 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) { msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::AUDIO_SOURCE; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); msg[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::PHONE_CALL; event.set_smart_object(msg); - state_ctrl_->on_event(event); + state_ctrl_->HandleOnEvent(event); const am::HmiStatePtr old_state = CreateHmiStateByHmiStateType( mobile_apis::HMILevel::HMI_FULL, @@ -3612,7 +3613,7 @@ TEST_F( message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::AUDIO_SOURCE; audio_source_event.set_smart_object(message); - state_ctrl_->on_event(audio_source_event); + state_ctrl_->HandleOnEvent(audio_source_event); EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true)); EXPECT_CALL(*media_app_ptr_, SetRegularState(_, _)).Times(0); @@ -3633,7 +3634,7 @@ TEST_F( message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::EMBEDDED_NAVI; embedded_navi_event.set_smart_object(message); - state_ctrl_->on_event(embedded_navi_event); + state_ctrl_->HandleOnEvent(embedded_navi_event); EXPECT_CALL(*media_wep_app_ptr_, is_resuming()) .Times(2) @@ -3733,7 +3734,7 @@ TEST_F(StateControllerImplTest, ExpectAppWontChangeHmiStateDueToConflictResolving( simple_app_, simple_app_ptr_, kCustomWindowId, NoneNotAudibleState()); - state_ctrl_->on_event(activate_widget_event); + state_ctrl_->HandleOnEvent(activate_widget_event); } TEST_F(StateControllerImplTest, @@ -3774,7 +3775,7 @@ TEST_F(StateControllerImplTest, GetBCActivateAppRequestToHMI(_, _, _, _, _)) .Times(0); - state_ctrl_->on_event(activate_widget_event); + state_ctrl_->HandleOnEvent(activate_widget_event); } } @@ -3795,7 +3796,7 @@ TEST_F(StateControllerImplTest, ExpectAppWontChangeHmiStateDueToConflictResolving( simple_app_, simple_app_ptr_, kCustomWindowId, FullNotAudibleState()); - state_ctrl_->on_event(activate_widget_event); + state_ctrl_->HandleOnEvent(activate_widget_event); } TEST_F(StateControllerImplTest, @@ -3836,7 +3837,7 @@ TEST_F(StateControllerImplTest, GetBCActivateAppRequestToHMI(_, _, _, _, _)) .Times(0); - state_ctrl_->on_event(activate_widget_event); + state_ctrl_->HandleOnEvent(activate_widget_event); } } @@ -3920,7 +3921,7 @@ TEST_F(StateControllerImplTest, message[am::strings::msg_params][am::hmi_notification::event_name] = hmi_apis::Common_EventTypes::AUDIO_SOURCE; audio_source_event.set_smart_object(message); - state_ctrl_->on_event(audio_source_event); + state_ctrl_->HandleOnEvent(audio_source_event); HmiStatePtr initial_state = createHmiState(mobile_apis::HMILevel::INVALID_ENUM, diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index 72a322f336..ba58fd203c 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -709,6 +709,36 @@ class ApplicationManager { const uint32_t corr_id, const int32_t function_id) = 0; + /** + * @brief RetainRequestInstance retains request instance by its + * connection+correlation key + * @param connection_key connection key of application + * @param correlation_id correlation id of request + * @return true if request was rerained. false if the request with such + * connection+correlation key was not found + */ + virtual bool RetainRequestInstance(const uint32_t connection_key, + const uint32_t correlation_id) = 0; + + /** + * @brief RemoveRetainedRequest removes request instance retained before + * @param connection_key connection key of application + * @param correlation_id correlation id of request + */ + virtual bool RemoveRetainedRequest(const uint32_t connection_key, + const uint32_t correlation_id) = 0; + + /** + * @brief IsStillWaitingForResponse check if request is still waiting for + * response + * @param connection_key connection key of application + * @param correlation_id correlation id of request + * @return true if request is still waiting for response, otherwise returns + * false + */ + virtual bool IsStillWaitingForResponse( + const uint32_t connection_key, const uint32_t correlation_id) const = 0; + /* * @brief Closes application by id * diff --git a/src/components/include/application_manager/request_controller.h b/src/components/include/application_manager/request_controller.h index 287493926b..e892762312 100644 --- a/src/components/include/application_manager/request_controller.h +++ b/src/components/include/application_manager/request_controller.h @@ -110,6 +110,36 @@ class RequestController { */ virtual void AddNotification(const RequestPtr ptr) = 0; + /** + * @brief RetainRequestInstance retains request instance by its + * connection+correlation key + * @param connection_key connection key of application + * @param correlation_id correlation id of request + * @return true if request was rerained. false if the request with such + * connection+correlation key was not found + */ + virtual bool RetainRequestInstance(const uint32_t connection_key, + const uint32_t correlation_id) = 0; + + /** + * @brief RemoveRetainedRequest removes request instance retained before + * @param connection_key connection key of application + * @param correlation_id correlation id of request + */ + virtual bool RemoveRetainedRequest(const uint32_t connection_key, + const uint32_t correlation_id) = 0; + + /** + * @brief IsStillWaitingForResponse check if request is still waiting for + * response + * @param connection_key connection key of application + * @param correlation_id correlation id of request + * @return true if request is still waiting for response, otherwise returns + * false + */ + virtual bool IsStillWaitingForResponse( + const uint32_t connection_key, const uint32_t correlation_id) const = 0; + /** * @brief Removes request from queue * @param correlation_id Active request correlation ID, diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 116d758ec4..8d1835a67e 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -396,6 +396,15 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_CONST_METHOD0(GetCommandFactory, application_manager::CommandFactory&()); MOCK_CONST_METHOD0(get_current_audio_source, uint32_t()); MOCK_METHOD1(set_current_audio_source, void(const uint32_t)); + MOCK_METHOD2(RetainRequestInstance, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); + MOCK_METHOD2(RemoveRetainedRequest, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); + MOCK_CONST_METHOD2(IsStillWaitingForResponse, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); MOCK_METHOD3(AddExpiredButtonRequest, void(const uint32_t app_id, const int32_t corr_id, diff --git a/src/components/include/test/application_manager/mock_request_controller.h b/src/components/include/test/application_manager/mock_request_controller.h index 5ed726b301..a4a7cbc1e2 100644 --- a/src/components/include/test/application_manager/mock_request_controller.h +++ b/src/components/include/test/application_manager/mock_request_controller.h @@ -55,6 +55,15 @@ class MockRequestController MOCK_METHOD1( AddNotification, void(const application_manager::request_controller::RequestPtr request)); + MOCK_METHOD2(RetainRequestInstance, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); + MOCK_METHOD2(RemoveRetainedRequest, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); + MOCK_CONST_METHOD2(IsStillWaitingForResponse, + bool(const uint32_t connection_key, + const uint32_t correlation_id)); MOCK_METHOD4(TerminateRequest, void(const uint32_t correlation_id, const uint32_t connection_key, -- cgit v1.2.1 From 35f5a0684a36a2a965d5f0e9e784687fa7d82914 Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Fri, 27 Aug 2021 17:31:55 -0400 Subject: Fix stopping video without audio streaming (#3752) * fix defect with stoping video without audio streaming * Isolate audio and video streaming * Remove app unregistration if EndServiceAck not received Also, application should not be switched to NONE in case when at least one streaming is already approved and active --- .../application_manager/application_manager_impl.h | 63 ++-- .../hmi/navi_audio_start_stream_request.cc | 3 +- .../src/commands/hmi/navi_start_stream_request.cc | 3 +- .../src/application_manager_impl.cc | 351 ++++++++++++++------- .../application_manager/application_manager.h | 10 +- .../application_manager/mock_application_manager.h | 3 + 6 files changed, 289 insertions(+), 144 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 f75a5220c6..c59456a022 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 @@ -858,11 +858,19 @@ class ApplicationManagerImpl protocol_handler::ServiceType service_type) const OVERRIDE; /** - * @brief Ends opened navi services (audio/video) for application + * @brief Ends opened navi services audio and video for application * @param app_id Application id */ void EndNaviServices(uint32_t app_id) OVERRIDE; + /** + * @brief Ends opened navi service audio or video for application + * @param app_id Application id + * @param service_type Service type to check + */ + void EndService(const uint32_t app_id, + const protocol_handler::ServiceType service_type) OVERRIDE; + void ForbidStreaming(uint32_t app_id, protocol_handler::ServiceType service_type) OVERRIDE; @@ -1333,10 +1341,12 @@ class ApplicationManagerImpl const HmiStatePtr to); /** - * @brief Starts EndStream timer for a specified application + * @brief Starts EndStream timer for a specified application service type * @param app_id Application to process + * @param service_type Type of service to track */ - void StartEndStreamTimer(const uint32_t app_id); + void StartEndStreamTimer(const uint32_t app_id, + const protocol_handler::ServiceType service_type); /** * @brief Allows to send appropriate message to mobile device. @@ -1379,13 +1389,19 @@ class ApplicationManagerImpl bool ResetVrHelpTitleItems(ApplicationSharedPtr app) const; private: - /* - * NaviServiceStatusMap shows which navi service (audio/video) is opened - * for specified application. Two bool values in std::pair mean: - * 1st value - is video service opened or not - * 2nd value - is audio service opened or not - */ - typedef std::map > NaviServiceStatusMap; + struct NaviServiceStatusDescriptor { + bool is_video_service_active_; + bool is_audio_service_active_; + }; + + struct NaviServiceDescriptor { + uint32_t app_id_; + protocol_handler::ServiceType service_type_; + TimerSPtr timer_to_stop_service_; + }; + + typedef std::map NaviServiceStatusMap; + typedef std::deque NaviServicesDequeue; /** * @brief GetHashedAppID allows to obtain unique application id as a string. @@ -1425,10 +1441,9 @@ class ApplicationManagerImpl /** * @brief Suspends streaming ability of application in case application's HMI - * level - * has been changed to not allowed for streaming + * level has been changed to not allowed for streaming */ - void EndNaviStreaming(); + void EndStreaming(); /** * @brief Starts specified navi service for application @@ -1461,8 +1476,10 @@ class ApplicationManagerImpl * @brief Disallows streaming for application, but doesn't close * opened services. Streaming ability could be restored by AllowStreaming(); * @param app_id Application to proceed + * @param service_type Type of service to disallow */ - void DisallowStreaming(uint32_t app_id); + void DisallowStreaming(const uint32_t app_id, + const protocol_handler::ServiceType service_type); /** * @brief Types of directories used by Application Manager @@ -1668,19 +1685,21 @@ class ApplicationManagerImpl HmiInterfacesImpl hmi_interfaces_; - NaviServiceStatusMap navi_service_status_; sync_primitives::Lock navi_service_status_lock_; - std::deque navi_app_to_stop_; + NaviServiceStatusMap navi_service_status_; + sync_primitives::Lock navi_app_to_stop_lock_; - std::deque navi_app_to_end_stream_; + NaviServicesDequeue navi_app_to_stop_; + + sync_primitives::Lock navi_app_to_end_stream_lock_; + NaviServicesDequeue navi_app_to_end_stream_; + + sync_primitives::Lock streaming_timer_pool_lock_; + std::vector streaming_timer_pool_; + uint32_t navi_close_app_timeout_; uint32_t navi_end_stream_timeout_; - std::vector close_app_timer_pool_; - std::vector end_stream_timer_pool_; - sync_primitives::Lock close_app_timer_pool_lock_; - sync_primitives::Lock end_stream_timer_pool_lock_; - mutable sync_primitives::Lock wait_for_hmi_lock_; sync_primitives::ConditionalVariable wait_for_hmi_condvar_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc index 7d030f9c66..673e6570f5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_audio_start_stream_request.cc @@ -143,6 +143,7 @@ void AudioStartStreamRequest::OnTimeOut() { } void AudioStartStreamRequest::RetryStartSession() { + using namespace protocol_handler; SDL_LOG_AUTO_TRACE(); auto retry_start_session = [this](const uint32_t hmi_app_id) { @@ -177,7 +178,7 @@ void AudioStartStreamRequest::RetryStartSession() { SDL_LOG_DEBUG("Audio start stream retry sequence stopped. " << "Attempts expired."); - application_manager_.EndNaviServices(app->app_id()); + application_manager_.EndService(app->app_id(), ServiceType::kAudio); } }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc index d2db777e94..f5d96d0ea8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/navi_start_stream_request.cc @@ -145,6 +145,7 @@ void NaviStartStreamRequest::OnTimeOut() { } void NaviStartStreamRequest::RetryStartSession() { + using namespace protocol_handler; SDL_LOG_AUTO_TRACE(); auto retry_start_session = [this](const uint32_t hmi_app_id) { @@ -179,7 +180,7 @@ void NaviStartStreamRequest::RetryStartSession() { SDL_LOG_DEBUG("NaviStartStream retry sequence stopped. " << "Attempts expired"); - application_manager_.EndNaviServices(app->app_id()); + application_manager_.EndService(app->app_id(), ServiceType::kMobileNav); } }; diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 55c437d506..c5089872d4 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -242,22 +242,21 @@ ApplicationManagerImpl::~ApplicationManagerImpl() { RemovePolicyObserver(this); { - sync_primitives::AutoLock lock(close_app_timer_pool_lock_); - close_app_timer_pool_.clear(); + sync_primitives::AutoLock lock(navi_app_to_stop_lock_); + navi_app_to_stop_.clear(); } { - sync_primitives::AutoLock lock(end_stream_timer_pool_lock_); - end_stream_timer_pool_.clear(); + sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_); + navi_app_to_end_stream_.clear(); } { - sync_primitives::AutoLock lock(navi_app_to_stop_lock_); - navi_app_to_stop_.clear(); + sync_primitives::AutoLock lock(streaming_timer_pool_lock_); + streaming_timer_pool_.clear(); } - navi_app_to_end_stream_.clear(); - + clear_pool_timer_.Stop(); secondary_transport_devices_cache_.clear(); } @@ -1914,10 +1913,11 @@ bool ApplicationManagerImpl::StartNaviService( NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() == it) { - std::pair res = - navi_service_status_.insert( - std::pair >( - app_id, std::make_pair(false, false))); + NaviServiceStatusDescriptor descriptor({false, false}); + auto res = navi_service_status_.insert( + std::pair(app_id, + descriptor)); + if (!res.second) { SDL_LOG_WARN("Navi service refused"); return false; @@ -2006,19 +2006,27 @@ void ApplicationManagerImpl::OnStreamingConfigurationSuccessful( // Fill NaviServices map. Set true to first value of pair if // we've started video service or to second value if we've // started audio service - service_type == protocol_handler::ServiceType::kMobileNav - ? it->second.first = true - : it->second.second = true; + if (protocol_handler::ServiceType::kMobileNav == service_type) { + it->second.is_video_service_active_ = true; + } + + if (protocol_handler::ServiceType::kAudio == service_type) { + it->second.is_audio_service_active_ = true; + } { sync_primitives::AutoLock lock(navi_app_to_stop_lock_); - for (size_t i = 0; i < navi_app_to_stop_.size(); ++i) { - if (app_id == navi_app_to_stop_[i]) { - sync_primitives::AutoLock lock(close_app_timer_pool_lock_); - close_app_timer_pool_.erase(close_app_timer_pool_.begin() + i); - navi_app_to_stop_.erase(navi_app_to_stop_.begin() + i); - break; - } + auto it = std::find_if( + navi_app_to_stop_.begin(), + navi_app_to_stop_.end(), + [&app_id, &service_type](const NaviServiceDescriptor& desc) { + return app_id == desc.app_id_ && service_type == desc.service_type_; + }); + + if (it != navi_app_to_stop_.end()) { + SDL_LOG_DEBUG("Removing app descriptor for service " + << service_type << " from map to stop"); + navi_app_to_stop_.erase(it); } } } @@ -2028,10 +2036,18 @@ void ApplicationManagerImpl::OnStreamingConfigurationSuccessful( // Fix: For wifi Secondary // Should erase appid from deque of ForbidStreaming() push in the last time - std::deque::const_iterator iter = std::find( - navi_app_to_end_stream_.begin(), navi_app_to_end_stream_.end(), app_id); - if (navi_app_to_end_stream_.end() != iter) { - navi_app_to_end_stream_.erase(iter); + { + sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_); + auto it = std::find_if( + navi_app_to_end_stream_.begin(), + navi_app_to_end_stream_.end(), + [&app_id, &service_type](const NaviServiceDescriptor& desc) { + return app_id == desc.app_id_ && service_type == desc.service_type_; + }); + + if (navi_app_to_end_stream_.end() != it) { + navi_app_to_end_stream_.erase(it); + } } } @@ -2062,14 +2078,15 @@ void ApplicationManagerImpl::StopNaviService( return; } else { // Fix: Repeated tests are not executed after they have stopped for Navi - if (false == it->second.first && + if (false == it->second.is_video_service_active_ && ServiceType::kMobileNav == service_type) { SDL_LOG_DEBUG("appId: " << app_id << "Navi had stopped"); return; } // Fix: Repeated tests are not executed after they have stopped for Audio - if (false == it->second.second && ServiceType::kAudio == service_type) { + if (false == it->second.is_audio_service_active_ && + ServiceType::kAudio == service_type) { SDL_LOG_DEBUG("appId: " << app_id << "Audio had stopped"); return; } @@ -2078,8 +2095,13 @@ void ApplicationManagerImpl::StopNaviService( // stopped audio service SDL_LOG_DEBUG("appId: " << app_id << " service_type: " << service_type << " to stopped"); - service_type == ServiceType::kMobileNav ? it->second.first = false - : it->second.second = false; + if (service_type == ServiceType::kMobileNav) { + it->second.is_video_service_active_ = false; + } + + if (service_type == ServiceType::kAudio) { + it->second.is_audio_service_active_ = false; + } } // Fix: For wifi Secondary // undisposed data active the VPMService restart again, @@ -2096,7 +2118,7 @@ void ApplicationManagerImpl::StopNaviService( app->set_audio_streaming_allowed(false); } // push_back for judge in ForbidStreaming(), - StartEndStreamTimer(app_id); + StartEndStreamTimer(app_id, service_type); } ApplicationSharedPtr app = application(app_id); @@ -2288,12 +2310,32 @@ bool ApplicationManagerImpl::HandleRejectedServiceStatus( sync_primitives::AutoLock lock(navi_service_status_lock_); auto app_services = navi_service_status_.find(app->app_id()); if (navi_service_status_.end() != app_services) { - navi_service_status_.erase(app_services); + if (hmi_apis::Common_ServiceType::VIDEO == service_type) { + app_services->second.is_video_service_active_ = false; + } + + if (hmi_apis::Common_ServiceType::AUDIO == service_type) { + app_services->second.is_audio_service_active_ = false; + } + + if (!app_services->second.is_audio_service_active_ && + !app_services->second.is_video_service_active_) { + SDL_LOG_DEBUG("The start of service" + << service_type << " for appID: " << app + << " is failed. Service info has been removed"); + navi_service_status_.erase(app_services); + return true; + } else { + SDL_LOG_WARN( + "Another streaming session is still active. Don't stop the " + "app"); + return false; + } } } - SDL_LOG_DEBUG("The start of service" - << service_type << " for appID: " << app - << " is failed. Service info has been removed"); + + SDL_LOG_DEBUG("The start of service" << service_type << " for appID: " + << app << " is failed. Rejecting"); return true; } case hmi_apis::Common_ServiceType::RPC: { @@ -3533,18 +3575,37 @@ void ApplicationManagerImpl::ForbidStreaming( return; } + bool app_to_stop_found = false; + bool app_to_end_stream_found = false; { sync_primitives::AutoLock lock(navi_app_to_stop_lock_); - if (navi_app_to_stop_.end() != std::find(navi_app_to_stop_.begin(), - navi_app_to_stop_.end(), - app_id) || - navi_app_to_end_stream_.end() != - std::find(navi_app_to_end_stream_.begin(), - navi_app_to_end_stream_.end(), - app_id)) { - return; - } + auto it = std::find_if( + navi_app_to_stop_.begin(), + navi_app_to_stop_.end(), + [&app_id, &service_type](const NaviServiceDescriptor& desc) { + return app_id == desc.app_id_ && service_type == desc.service_type_; + }); + + app_to_stop_found = navi_app_to_stop_.end() != it; + } + + { + sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_); + auto it_stream = std::find_if( + navi_app_to_end_stream_.begin(), + navi_app_to_end_stream_.end(), + [&app_id, &service_type](const NaviServiceDescriptor& desc) { + return app_id == desc.app_id_ && service_type == desc.service_type_; + }); + + app_to_end_stream_found = navi_app_to_end_stream_.end() != it_stream; + } + + if (app_to_stop_found || app_to_end_stream_found) { + SDL_LOG_DEBUG("App " << app_id << " service " << service_type + << " is about to stop. Ignored"); + return; } bool unregister = false; @@ -3552,8 +3613,12 @@ void ApplicationManagerImpl::ForbidStreaming( sync_primitives::AutoLock lock(navi_service_status_lock_); NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); + if (navi_service_status_.end() == it || - (!it->second.first && !it->second.second)) { + (protocol_handler::ServiceType::kAudio == service_type && + !it->second.is_audio_service_active_) || + (protocol_handler::ServiceType::kMobileNav == service_type && + !it->second.is_video_service_active_)) { unregister = true; } } @@ -3577,7 +3642,7 @@ void ApplicationManagerImpl::ForbidStreaming( return; } - EndNaviServices(app_id); + EndService(app_id, service_type); } void ApplicationManagerImpl::OnAppStreaming( @@ -3601,7 +3666,8 @@ void ApplicationManagerImpl::OnAppStreaming( } } -void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { +void ApplicationManagerImpl::EndService( + const uint32_t app_id, const protocol_handler::ServiceType service_type) { using namespace protocol_handler; SDL_LOG_AUTO_TRACE(); @@ -3614,6 +3680,7 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { bool end_video = false; bool end_audio = false; + { sync_primitives::AutoLock lock(navi_service_status_lock_); @@ -3622,8 +3689,11 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { SDL_LOG_ERROR("No info about navi servicies for app"); return; } - end_video = it->second.first; - end_audio = it->second.second; + + end_video = service_type == ServiceType::kMobileNav && + it->second.is_video_service_active_; + end_audio = service_type == ServiceType::kAudio && + it->second.is_audio_service_active_; } if (connection_handler_) { @@ -3637,25 +3707,41 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { connection_handler().SendEndService(app_id, ServiceType::kAudio); app->StopStreamingForce(ServiceType::kAudio); } + } - DisallowStreaming(app_id); + DisallowStreaming(app_id, service_type); - { - sync_primitives::AutoLock lock(navi_app_to_stop_lock_); - navi_app_to_stop_.push_back(app_id); - } + { + sync_primitives::AutoLock lock(navi_app_to_stop_lock_); - TimerSPtr close_timer(std::make_shared( - "CloseNaviAppTimer", - new TimerTaskImpl( - this, &ApplicationManagerImpl::CloseNaviApp))); - close_timer->Start(navi_close_app_timeout_, timer::kSingleShot); + auto it = std::find_if( + navi_app_to_stop_.begin(), + navi_app_to_stop_.end(), + [&app_id, &service_type](const NaviServiceDescriptor& desc) { + return app_id == desc.app_id_ && service_type == desc.service_type_; + }); + + if (navi_app_to_stop_.end() == it) { + TimerSPtr close_timer(std::make_shared( + "CloseNaviAppTimer", + new TimerTaskImpl( + this, &ApplicationManagerImpl::CloseNaviApp))); + NaviServiceDescriptor descriptor({app_id, service_type, close_timer}); + navi_app_to_stop_.push_back(descriptor); - sync_primitives::AutoLock lock(close_app_timer_pool_lock_); - close_app_timer_pool_.push_back(close_timer); + close_timer->Start(navi_close_app_timeout_, timer::kSingleShot); + } } } +void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { + using namespace protocol_handler; + SDL_LOG_AUTO_TRACE(); + + EndService(app_id, ServiceType::kAudio); + EndService(app_id, ServiceType::kMobileNav); +} + void ApplicationManagerImpl::OnHMIStateChanged(const uint32_t app_id, const HmiStatePtr from, const HmiStatePtr to) { @@ -3788,7 +3874,8 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, << std::boolalpha << end_streaming_by_streaming_state << "; by hmi level: " << std::boolalpha << start_timer_by_hmi_level); - StartEndStreamTimer(app_id); + StartEndStreamTimer(app_id, protocol_handler::ServiceType::kAudio); + StartEndStreamTimer(app_id, protocol_handler::ServiceType::kMobileNav); return; } @@ -3869,38 +3956,32 @@ bool ApplicationManagerImpl::ResetVrHelpTitleItems( return true; } -void ApplicationManagerImpl::StartEndStreamTimer(const uint32_t app_id) { +void ApplicationManagerImpl::ClearTimerPool() { + SDL_LOG_AUTO_TRACE(); + sync_primitives::AutoLock lock(streaming_timer_pool_lock_); + streaming_timer_pool_.clear(); +} + +void ApplicationManagerImpl::StartEndStreamTimer( + const uint32_t app_id, const protocol_handler::ServiceType service_type) { SDL_LOG_DEBUG("Start end stream timer for app " << app_id); - navi_app_to_end_stream_.push_back(app_id); - TimerSPtr end_stream_timer(std::make_shared( - "DisallowAppStreamTimer", - new TimerTaskImpl( - this, &ApplicationManagerImpl::EndNaviStreaming))); - end_stream_timer->Start(navi_end_stream_timeout_, timer::kSingleShot); - sync_primitives::AutoLock lock(end_stream_timer_pool_lock_); - end_stream_timer_pool_.push_back(end_stream_timer); -} + if (helpers:: + Compare( + service_type, + protocol_handler::ServiceType::kAudio, + protocol_handler::ServiceType::kMobileNav)) { + TimerSPtr end_stream_timer = std::make_shared( + "DisallowAppStreamTimer", + new TimerTaskImpl( + this, &ApplicationManagerImpl::EndStreaming)); -void ApplicationManagerImpl::ClearTimerPool() { - SDL_LOG_AUTO_TRACE(); - { - sync_primitives::AutoLock lock(close_app_timer_pool_lock_); + sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_); - close_app_timer_pool_.erase( - std::remove_if(close_app_timer_pool_.begin(), - close_app_timer_pool_.end(), - [](TimerSPtr timer) { return !timer->is_running(); }), - close_app_timer_pool_.end()); - } + NaviServiceDescriptor descriptor({app_id, service_type, end_stream_timer}); + navi_app_to_end_stream_.push_back(descriptor); - { - sync_primitives::AutoLock lock(end_stream_timer_pool_lock_); - end_stream_timer_pool_.erase( - std::remove_if(end_stream_timer_pool_.begin(), - end_stream_timer_pool_.end(), - [](TimerSPtr timer) { return !timer->is_running(); }), - end_stream_timer_pool_.end()); + end_stream_timer->Start(navi_end_stream_timeout_, timer::kSingleShot); } } @@ -3908,58 +3989,88 @@ void ApplicationManagerImpl::CloseNaviApp() { SDL_LOG_AUTO_TRACE(); using namespace mobile_apis::AppInterfaceUnregisteredReason; using namespace mobile_apis::Result; - uint32_t app_id; + NaviServiceDescriptor descriptor( + {0, protocol_handler::ServiceType::kInvalidServiceType, nullptr}); { sync_primitives::AutoLock lock(navi_app_to_stop_lock_); DCHECK_OR_RETURN_VOID(!navi_app_to_stop_.empty()); - app_id = navi_app_to_stop_.front(); + descriptor = navi_app_to_stop_.front(); navi_app_to_stop_.pop_front(); } - bool unregister = false; - { - sync_primitives::AutoLock lock(navi_service_status_lock_); + if (descriptor.app_id_ > 0) { + { + sync_primitives::AutoLock lock(navi_service_status_lock_); - NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); - if (navi_service_status_.end() != it) { - if (it->second.first || it->second.second) { - unregister = true; - navi_service_status_.erase(it); + NaviServiceStatusMap::iterator it = + navi_service_status_.find(descriptor.app_id_); + if (navi_service_status_.end() != it) { + if (protocol_handler::ServiceType::kMobileNav == + descriptor.service_type_ && + it->second.is_video_service_active_) { + it->second.is_video_service_active_ = false; + } + + if (protocol_handler::ServiceType::kAudio == descriptor.service_type_ && + it->second.is_audio_service_active_) { + it->second.is_audio_service_active_ = false; + } + + if (!it->second.is_audio_service_active_ && + !it->second.is_video_service_active_) { + navi_service_status_.erase(it); + } } } - } - if (unregister) { - SDL_LOG_INFO("App haven't answered for EndService. Unregister it."); - rpc_service_->ManageMobileCommand( - MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( - app_id, PROTOCOL_VIOLATION), - commands::Command::SOURCE_SDL); - UnregisterApplication(app_id, ABORTED); + + { + sync_primitives::AutoLock lock(streaming_timer_pool_lock_); + streaming_timer_pool_.push_back(descriptor.timer_to_stop_service_); + } } } -void ApplicationManagerImpl::EndNaviStreaming() { +void ApplicationManagerImpl::EndStreaming() { SDL_LOG_AUTO_TRACE(); using namespace mobile_apis::AppInterfaceUnregisteredReason; using namespace mobile_apis::Result; + using namespace protocol_handler; - if (!navi_app_to_end_stream_.empty()) { - const uint32_t app_id = navi_app_to_end_stream_.front(); + NaviServiceDescriptor descriptor( + {0, protocol_handler::ServiceType::kInvalidServiceType, nullptr}); + { + sync_primitives::AutoLock lock(navi_app_to_end_stream_lock_); + DCHECK_OR_RETURN_VOID(!navi_app_to_end_stream_.empty()); + descriptor = navi_app_to_end_stream_.front(); navi_app_to_end_stream_.pop_front(); + } + if (descriptor.app_id_ > 0) { { sync_primitives::AutoLock lock(navi_app_to_stop_lock_); - if (navi_app_to_stop_.end() == std::find(navi_app_to_stop_.begin(), - navi_app_to_stop_.end(), - app_id)) { - DisallowStreaming(app_id); + auto it = + std::find_if(navi_app_to_stop_.begin(), + navi_app_to_stop_.end(), + [&descriptor](const NaviServiceDescriptor& desc) { + return descriptor.app_id_ == desc.app_id_ && + descriptor.service_type_ == desc.service_type_; + }); + + if (navi_app_to_stop_.end() == it) { + DisallowStreaming(descriptor.app_id_, descriptor.service_type_); } } + + { + sync_primitives::AutoLock lock(streaming_timer_pool_lock_); + streaming_timer_pool_.push_back(descriptor.timer_to_stop_service_); + } } } -void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { +void ApplicationManagerImpl::DisallowStreaming( + const uint32_t app_id, const protocol_handler::ServiceType service_type) { using namespace protocol_handler; SDL_LOG_AUTO_TRACE(); @@ -3974,10 +4085,12 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) { NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() != it) { - if (it->second.first) { + if (it->second.is_video_service_active_ && + service_type == ServiceType::kMobileNav) { app->set_video_streaming_allowed(false); } - if (it->second.second) { + if (it->second.is_audio_service_active_ && + service_type == ServiceType::kAudio) { app->set_audio_streaming_allowed(false); } } @@ -3999,10 +4112,10 @@ void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) { NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id); if (navi_service_status_.end() != it) { - if (it->second.first) { + if (it->second.is_video_service_active_) { app->set_video_streaming_allowed(true); } - if (it->second.second) { + if (it->second.is_audio_service_active_) { app->set_audio_streaming_allowed(true); } } diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index ba58fd203c..5fd9be2a66 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -517,11 +517,19 @@ class ApplicationManager { virtual uint32_t GenerateNewHMIAppID() = 0; /** - * @brief Ends opened navi services (audio/video) for application + * @brief Ends opened navi services audio and video for application * @param app_id Application id */ virtual void EndNaviServices(uint32_t app_id) = 0; + /** + * @brief Ends opened navi service audio or video for application + * @param app_id Application id + * @param service_type Service type to check + */ + virtual void EndService(const uint32_t app_id, + const protocol_handler::ServiceType service_type) = 0; + /** * @brief returns true if low voltage state is active */ diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 8d1835a67e..ef0f20ac65 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -200,6 +200,9 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_METHOD0(GetNextMobileCorrelationID, uint32_t()); MOCK_METHOD0(GenerateNewHMIAppID, uint32_t()); MOCK_METHOD1(EndNaviServices, void(uint32_t app_id)); + MOCK_METHOD2(EndService, + void(const uint32_t app_id, + const protocol_handler::ServiceType service_type)); MOCK_METHOD1(BeginAudioPassThru, bool(uint32_t app_id)); MOCK_METHOD1(EndAudioPassThru, bool(uint32_t app_id)); MOCK_METHOD1(ConnectToDevice, void(const std::string& device_mac)); -- cgit v1.2.1 From 28e1fdbb56f022459203c11fc4f71fe17bf6c350 Mon Sep 17 00:00:00 2001 From: Collin Date: Thu, 9 Sep 2021 14:25:46 -0400 Subject: Clear Parent Reference to Begin State When it is Erased (#3769) * clear any parent reference to the state being erased even when it is the begin state * Apply suggestions from code review Co-authored-by: Jacob Keeler Co-authored-by: Jacob Keeler --- src/components/application_manager/src/application_state.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc index adaefd2e95..ee43d32b0a 100644 --- a/src/components/application_manager/src/application_state.cc +++ b/src/components/application_manager/src/application_state.cc @@ -205,7 +205,12 @@ void ApplicationState::RemoveHMIState(const WindowID window_id, void ApplicationState::EraseHMIState(HmiStates& hmi_states, HmiStates::iterator it) { if (hmi_states.begin() == it) { - (*it)->set_parent(nullptr); + HmiStates::iterator next = it; + ++next; + if (hmi_states.end() != next) { + HmiStatePtr next_state = *next; + next_state->set_parent(nullptr); + } } else { HmiStates::iterator next = it; HmiStates::iterator prev = it; -- cgit v1.2.1 From 5da57703e02fdf526c300cc26a45ff75f7d1ffd0 Mon Sep 17 00:00:00 2001 From: Collin Date: Fri, 10 Sep 2021 08:52:05 -0400 Subject: fix WebSocketServerTransportAdapter::Store write to last state (#3772) * WebSocketServerTransportAdapter::Store write to last state * hold lock until we set dict or decide not to --- .../src/websocket_server/websocket_server_transport_adapter.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc index 18c6ad9be1..9c02b78872 100644 --- a/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc +++ b/src/components/transport_manager/src/websocket_server/websocket_server_transport_adapter.cc @@ -102,7 +102,8 @@ void WebSocketServerTransportAdapter::Store() const { if (webengine_device_) { resumption::LastStateAccessor accessor = last_state_wrapper_->get_accessor(); - Json::Value dictionary = accessor.GetData().dictionary(); + resumption::LastState& data = accessor.GetMutableData(); + Json::Value dictionary = data.dictionary(); if (dictionary["TransportManager"].isMember("WebsocketServerAdapter")) { SDL_LOG_DEBUG( "WebsocketServerAdapter already exists. Storing is skipped"); @@ -116,6 +117,8 @@ void WebSocketServerTransportAdapter::Store() const { ws_adapter_dictionary["device"] = device_dictionary; dictionary["TransportManager"]["WebsocketServerAdapter"] = ws_adapter_dictionary; + + data.set_dictionary(dictionary); } } -- cgit v1.2.1 From de58a410a5842f0c8873feb6de16ca06832077ee Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Tue, 14 Sep 2021 16:20:52 -0400 Subject: Add missing internal error codes to security manager (#3773) * Add missing internal error codes to security manager * Add internal error notification to SSL handshake failure * Remove unused handshake result * Add unit tests for new error codes Co-authored-by: JackLivio --- .../src/application_manager_impl.cc | 1 - .../include/security_manager/security_manager.h | 13 ++- .../include/security_manager/ssl_context.h | 1 - .../protocol_handler/src/handshake_handler.cc | 2 - .../security_manager/security_manager_impl.h | 4 +- .../security_manager/src/security_manager_impl.cc | 24 +++++ .../security_manager/test/security_manager_test.cc | 110 ++++++++++++++++++++- 7 files changed, 139 insertions(+), 16 deletions(-) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index c5089872d4..f350c9fc5a 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -2447,7 +2447,6 @@ bool ApplicationManagerImpl::OnHandshakeDone( SSLContext::Handshake_Result_CertExpired, SSLContext::Handshake_Result_CertNotSigned, SSLContext::Handshake_Result_AppIDMismatch, - SSLContext::Handshake_Result_AppNameMismatch, SSLContext::Handshake_Result_NotYetValid)) { app->usage_report().RecordTLSError(); } diff --git a/src/components/include/security_manager/security_manager.h b/src/components/include/security_manager/security_manager.h index 305ade2b47..b231005010 100644 --- a/src/components/include/security_manager/security_manager.h +++ b/src/components/include/security_manager/security_manager.h @@ -69,6 +69,9 @@ class SecurityManager : public protocol_handler::ProtocolObserver, ERROR_DECRYPTION_FAILED = 0x06, ERROR_ENCRYPTION_FAILED = 0x07, ERROR_SSL_INVALID_DATA = 0x08, + ERROR_HANDSHAKE_FAILED = 0x09, // Handshake failed + ERROR_INVALID_CERT = 0x0A, // Handshake failed because cert is invalid + ERROR_EXPIRED_CERT = 0x0B, // Handshake failed because cert is expired ERROR_INTERNAL = 0xFF, ERROR_UNKNOWN_INTERNAL_ERROR = 0xFE // error value for testing }; @@ -99,24 +102,24 @@ class SecurityManager : public protocol_handler::ProtocolObserver, * \param connection_key Unique key used by other components as session * identifier * \param error_id unique error identifier - * \param erorr_text SSL impelmentation error text + * \param error_text SSL impelmentation error text * \param seq_number received from Mobile Application */ virtual void SendInternalError(const uint32_t connection_key, const uint8_t& error_id, - const std::string& erorr_text, + const std::string& error_text, const uint32_t seq_number) = 0; /** * \brief Sends InternalError override methode for sending without seq_number * \param connection_key Unique key used by other components as session * identifier * \param error_id unique error identifier - * \param erorr_text SSL impelmentation error text + * \param error_text SSL impelmentation error text */ void SendInternalError(const uint32_t connection_key, const uint8_t& error_id, - const std::string& erorr_text) { - SendInternalError(connection_key, error_id, erorr_text, 0); + const std::string& error_text) { + SendInternalError(connection_key, error_id, error_text, 0); } /** diff --git a/src/components/include/security_manager/ssl_context.h b/src/components/include/security_manager/ssl_context.h index 397cf89347..4f2caf530c 100644 --- a/src/components/include/security_manager/ssl_context.h +++ b/src/components/include/security_manager/ssl_context.h @@ -73,7 +73,6 @@ class SSLContext { Handshake_Result_NotYetValid, Handshake_Result_CertNotSigned, Handshake_Result_AppIDMismatch, - Handshake_Result_AppNameMismatch, }; struct HandshakeContext { diff --git a/src/components/protocol_handler/src/handshake_handler.cc b/src/components/protocol_handler/src/handshake_handler.cc index 78f324e0ae..87369c0793 100644 --- a/src/components/protocol_handler/src/handshake_handler.cc +++ b/src/components/protocol_handler/src/handshake_handler.cc @@ -149,8 +149,6 @@ bool HandshakeHandler::OnHandshakeDone( return "Certificate is not signed"; case security_manager::SSLContext::Handshake_Result_AppIDMismatch: return "Trying to run handshake with wrong app id"; - case security_manager::SSLContext::Handshake_Result_AppNameMismatch: - return "Trying to run handshake with wrong app name"; case security_manager::SSLContext::Handshake_Result_AbnormalFail: return "Error occurred during handshake"; case security_manager::SSLContext::Handshake_Result_Fail: diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h index c4a752173e..437fede683 100644 --- a/src/components/security_manager/include/security_manager/security_manager_impl.h +++ b/src/components/security_manager/include/security_manager/security_manager_impl.h @@ -121,12 +121,12 @@ class SecurityManagerImpl : public SecurityManager, * \param connection_key Unique key used by other components as session * identifier * \param error_id unique error identifier - * \param erorr_text SSL impelmentation error text + * \param error_text SSL impelmentation error text * \param seq_number received from Mobile Application */ void SendInternalError(const uint32_t connection_key, const uint8_t& error_id, - const std::string& erorr_text, + const std::string& error_text, const uint32_t seq_number) OVERRIDE; using SecurityManager::SendInternalError; diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc index f78f859c04..75cc104d95 100644 --- a/src/components/security_manager/src/security_manager_impl.cc +++ b/src/components/security_manager/src/security_manager_impl.cc @@ -557,6 +557,7 @@ bool SecurityManagerImpl::ProcessHandshakeData( // no handshake data to send return false; } + if (sslContext->IsInitCompleted()) { // On handshake success SDL_LOG_DEBUG("SSL initialization finished success."); @@ -565,6 +566,29 @@ bool SecurityManagerImpl::ProcessHandshakeData( } else if (handshake_result != SSLContext::Handshake_Result_Success) { // On handshake fail SDL_LOG_WARN("SSL initialization finished with fail."); + int32_t error_code = ERROR_HANDSHAKE_FAILED; + std::string error_text = "Handshake failed"; + switch (handshake_result) { + case SSLContext::Handshake_Result_CertExpired: + error_code = ERROR_EXPIRED_CERT; + error_text = "Certificate is expired"; + break; + case SSLContext::Handshake_Result_NotYetValid: + error_code = ERROR_INVALID_CERT; + error_text = "Certificate is not yet valid"; + break; + case SSLContext::Handshake_Result_CertNotSigned: + error_code = ERROR_INVALID_CERT; + error_text = "Certificate is not signed"; + break; + case SSLContext::Handshake_Result_AppIDMismatch: + error_code = ERROR_INVALID_CERT; + error_text = "App ID does not match certificate"; + break; + default: + break; + } + SendInternalError(connection_key, error_code, error_text); NotifyListenersOnHandshakeDone(connection_key, handshake_result); } diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc index 7e0454e840..c2b0cda373 100644 --- a/src/components/security_manager/test/security_manager_test.cc +++ b/src/components/security_manager/test/security_manager_test.cc @@ -730,12 +730,13 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_InvalidData) { } /* * Shall send HandshakeData on getting SEND_HANDSHAKE_DATA from mobile side - * with correct handshake data Check Fail and sussecc states + * with correct handshake data Check Fail and success states */ TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer) { SetMockCryptoManager(); // Count handshake calls const int handshake_emulates = 2; + const int internal_error_count = 1; uint32_t connection_id = 0; uint8_t session_id = 0; @@ -743,14 +744,14 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer) { auto waiter = TestAsyncWaiter::createInstance(); uint32_t times = 0; EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _)) - .Times(handshake_emulates) + .Times(handshake_emulates + internal_error_count) .WillRepeatedly(NotifyTestAsyncWaiter(waiter)); times += handshake_emulates; EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id, An())) - .Times(handshake_emulates) + .Times(handshake_emulates + internal_error_count) .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true))); - times += handshake_emulates; + times += handshake_emulates + internal_error_count; // Get size of raw message after const size_t raw_message_size = 15; @@ -759,7 +760,15 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer) { RawMessageEqSize(raw_message_size), false, kIsFinal)) .Times(handshake_emulates) .WillRepeatedly(NotifyTestAsyncWaiter(waiter)); - times += handshake_emulates; + EXPECT_CALL( + mock_protocol_handler, + SendMessageToMobileApp( + InternalErrorWithErrId(SecurityManager::ERROR_HANDSHAKE_FAILED), + false, + kIsFinal)) + .Times(internal_error_count) + .WillRepeatedly(NotifyTestAsyncWaiter(waiter)); + times += handshake_emulates + internal_error_count; // Expect notifying listeners (unsuccess) EXPECT_CALL(*mock_sm_listener, @@ -803,6 +812,97 @@ TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer) { // Listener was destroyed after OnHandshakeDone call mock_sm_listener.release(); } +/* + * Shall send HandshakeData on getting SEND_HANDSHAKE_DATA from mobile side + * with correct handshake data Check Fail and success states + */ +TEST_F(SecurityManagerTest, ProcessHandshakeData_Answer_Invalid_Cert) { + SetMockCryptoManager(); + // Count handshake calls + const int handshake_emulates = 4; + + uint32_t connection_id = 0; + uint8_t session_id = 0; + + auto waiter = TestAsyncWaiter::createInstance(); + uint32_t times = 0; + // Each of these calls is run twice, once for the next handshake data request, + // once for the the internal error notification + EXPECT_CALL(mock_session_observer, PairFromKey(kKey, _, _)) + .Times(handshake_emulates) + .WillRepeatedly(NotifyTestAsyncWaiter(waiter)); + times += handshake_emulates; + EXPECT_CALL(mock_session_observer, + ProtocolVersionUsed(connection_id, session_id, An())) + .Times(handshake_emulates) + .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true))); + times += handshake_emulates; + + EXPECT_CALL(mock_protocol_handler, + SendMessageToMobileApp( + InternalErrorWithErrId(SecurityManager::ERROR_EXPIRED_CERT), + false, + kIsFinal)) + .WillOnce(NotifyTestAsyncWaiter(waiter)); + EXPECT_CALL(mock_protocol_handler, + SendMessageToMobileApp( + InternalErrorWithErrId(SecurityManager::ERROR_INVALID_CERT), + false, + kIsFinal)) + .Times(3) + .WillRepeatedly(NotifyTestAsyncWaiter(waiter)); + times += 4; + + // Listener is erased after first call + EXPECT_CALL(*mock_sm_listener, + OnHandshakeDone(kKey, SSLContext::Handshake_Result_CertExpired)) + .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(true))); + times++; + + // Emulate SessionObserver and CryptoManager result + EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted()) + .Times(handshake_emulates) + .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(false))); + times += handshake_emulates; + EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl)) + .Times(handshake_emulates) + .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), + Return(&mock_ssl_context_exists))); + times += handshake_emulates; + + // Emulate DoHandshakeStep correct logics + EXPECT_CALL( + mock_ssl_context_exists, + DoHandshakeStep(HandshakeStepEq(handshake_data, handshake_data_size), + handshake_data_size, + _, + _)) + .WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL), + SetArgPointee<3>(0), + NotifyTestAsyncWaiter(waiter), + Return(SSLContext::Handshake_Result_CertExpired))) + .WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL), + SetArgPointee<3>(0), + NotifyTestAsyncWaiter(waiter), + Return(SSLContext::Handshake_Result_NotYetValid))) + .WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL), + SetArgPointee<3>(0), + NotifyTestAsyncWaiter(waiter), + Return(SSLContext::Handshake_Result_AppIDMismatch))) + .WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL), + SetArgPointee<3>(0), + NotifyTestAsyncWaiter(waiter), + Return(SSLContext::Handshake_Result_CertNotSigned))); + times += 4; // matches to each single call above + + EmulateMobileMessageHandshake( + handshake_data, handshake_data_size, handshake_emulates); + + EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout)); + + // Listener was destroyed after OnHandshakeDone call + mock_sm_listener.release(); +} /* * Shall call all listeners on success end handshake * and return handshake data -- cgit v1.2.1 From 86dd7b1c9802005657a8e1dddeae79db24ba6ae0 Mon Sep 17 00:00:00 2001 From: VladSemenyuk Date: Tue, 28 Sep 2021 21:43:58 +0300 Subject: Prevent HMI commands processing while SDL is stopping (#3781) --- src/components/application_manager/src/commands/request_to_hmi.cc | 1 + src/components/application_manager/src/rpc_service_impl.cc | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/application_manager/src/commands/request_to_hmi.cc b/src/components/application_manager/src/commands/request_to_hmi.cc index ac6bda0557..86f25711da 100644 --- a/src/components/application_manager/src/commands/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/request_to_hmi.cc @@ -137,6 +137,7 @@ bool RequestToHMI::Init() { } bool RequestToHMI::CleanUp() { + unsubscribe_from_all_hmi_events(); return true; } diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index 67ff7cb6f0..a610bd4371 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -392,7 +392,9 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message, if (kRequest == message_type) { SDL_LOG_DEBUG("ManageHMICommand"); command->set_warning_info(warning_info); - request_ctrl_.AddHMIRequest(command); + if (!app_manager_.IsStopping()) { + request_ctrl_.AddHMIRequest(command); + } } if (command->Init()) { -- cgit v1.2.1 From 86e032f7829217f3a4c718e8d2d96c951c70a71c Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Wed, 29 Sep 2021 10:33:27 -0400 Subject: Fix descriptions for AudioControlCapabilities and SeatControlCapabilities (#3782) --- src/components/interfaces/HMI_API.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index f5a8ce163d..a5fa36a9a0 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -1949,7 +1949,7 @@ - The short friendly name of the light control module. + The short friendly name of the seat control module. It should not be used to identify a module by mobile application. @@ -2464,7 +2464,7 @@ - The short friendly name of the light control module. + The short friendly name of the audio control module. It should not be used to identify a module by mobile application. -- cgit v1.2.1 From dd4763d22efe6c9f45585c1ac7d83403ea2b2766 Mon Sep 17 00:00:00 2001 From: Jacob Keeler Date: Wed, 6 Oct 2021 17:01:19 -0400 Subject: Check specifically for invalid HMI level when suspending notifications (#3784) * Check specifically for invalid HMI level before suspending notifications Checking for main window ID caused a very rare race condition where the notification was not suspended when necessary --- src/components/application_manager/src/rpc_service_impl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index a610bd4371..36dcb335c1 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -148,8 +148,10 @@ bool RPCServiceImpl::ManageMobileCommand( if (app_ptr && (app_manager_.IsAppInReconnectMode(app_ptr->device(), app_ptr->policy_app_id()) || - (!app_ptr->WindowIdExists(window_id) && - mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id && + (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id && + (!app_ptr->WindowIdExists(window_id) || + mobile_apis::HMILevel::INVALID_ENUM == + app_ptr->hmi_level(window_id)) && mobile_apis::messageType::notification == message_type))) { commands_holder_.Suspend( app_ptr, CommandHolder::CommandType::kMobileCommand, source, message); -- cgit v1.2.1 From 2a24f99931161e2cb3c6f8e5cd9f9e6d31ccb9a2 Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Mon, 11 Oct 2021 13:35:34 -0400 Subject: Fix SDL build with USE_COTIRE=OFF (#3791) --- .../test/commands/hmi/subscribe_button_request_test.cc | 4 ++++ .../test/commands/hmi/subscribe_button_response_test.cc | 4 +++- .../test/commands/hmi/unsubscribe_button_request_test.cc | 5 +++++ .../test/commands/hmi/unsubscribe_button_response_test.cc | 3 ++- .../test/commands/mobile/get_system_capability_request_test.cc | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc index 61214d64a3..c518bdf9b2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_request_test.cc @@ -33,7 +33,11 @@ #include "hmi/subscribe_button_request.h" #include #include +#include "application_manager/commands/command_request_test.h" +#include "application_manager/mock_application.h" #include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_resume_ctrl.h" +#include "application_manager/resumption/resumption_data_processor.h" #include "gtest/gtest.h" diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc index ca4c2ee41b..490a3bc2e5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/subscribe_button_response_test.cc @@ -32,10 +32,12 @@ #include +#include "application_manager/commands/command_request_test.h" #include "application_manager/mock_event_dispatcher.h" -#include "gtest/gtest.h" #include "hmi/subscribe_button_response.h" +#include "gtest/gtest.h" + namespace test { namespace components { namespace commands_test { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc index 434738a2e1..5a0790a5e0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_request_test.cc @@ -35,7 +35,12 @@ #include #include +#include "application_manager/commands/command_request_test.h" +#include "application_manager/mock_application.h" #include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_resume_ctrl.h" +#include "application_manager/resumption/resumption_data_processor.h" + #include "gtest/gtest.h" namespace test { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc index 3d9572a743..1659081e69 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/unsubscribe_button_response_test.cc @@ -31,9 +31,10 @@ */ #include +#include "gtest/gtest.h" +#include "application_manager/commands/command_request_test.h" #include "application_manager/mock_event_dispatcher.h" -#include "gtest/gtest.h" #include "hmi/unsubscribe_button_response.h" namespace test { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc index 3574385274..f783df387a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc @@ -34,6 +34,7 @@ #include "application_manager/commands/command_request_test.h" #include "application_manager/message_helper.h" +#include "application_manager/mock_app_service_manager.h" #include "gtest/gtest.h" #include "interfaces/MOBILE_API.h" #include "resumption/last_state_impl.h" -- cgit v1.2.1 From bb738ffc106bbc231bd0ade9dde65fff32c8b5ba Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Tue, 12 Oct 2021 14:33:23 -0400 Subject: Fix wrong behavior of RCOnRemoteControlSettingsNotification (#3792) * Fix wrong behavior of RCOnRemoteControlSettingsNotification Looks like `kAllowed` parameter was swithing on/off the RC functionality even if it was not present and previous value should be taken. Processing of `kAllowed` and `kAccessMode` was split on two separate and independent functions make it really isolated. Processing of both parameters was aligned, so now core does not perform extra actions if one of parameter is missing. --- .../rc_on_remote_control_settings_notification.h | 12 ++++++ .../rc_rpc_plugin/resource_allocation_manager.h | 8 ++++ .../rc_on_remote_control_settings_notification.cc | 49 ++++++++++++++-------- .../commands/on_remote_control_settings_test.cc | 49 ++++++++++++++++++++-- 4 files changed, 98 insertions(+), 20 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h index 82e0a8c13b..bb5e7a9b8f 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/commands/hmi/rc_on_remote_control_settings_notification.h @@ -76,6 +76,18 @@ class RCOnRemoteControlSettingsNotification * notifications */ void DisallowRCFunctionality(); + + /** + * @brief Performs the set of actions depending on access mode param received + * in the message + */ + void ProcessAccessModeParam(); + + /** + * @brief Performs the set of actions depending on allowed param received in + * the message + */ + void ProcessAllowedParam(); }; } // namespace commands } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h index 623498dac7..db785e4a4f 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h @@ -209,8 +209,16 @@ class ResourceAllocationManager { NotificationTrigger::eType event, application_manager::ApplicationSharedPtr application) = 0; + /** + * @brief Returns current state of RC functionality + * @return current state of RC functionality + */ virtual bool is_rc_enabled() const = 0; + /** + * @brief Sets current state of RC functionality to a new one + * @param value new RC functionality state + */ virtual void set_rc_enabled(const bool value) = 0; /** diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc index 860e18a105..580937bc8a 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc @@ -93,35 +93,50 @@ void RCOnRemoteControlSettingsNotification::Run() { return; } - hmi_apis::Common_RCAccessMode::eType access_mode = - hmi_apis::Common_RCAccessMode::INVALID_ENUM; - if ((*message_)[app_mngr::strings::msg_params].keyExists( + ProcessAccessModeParam(); + ProcessAllowedParam(); +} + +void RCOnRemoteControlSettingsNotification::ProcessAccessModeParam() { + if (!(*message_)[app_mngr::strings::msg_params].keyExists( message_params::kAccessMode)) { - access_mode = static_cast( - (*message_)[app_mngr::strings::msg_params][message_params::kAccessMode] - .asUInt()); SDL_LOG_DEBUG( - "Setting up access mode : " << AccessModeToString(access_mode)); - } else { - access_mode = resource_allocation_manager_.GetAccessMode(); - SDL_LOG_DEBUG("No access mode received. Using last known: " - << AccessModeToString(access_mode)); + "No access mode received. Using last known: " + << AccessModeToString(resource_allocation_manager_.GetAccessMode())); + return; } + + const auto access_mode = static_cast( + (*message_)[app_mngr::strings::msg_params][message_params::kAccessMode] + .asUInt()); + SDL_LOG_DEBUG("Setting up access mode : " << AccessModeToString(access_mode)); resource_allocation_manager_.SetAccessMode(access_mode); +} + +void RCOnRemoteControlSettingsNotification::ProcessAllowedParam() { + if (!(*message_)[app_mngr::strings::msg_params].keyExists( + message_params::kAllowed)) { + SDL_LOG_DEBUG("No allowed param received. Using last known: " + << std::boolalpha + << resource_allocation_manager_.is_rc_enabled()); + return; + } const bool is_allowed = (*message_)[app_mngr::strings::msg_params][message_params::kAllowed] .asBool(); + if (is_allowed) { SDL_LOG_DEBUG("Allowing RC Functionality"); resource_allocation_manager_.set_rc_enabled(true); - } else { - SDL_LOG_DEBUG("Disallowing RC Functionality"); - DisallowRCFunctionality(); - resource_allocation_manager_.ResetAllAllocations(); - resource_allocation_manager_.set_rc_enabled(false); - rc_consent_manager_.RemoveAllConsents(); + return; } + + SDL_LOG_DEBUG("Disallowing RC Functionality"); + DisallowRCFunctionality(); + resource_allocation_manager_.ResetAllAllocations(); + resource_allocation_manager_.set_rc_enabled(false); + rc_consent_manager_.RemoveAllConsents(); } } // namespace commands diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc index 7907013fa3..5d569e93d2 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc @@ -117,18 +117,61 @@ class RCOnRemoteControlSettingsNotificationTest }; TEST_F(RCOnRemoteControlSettingsNotificationTest, - Run_Allowed_SetAccessMode) { // Arrange + Run_Allowed_MissedAccessMode) { // Arrange MessageSharedPtr mobile_message = CreateBasicMessage(); (*mobile_message)[application_manager::strings::msg_params] [message_params::kAllowed] = true; // Expectations + EXPECT_CALL(mock_allocation_manager_, SetAccessMode(_)).Times(0); + EXPECT_CALL(mock_allocation_manager_, set_rc_enabled(true)); - ON_CALL(mock_allocation_manager_, GetAccessMode()) - .WillByDefault(Return(hmi_apis::Common_RCAccessMode::ASK_DRIVER)); + // Act + std::shared_ptr< + rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification> + command = CreateRCCommand< + rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>( + mobile_message); + command->Run(); +} + +TEST_F(RCOnRemoteControlSettingsNotificationTest, + Run_AccessMode_MissedAllowed) { // Arrange + MessageSharedPtr mobile_message = CreateBasicMessage(); + (*mobile_message)[application_manager::strings::msg_params] + [message_params::kAccessMode] = + hmi_apis::Common_RCAccessMode::ASK_DRIVER; + + // Expectations + EXPECT_CALL(mock_allocation_manager_, set_rc_enabled(_)).Times(0); EXPECT_CALL(mock_allocation_manager_, SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER)); + + // Act + std::shared_ptr< + rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification> + command = CreateRCCommand< + rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>( + mobile_message); + + command->Run(); +} + +TEST_F(RCOnRemoteControlSettingsNotificationTest, + Run_AccessModeAndAllowed_BothPresent) { // Arrange + MessageSharedPtr mobile_message = CreateBasicMessage(); + (*mobile_message)[application_manager::strings::msg_params] + [message_params::kAllowed] = true; + (*mobile_message)[application_manager::strings::msg_params] + [message_params::kAccessMode] = + hmi_apis::Common_RCAccessMode::ASK_DRIVER; + + // Expectations + EXPECT_CALL(mock_allocation_manager_, set_rc_enabled(true)); + EXPECT_CALL(mock_allocation_manager_, + SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER)); + // Act std::shared_ptr< rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification> -- cgit v1.2.1 From b0ccb4809af33a1b8fd30c16bfa77ac738e860ea Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Wed, 13 Oct 2021 15:46:18 -0400 Subject: Fix VR.ChangeRegistration issue (#3794) There was found a misprint for a VR interface in `ChangeRegistration` request. Because of that, there might be a situations when HMI responds to one part of request faster than another part was actually sent. All required ordering and checks were updated. --- .../src/commands/mobile/change_registration_request.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc index 47ff7cbea1..f7fc7d2284 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc @@ -230,21 +230,28 @@ void ChangeRegistrationRequest::Run() { SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); return; } + if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != vr_state) { StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_VR); } + if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != tts_state) { StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS); } if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != ui_state) { + StartAwaitForInterface(HmiInterfaces::InterfaceID::HMI_INTERFACE_UI); + } + + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { SendUIRequest(app, msg_params, hmi_language); } if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) { SendTTSRequest(app, msg_params); } - if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { + + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) { SendVRRequest(app, msg_params); } } -- cgit v1.2.1 From c1ae269995ac18a5fd2cbbb9ed0ab2beb213d7d2 Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Thu, 14 Oct 2021 16:48:26 -0400 Subject: Fix/crash after ptu for another app hmi type (#3795) * Added RC plugin extension after PTU * Add new event `kAppHmiTypesChanged` Co-authored-by: OlhaVorobiova --- .../plugin_manager/rpc_plugin.h | 1 + .../app_service_app_extension.h | 3 +- .../src/app_service_app_extension.cc | 2 - .../src/app_service_rpc_plugin.cc | 21 ++++-- .../include/rc_rpc_plugin/rc_app_extension.h | 5 +- .../include/rc_rpc_plugin/rc_rpc_plugin.h | 12 +++- .../rc_rpc_plugin/src/rc_app_extension.cc | 7 +- .../rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc | 3 +- .../rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc | 77 +++++++++++++++------- .../test/commands/button_press_request_test.cc | 5 +- .../get_interior_vehicle_data_request_test.cc | 6 +- .../on_interior_vehicle_data_notification_test.cc | 3 +- .../rc_get_interior_vehicle_data_consent_test.cc | 5 +- .../set_interior_vehicle_data_request_test.cc | 4 +- .../rc_rpc_plugin/test/rc_app_extension_test.cc | 6 +- .../test/rc_pending_resumption_handler_test.cc | 9 +-- .../resource_allocation_manager_impl_test.cc | 37 ++++------- .../extensions/system_capability_app_extension.h | 2 +- .../sdl_rpc_plugin/waypoints_app_extension.h | 2 +- .../extensions/system_capability_app_extension.cc | 3 - .../sdl_rpc_plugin/src/sdl_rpc_plugin.cc | 41 +++++++----- .../sdl_rpc_plugin/src/waypoints_app_extension.cc | 1 - .../vehicle_info_app_extension.h | 2 +- .../src/vehicle_info_app_extension.cc | 2 - .../vehicle_info_plugin/src/vehicle_info_plugin.cc | 22 +++++-- .../application_manager/src/application_impl.cc | 13 +++- .../src/application_manager_impl.cc | 13 +++- 27 files changed, 186 insertions(+), 121 deletions(-) diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h index 0c7538e809..4f143dc365 100644 --- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h +++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h @@ -62,6 +62,7 @@ enum ApplicationEvent { kApplicationUnregistered, kDeleteApplicationData, kGlobalPropertiesUpdated, + kAppHmiTypesChanged, kRCStatusChanged }; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h index 8d307325fc..b7898709ab 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_app_extension.h @@ -44,7 +44,6 @@ class AppServiceRpcPlugin; namespace app_mngr = application_manager; -typedef int AppExtensionUID; typedef mobile_apis::VehicleDataType::eType VehicleDataType; /** * @brief Defines set of app service types @@ -114,6 +113,8 @@ class AppServiceAppExtension : public app_mngr::AppExtension { static AppServiceAppExtension& ExtractASExtension( application_manager::Application& app); + static const app_mngr::AppExtensionUID AppServiceAppExtensionUID = 455; + private: AppServiceSubscriptions subscribed_data_; AppServiceRpcPlugin& plugin_; diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc index 1b8c5bfd1d..1cd2fd690a 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_app_extension.cc @@ -38,8 +38,6 @@ SDL_CREATE_LOG_VARIABLE("AppServiceRpcPlugin") namespace app_service_rpc_plugin { -const AppExtensionUID AppServiceAppExtensionUID = 455; - AppServiceAppExtension::AppServiceAppExtension( AppServiceRpcPlugin& plugin, application_manager::Application& app) : app_mngr::AppExtension(AppServiceAppExtensionUID) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc index 0e805da46c..e842ea7276 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc @@ -76,11 +76,22 @@ void AppServiceRpcPlugin::OnPolicyEvent(plugins::PolicyEvent event) {} void AppServiceRpcPlugin::OnApplicationEvent( plugins::ApplicationEvent event, app_mngr::ApplicationSharedPtr application) { - if (plugins::ApplicationEvent::kApplicationRegistered == event) { - application->AddExtension( - std::make_shared(*this, *application)); - } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) { - DeleteSubscriptions(application); + switch (event) { + case plugins::ApplicationEvent::kApplicationRegistered: { + application->AddExtension( + std::make_shared(*this, *application)); + break; + } + + case plugins::ApplicationEvent::kApplicationUnregistered: + case plugins::ApplicationEvent::kDeleteApplicationData: { + DeleteSubscriptions(application); + break; + } + + default: { + break; + } } } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h index 8b2162c9ab..031e89fd85 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h @@ -143,8 +143,7 @@ class RCRPCPlugin; class RCAppExtension : public application_manager::AppExtension { public: - explicit RCAppExtension(application_manager::AppExtensionUID uid, - RCRPCPlugin& plugin, + explicit RCAppExtension(RCRPCPlugin& plugin, application_manager::Application& application); ~RCAppExtension(); @@ -232,6 +231,8 @@ class RCAppExtension : public application_manager::AppExtension { */ void SetUserLocation(const Grid& grid); + static const application_manager::AppExtensionUID RCAppExtensionID = 153; + private: /** * @brief Checks if the application's pointer is valid and update the diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h index c1f7339aa3..e45d48d63a 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h @@ -125,7 +125,17 @@ class RCRPCPlugin : public plugins::RPCPlugin { bool IsOtherAppsSubscribed(const rc_rpc_types::ModuleUid& module, const uint32_t app_id); - static const uint32_t kRCPluginID = 153; + /** + * @brief Creates the RC extension for specified application + * @param application pointer to app to work with + */ + void CreateRcExtension(application_manager::ApplicationSharedPtr application); + + /** + * @brief Removes the RC extensions for specified application + * @param application pointer to app to work with + */ + void RemoveRcExtension(application_manager::ApplicationSharedPtr application); typedef std::vector Apps; static Apps GetRCApplications( diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc index b623350388..b38df8f985 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_app_extension.cc @@ -71,10 +71,11 @@ std::set ConvertSmartObjectToModuleCollection( } // namespace namespace rc_rpc_plugin { -RCAppExtension::RCAppExtension(application_manager::AppExtensionUID uid, - RCRPCPlugin& plugin, +RCAppExtension::RCAppExtension(RCRPCPlugin& plugin, application_manager::Application& application) - : AppExtension(uid), plugin_(plugin), application_(application) {} + : AppExtension(RCAppExtensionID) + , plugin_(plugin) + , application_(application) {} void RCAppExtension::SubscribeToInteriorVehicleData(const ModuleUid& module) { subscribed_interior_vehicle_data_.insert(module); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc index b2d1f1513b..7b6d5041c0 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc @@ -186,7 +186,8 @@ const std::vector RCHelpers::GetModuleTypesList() { RCAppExtensionPtr RCHelpers::GetRCExtension( application_manager::Application& app) { SDL_LOG_AUTO_TRACE(); - auto extension_interface = app.QueryInterface(RCRPCPlugin::kRCPluginID); + auto extension_interface = + app.QueryInterface(RCAppExtension::RCAppExtensionID); auto extension = std::static_pointer_cast(extension_interface); return extension; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc index 8250437e78..b110d3157d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc @@ -111,42 +111,50 @@ void RCRPCPlugin::OnApplicationEvent( application_manager::plugin_manager::ApplicationEvent event, application_manager::ApplicationSharedPtr application) { SDL_LOG_AUTO_TRACE(); - if (!application->is_remote_control_supported()) { - SDL_LOG_DEBUG( - "Remote control is not supported for application with app_id: " - << application->app_id()); - return; - } + switch (event) { case plugins::kApplicationRegistered: { - auto extension = std::shared_ptr( - new RCAppExtension(kRCPluginID, *this, *application)); - DCHECK_OR_RETURN_VOID(application->AddExtension(extension)); - const auto driver_location = - rc_capabilities_manager_ - ->GetDriverLocationFromSeatLocationCapability(); - extension->SetUserLocation(driver_location); + if (application->is_remote_control_supported()) { + CreateRcExtension(application); + } + break; } + case plugins::kApplicationUnregistered: case plugins::kApplicationExit: { - resource_allocation_manager_->OnApplicationEvent(event, application); - interior_data_manager_->OnApplicationEvent(event, application); - break; - } - case plugins::kApplicationUnregistered: { - resource_allocation_manager_->OnApplicationEvent(event, application); - interior_data_manager_->OnApplicationEvent(event, application); + if (application->is_remote_control_supported()) { + resource_allocation_manager_->OnApplicationEvent(event, application); + interior_data_manager_->OnApplicationEvent(event, application); + } + break; } case plugins::kGlobalPropertiesUpdated: { - const auto user_location = application->get_user_location(); - auto extension = RCHelpers::GetRCExtension(*application); - extension->SetUserLocation(user_location); + if (application->is_remote_control_supported()) { + const auto user_location = application->get_user_location(); + auto extension = RCHelpers::GetRCExtension(*application); + extension->SetUserLocation(user_location); + } + break; } case plugins::kRCStatusChanged: { - resource_allocation_manager_->SendOnRCStatusNotifications( - NotificationTrigger::APP_REGISTRATION, application); + if (application->is_remote_control_supported()) { + resource_allocation_manager_->SendOnRCStatusNotifications( + NotificationTrigger::APP_REGISTRATION, application); + } + + break; + } + case plugins::kAppHmiTypesChanged: { + auto extension = + application->QueryInterface(RCAppExtension::RCAppExtensionID); + if (!application->is_remote_control_supported() && extension) { + RemoveRcExtension(application); + } else if (application->is_remote_control_supported() && !extension) { + CreateRcExtension(application); + } + break; } default: @@ -154,6 +162,25 @@ void RCRPCPlugin::OnApplicationEvent( } } +void RCRPCPlugin::CreateRcExtension( + application_manager::ApplicationSharedPtr application) { + auto extension = + std::shared_ptr(new RCAppExtension(*this, *application)); + DCHECK_OR_RETURN_VOID(application->AddExtension(extension)); + const auto driver_location = + rc_capabilities_manager_->GetDriverLocationFromSeatLocationCapability(); + extension->SetUserLocation(driver_location); +} + +void RCRPCPlugin::RemoveRcExtension( + application_manager::ApplicationSharedPtr application) { + resource_allocation_manager_->OnApplicationEvent( + plugins::kApplicationUnregistered, application); + interior_data_manager_->OnApplicationEvent(plugins::kApplicationUnregistered, + application); + application->RemoveExtension(RCAppExtension::RCAppExtensionID); +} + void RCRPCPlugin::ProcessResumptionSubscription( application_manager::Application& app, RCAppExtension& ext) { SDL_LOG_AUTO_TRACE(); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc index 3772a25f47..f4ef39f488 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc @@ -65,7 +65,6 @@ using ::testing::ReturnRef; using ::testing::SaveArg; namespace { -const int kModuleId = 153u; const uint32_t kConnectionKey = 1u; const uint32_t kAppId = 0u; const std::string kPolicyAppId = "Test"; @@ -83,13 +82,13 @@ class ButtonPressRequestTest smart_objects::SmartType_Map)) , mock_app_(std::make_shared >()) , rc_app_extension_(std::make_shared( - kModuleId, rc_plugin_, *mock_app_)) {} + rc_plugin_, *mock_app_)) {} void SetUp() OVERRIDE { smart_objects::SmartObject control_caps((smart_objects::SmartType_Array)); (*rc_capabilities_)[strings::kradioControlCapabilities] = control_caps; ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); - ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID)) + ON_CALL(*mock_app_, QueryInterface(RCAppExtension::RCAppExtensionID)) .WillByDefault(Return(rc_app_extension_)); ON_CALL(app_mngr_, GetPolicyHandler()) .WillByDefault(ReturnRef(mock_policy_handler_)); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc index fdfa3ea03a..5fa474c631 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc @@ -95,9 +95,9 @@ class GetInteriorVehicleDataRequestTest : mock_app_(std::make_shared >()) , mock_app2_(std::make_shared >()) , rc_app_extension_( - std::make_shared(kModuleId, rc_plugin_, *mock_app_)) - , rc_app_extension2_(std::make_shared( - kModuleId, rc_plugin_, *mock_app2_)) + std::make_shared(rc_plugin_, *mock_app_)) + , rc_app_extension2_( + std::make_shared(rc_plugin_, *mock_app2_)) , apps_lock_(std::make_shared()) , apps_da_(apps_, apps_lock_) , rc_capabilities_(std::make_shared( diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc index 6c7a7ba67e..9acfc084c5 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc @@ -62,7 +62,6 @@ const uint32_t kConnectionKey = 1u; const std::string kPolicyAppId = "Test"; const std::string module_type = "CLIMATE"; const std::string module_id = "34045662-a9dc-4823-8435-91056d4c26cb"; -const int kModuleId = 153u; } // namespace namespace rc_rpc_plugin_test { @@ -75,7 +74,7 @@ class OnInteriorVehicleDataNotificationTest OnInteriorVehicleDataNotificationTest() : mock_app_(std::make_shared >()) , rc_app_extension_( - std::make_shared(kModuleId, rc_plugin_, *mock_app_)) + std::make_shared(rc_plugin_, *mock_app_)) , apps_lock_(std::make_shared()) , apps_da_(apps_, apps_lock_) { ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId)); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc index 1b83034daf..82d1b128f0 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc @@ -99,7 +99,6 @@ const std::string kResource = "CLIMATE"; const std::string kResourceId = "34045662-a9dc-4823-8435-91056d4c26cb"; const std::string kPolicyAppId = "policy_app_id"; const std::string kMacAddress = "device1"; -const uint32_t kPluginID = RCRPCPlugin::kRCPluginID; } // namespace class RCGetInteriorVehicleDataConsentTest @@ -124,7 +123,7 @@ class RCGetInteriorVehicleDataConsentTest hmi_so_factory_, mobile_so_factoy_) , rc_app_extension_( - std::make_shared(kPluginID, rc_plugin_, *mock_app_)) + std::make_shared(rc_plugin_, *mock_app_)) , mock_rpc_plugin_manager( std::make_shared >()) , rpc_plugin(mock_rpc_plugin) @@ -140,7 +139,7 @@ class RCGetInteriorVehicleDataConsentTest .WillByDefault(Return(application_manager::HmiInterfaces:: InterfaceState::STATE_AVAILABLE)); ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_)); - ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID)) + ON_CALL(*mock_app_, QueryInterface(RCAppExtension::RCAppExtensionID)) .WillByDefault(Return(rc_app_extension_)); testing::NiceMock mock_interior_data_cache_; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc index 9ba959de29..fe190a796f 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc @@ -74,7 +74,7 @@ class SetInteriorVehicleDataRequestTest SetInteriorVehicleDataRequestTest() : mock_app_(std::make_shared >()) , rc_app_extension_( - std::make_shared(kModuleId, rc_plugin_, *mock_app_)) + std::make_shared(rc_plugin_, *mock_app_)) , rc_capabilities_(std::make_shared( smart_objects::SmartType::SmartType_Array)) {} @@ -89,7 +89,7 @@ class SetInteriorVehicleDataRequestTest .WillByDefault(Return(application_manager::HmiInterfaces:: InterfaceState::STATE_AVAILABLE)); ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_)); - ON_CALL(*mock_app_, QueryInterface(RCRPCPlugin::kRCPluginID)) + ON_CALL(*mock_app_, QueryInterface(RCAppExtension::RCAppExtensionID)) .WillByDefault(Return(rc_app_extension_)); ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId)); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc index 60c3fb9135..ea099ef901 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_app_extension_test.cc @@ -40,10 +40,6 @@ #include "rc_rpc_plugin/rc_module_constants.h" #include "rc_rpc_plugin/rc_rpc_plugin.h" -namespace { -const uint32_t kRCAppExtensionId = 1ull; -} // namespace - namespace test { namespace components { namespace rc_rpc_plugin_test { @@ -57,7 +53,7 @@ class RcAppExtensionTest : public testing::Test { RcAppExtensionTest() : mock_app_(new NiceMock()) , rc_app_extension_(std::make_shared( - kRCAppExtensionId, rc_plugin_, *mock_app_)) {} + rc_plugin_, *mock_app_)) {} protected: std::unique_ptr mock_app_; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc index 077d0d2927..8ea478cd19 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/rc_pending_resumption_handler_test.cc @@ -78,7 +78,6 @@ const std::string kModuleType_1 = "CLIMATE"; const std::string kModuleId_1 = "9cb963f3-c5e8-41cb-b001-19421cc16552"; const std::string kModuleType_2 = "RADIO"; const std::string kModuleId_2 = "357a3918-9f35-4d86-a8b6-60cd4308d76f"; -const uint32_t kRCPluginID = rc_rpc_plugin::RCRPCPlugin::kRCPluginID; const auto kSourceHMI = application_manager::commands::Command::SOURCE_HMI; } // namespace @@ -171,9 +170,11 @@ class RCPendingResumptionHandlerTest : public ::testing::Test { } rc_rpc_plugin::RCAppExtensionPtr CreateExtension(MockApplication& app) { - auto rc_app_ext = std::make_shared( - kRCPluginID, rc_plugin_, app); - ON_CALL(app, QueryInterface(kRCPluginID)).WillByDefault(Return(rc_app_ext)); + auto rc_app_ext = + std::make_shared(rc_plugin_, app); + ON_CALL(app, + QueryInterface(rc_rpc_plugin::RCAppExtension::RCAppExtensionID)) + .WillByDefault(Return(rc_app_ext)); return rc_app_ext; } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc index 501fbc323d..bae6ed805c 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager/resource_allocation_manager_impl_test.cc @@ -112,9 +112,8 @@ class RAManagerTest : public ::testing::Test { , mock_rc_helpers_(MockRCHelpers::rc_helpers_mock()) { ON_CALL(mock_app_mngr_, GetPolicyHandler()) .WillByDefault(ReturnRef(mock_policy_handler_)); - auto plugin_id = rc_rpc_plugin::RCRPCPlugin::kRCPluginID; app_ext_ptr_ = std::make_shared( - plugin_id, rc_plugin_, *mock_app_1_); + rc_plugin_, *mock_app_1_); ON_CALL(*mock_app_1_, app_id()).WillByDefault(Return(kAppId1)); PrepareResources(); @@ -130,13 +129,12 @@ class RAManagerTest : public ::testing::Test { ON_CALL(mock_app_mngr_, application(kAppId1)) .WillByDefault(Return(mock_app_1_)); ON_CALL(*mock_app_1_, - QueryInterface(rc_rpc_plugin::RCRPCPlugin::kRCPluginID)) + QueryInterface(rc_rpc_plugin::RCAppExtension::RCAppExtensionID)) .WillByDefault(Return(app_ext_ptr_)); ON_CALL(mock_app_mngr_, application(kAppId2)) .WillByDefault(Return(mock_app_2_)); - ON_CALL(*mock_app_2_, - QueryInterface(rc_rpc_plugin::RCRPCPlugin::kRCPluginID)) + ON_CALL(*mock_app_2_, QueryInterface(RCAppExtension::RCAppExtensionID)) .WillByDefault(Return(app_ext_ptr_)); OnRCStatusNotificationExpectations(); @@ -144,10 +142,7 @@ class RAManagerTest : public ::testing::Test { void SetUp() OVERRIDE { rc_app_extension_ = std::make_shared( - static_cast( - rc_rpc_plugin::RCRPCPlugin::kRCPluginID), - rc_plugin_, - *mock_app_1_); + rc_plugin_, *mock_app_1_); ON_CALL(mock_rc_capabilities_manager_, GetDriverLocationFromSeatLocationCapability()) .WillByDefault(Return(kDriverLocation)); @@ -407,11 +402,8 @@ TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) { mock_app_mngr_, mock_rpc_service_, mock_rc_capabilities_manager_); ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY); - RCAppExtensionPtr rc_extension_ptr = std::make_shared( - application_manager::AppExtensionUID( - rc_rpc_plugin::RCRPCPlugin::kRCPluginID), - rc_plugin_, - *mock_app_1_); + RCAppExtensionPtr rc_extension_ptr = + std::make_shared(rc_plugin_, *mock_app_1_); EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED, ra_manager.AcquireResource(kModuleType1, kModuleId, kAppId1)); @@ -483,13 +475,10 @@ TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) { EXPECT_CALL(mock_app_mngr_, applications()).WillRepeatedly(Return(apps_da)); - RCAppExtensionPtr rc_extension_ptr = std::make_shared( - application_manager::AppExtensionUID( - rc_rpc_plugin::RCRPCPlugin::kRCPluginID), - rc_plugin_, - *mock_app_1_); + RCAppExtensionPtr rc_extension_ptr = + std::make_shared(rc_plugin_, *mock_app_1_); - EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID)) + EXPECT_CALL(*mock_app_1_, QueryInterface(RCAppExtension::RCAppExtensionID)) .WillRepeatedly(Return(rc_extension_ptr)); // Act @@ -517,13 +506,9 @@ TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) { .WillRepeatedly(Return(mock_app_1_)); RCAppExtensionPtr rc_extension_ptr = - std::make_shared( - application_manager::AppExtensionUID( - rc_rpc_plugin::RCRPCPlugin::kRCPluginID), - rc_plugin_, - *mock_app_1_); + std::make_shared(rc_plugin_, *mock_app_1_); - EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID)) + EXPECT_CALL(*mock_app_1_, QueryInterface(RCAppExtension::RCAppExtensionID)) .WillRepeatedly(Return(rc_extension_ptr)); ON_CALL(*mock_app_1_, is_remote_control_supported()) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h index 09fbc565c5..6b25bb7316 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/extensions/system_capability_app_extension.h @@ -69,7 +69,7 @@ class SystemCapabilityAppExtension : public app_mngr_::AppExtension { void RevertResumption( const smart_objects::SmartObject& subscriptions) OVERRIDE; - static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID; + static const app_mngr_::AppExtensionUID SystemCapabilityAppExtensionUID = 200; static SystemCapabilityAppExtension& ExtractExtension( app_mngr_::Application& app); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h index 9243baedee..ce4f56bd84 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/waypoints_app_extension.h @@ -59,7 +59,7 @@ class WayPointsAppExtension : public app_mngr::AppExtension { * @brief WayPointsAppExtensionUID unique identifier of waypoints * aplication extension */ - static unsigned WayPointsAppExtensionUID; + static const app_mngr::AppExtensionUID WayPointsAppExtensionUID = 138; private: SDLRPCPlugin& plugin_; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc index 117e65d2cb..0217c6f6a5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/extensions/system_capability_app_extension.cc @@ -7,9 +7,6 @@ SDL_CREATE_LOG_VARIABLE("GetSystemCapabilitiesAppExtension") namespace app_mngr_ = application_manager; namespace strings = app_mngr::strings; -const app_mngr_::AppExtensionUID - SystemCapabilityAppExtension::SystemCapabilityAppExtensionUID = 200; - SystemCapabilityAppExtension::SystemCapabilityAppExtension( sdl_rpc_plugin::SDLRPCPlugin& plugin, app_mngr_::Application& app) : app_mngr_::AppExtension( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc index 7cdfc73ed0..a0ad320cac 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc @@ -81,21 +81,32 @@ void SDLRPCPlugin::OnApplicationEvent( plugins::ApplicationEvent event, app_mngr::ApplicationSharedPtr application) { SDL_LOG_AUTO_TRACE(); - if (plugins::ApplicationEvent::kApplicationRegistered == event) { - application->AddExtension( - std::make_shared(*this, *application)); - - auto sys_cap_ext_ptr = - std::make_shared(*this, *application); - application->AddExtension(sys_cap_ext_ptr); - // Processing automatic subscription to SystemCapabilities for DISPLAY type - const auto capability_type = - mobile_apis::SystemCapabilityType::eType::DISPLAYS; - SDL_LOG_DEBUG("Subscription to DISPLAYS capability is enabled"); - sys_cap_ext_ptr->SubscribeTo(capability_type); - - } else if (plugins::ApplicationEvent::kDeleteApplicationData == event) { - ClearSubscriptions(application); + switch (event) { + case plugins::ApplicationEvent::kApplicationRegistered: { + application->AddExtension( + std::make_shared(*this, *application)); + + auto sys_cap_ext_ptr = + std::make_shared(*this, *application); + application->AddExtension(sys_cap_ext_ptr); + // Processing automatic subscription to SystemCapabilities for DISPLAY + // type + const auto capability_type = + mobile_apis::SystemCapabilityType::eType::DISPLAYS; + SDL_LOG_DEBUG("Subscription to DISPLAYS capability is enabled"); + sys_cap_ext_ptr->SubscribeTo(capability_type); + break; + } + + case plugins::ApplicationEvent::kApplicationUnregistered: + case plugins::ApplicationEvent::kDeleteApplicationData: { + ClearSubscriptions(application); + break; + } + + default: { + break; + } } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc index ed8283e1f9..3c73a61f1b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/waypoints_app_extension.cc @@ -32,7 +32,6 @@ SDL_CREATE_LOG_VARIABLE("WayPointsAppExtension") namespace sdl_rpc_plugin { namespace strings = application_manager::strings; -unsigned WayPointsAppExtension::WayPointsAppExtensionUID = 138; WayPointsAppExtension::WayPointsAppExtension( SDLRPCPlugin& plugin, application_manager::Application& app) diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h index 7e3eabb6a1..1d3fcd1e74 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_app_extension.h @@ -152,7 +152,7 @@ class VehicleInfoAppExtension : public app_mngr::AppExtension { * @brief VehicleInfoAppExtensionUID unique identifier of VehicleInfo * aplication extension */ - static unsigned VehicleInfoAppExtensionUID; + static const app_mngr::AppExtensionUID VehicleInfoAppExtensionUID = 146; /** * @brief ExtractVIExtension utility function to extract application extension diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc index 1b503ff943..cff5d294ad 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc @@ -38,8 +38,6 @@ SDL_CREATE_LOG_VARIABLE("VehicleInfoPlugin") namespace vehicle_info_plugin { namespace strings = application_manager::strings; -unsigned VehicleInfoAppExtension::VehicleInfoAppExtensionUID = 146; - VehicleInfoAppExtension::VehicleInfoAppExtension( VehicleInfoPlugin& plugin, application_manager::Application& app) : app_mngr::AppExtension( diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc index b20e52636c..84bd9f6b04 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc @@ -110,12 +110,22 @@ void VehicleInfoPlugin::OnApplicationEvent( plugins::ApplicationEvent event, app_mngr::ApplicationSharedPtr application) { SDL_LOG_AUTO_TRACE(); - if (plugins::ApplicationEvent::kApplicationRegistered == event) { - application->AddExtension( - std::make_shared(*this, *application)); - } else if ((plugins::ApplicationEvent::kDeleteApplicationData == event) || - (plugins::ApplicationEvent::kApplicationUnregistered == event)) { - DeleteSubscriptions(application); + switch (event) { + case plugins::ApplicationEvent::kApplicationRegistered: { + application->AddExtension( + std::make_shared(*this, *application)); + break; + } + + case plugins::ApplicationEvent::kApplicationUnregistered: + case plugins::ApplicationEvent::kDeleteApplicationData: { + DeleteSubscriptions(application); + break; + } + + default: { + break; + } } } diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index a53141b5be..42afd93459 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -204,6 +204,7 @@ void ApplicationImpl::ChangeSupportingAppHMIType() { set_voice_communication_supported(false); set_mobile_projection_enabled(false); set_webengine_projection_enabled(false); + set_remote_control_supported(false); const smart_objects::SmartObject& array_app_types = *app_types_; uint32_t lenght_app_types = array_app_types.length(); @@ -224,6 +225,9 @@ void ApplicationImpl::ChangeSupportingAppHMIType() { case mobile_apis::AppHMIType::WEB_VIEW: set_webengine_projection_enabled(true); break; + case mobile_apis::AppHMIType::REMOTE_CONTROL: + set_remote_control_supported(true); + break; default: break; } @@ -1302,6 +1306,7 @@ AppExtensionPtr ApplicationImpl::QueryInterface(AppExtensionUID uid) { } bool ApplicationImpl::AddExtension(AppExtensionPtr extension) { + SDL_LOG_AUTO_TRACE(); if (!QueryInterface(extension->uid())) { SDL_LOG_TRACE("Add extenstion to add id" << app_id() << " with uid " << extension->uid()); @@ -1312,12 +1317,18 @@ bool ApplicationImpl::AddExtension(AppExtensionPtr extension) { } bool ApplicationImpl::RemoveExtension(AppExtensionUID uid) { + SDL_LOG_AUTO_TRACE(); auto it = std::find_if( extensions_.begin(), extensions_.end(), [uid](AppExtensionPtr extension) { return extension->uid() == uid; }); - return it != extensions_.end(); + if (extensions_.end() != it) { + extensions_.erase(it); + return true; + } + + return false; } const std::list& ApplicationImpl::Extensions() const { diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index f350c9fc5a..b0b05a3031 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -4493,8 +4493,17 @@ void ApplicationManagerImpl::OnUpdateHMIAppType( } if (flag_diffirence_app_hmi_type) { - (*it)->set_app_types(transform_app_hmi_types); - (*it)->ChangeSupportingAppHMIType(); + ApplicationSharedPtr app = *it; + + app->set_app_types(transform_app_hmi_types); + app->ChangeSupportingAppHMIType(); + + auto on_app_hmi_types_changed = [app]( + plugin_manager::RPCPlugin& plugin) { + plugin.OnApplicationEvent(plugin_manager::kAppHmiTypesChanged, app); + }; + ApplyFunctorForEachPlugin(on_app_hmi_types_changed); + const mobile_apis::HMILevel::eType app_hmi_level = (*it)->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (app_hmi_level == mobile_api::HMILevel::HMI_BACKGROUND) { -- cgit v1.2.1 From 0ed38e8d2f7cb3a61a303cca2806a06ce9a1d58d Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Thu, 14 Oct 2021 17:25:42 -0400 Subject: Fix early IsRegistered() state of application (#3796) * Fix early IsRegistered state of application Mark application as registered only when app registration was finalized and all corresponding requests were sent to HMI. This prevents data races in case when language has been changed by HMI and application is in intermediate registration state yet. * fixup! Fix early IsRegistered state of application --- .../hmi/on_tts_language_change_notification.cc | 15 +++--- .../hmi/on_vr_language_change_notification.cc | 9 +++- .../src/commands/hmi/sdl_activate_app_request.cc | 50 ++++++++++++------ .../mobile/register_app_interface_request.cc | 3 +- .../test/commands/hmi/hmi_notifications_test.cc | 4 ++ .../commands/hmi/sdl_activate_app_request_test.cc | 61 ++++++++++++++++++---- .../src/application_manager_impl.cc | 3 -- .../src/message_helper/message_helper.cc | 2 +- 8 files changed, 108 insertions(+), 39 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc index 3c25ff5386..d693c00ac3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_tts_language_change_notification.cc @@ -88,12 +88,15 @@ void OnTTSLanguageChangeNotification::Run() { (*message_)[strings::params][strings::function_id] = static_cast(mobile_apis::FunctionID::OnLanguageChangeID); - const ApplicationSet& accessor = - application_manager_.applications().GetData(); - ApplicationSetIt it = accessor.begin(); - for (; accessor.end() != it;) { - ApplicationSharedPtr app = *it; - ++it; + const auto applications = application_manager_.applications().GetData(); + for (const auto& app : applications) { + if (!app->IsRegistered()) { + SDL_LOG_DEBUG("Skipping app " + << app->app_id() + << " which has not finished the registration process"); + continue; + } + (*message_)[strings::params][strings::connection_key] = app->app_id(); SendNotificationToMobile(message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc index bf00291c88..23c1ec1b80 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc @@ -79,10 +79,17 @@ void OnVRLanguageChangeNotification::Run() { static_cast(mobile_apis::FunctionID::OnLanguageChangeID); const auto applications = application_manager_.applications().GetData(); - for (auto app : applications) { + if (!app->IsRegistered()) { + SDL_LOG_DEBUG("Skipping app " + << app->app_id() + << " which has not finished the registration process"); + continue; + } + (*message_)[strings::params][strings::connection_key] = app->app_id(); SendNotificationToMobile(message_); + if (static_cast(app->language()) != (*message_)[strings::msg_params][strings::language].asInt()) { application_manager_.state_controller().SetRegularState( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index a8b34bf2d4..88b3065fb0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -136,18 +136,10 @@ void SDLActivateAppRequest::Run() { static_cast(function_id()), hmi_apis::Common_Result::REJECTED, "HMIDeactivate is active"); - } else if (app && !app->IsRegistered() && app->is_cloud_app()) { - SDL_LOG_DEBUG("Starting cloud application."); - const ApplicationManagerSettings& settings = - application_manager_.get_settings(); - uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * - settings.cloud_app_max_retry_attempts()); - application_manager_.UpdateRequestTimeout( - 0, correlation_id(), default_timeout_ + total_retry_timeout); - subscribe_on_event(BasicCommunication_OnAppRegistered); - application_manager_.connection_handler().ConnectToDevice(app->device()); - } else { - const uint32_t application_id = app_id(); + return; + } + + if (!app->is_cloud_app() || app->IsRegistered()) { auto main_state = app->CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (mobile_apis::HMILevel::INVALID_ENUM == main_state->hmi_level()) { @@ -156,11 +148,30 @@ void SDLActivateAppRequest::Run() { "yet, postpone activation"); auto& postponed_activation_ctrl = application_manager_.state_controller() .GetPostponedActivationController(); - postponed_activation_ctrl.AddAppToActivate(application_id, + postponed_activation_ctrl.AddAppToActivate(app->app_id(), correlation_id()); return; } + } + + const uint32_t application_id = app_id(); + if (app->IsRegistered()) { + SDL_LOG_DEBUG("Application is registered. Activating."); policy_handler_.OnActivateApp(application_id, correlation_id()); + return; + } + + if (app->is_cloud_app()) { + SDL_LOG_DEBUG("Starting cloud application."); + const ApplicationManagerSettings& settings = + application_manager_.get_settings(); + uint32_t total_retry_timeout = (settings.cloud_app_retry_timeout() * + settings.cloud_app_max_retry_attempts()); + application_manager_.UpdateRequestTimeout( + 0, correlation_id(), default_timeout_ + total_retry_timeout); + subscribe_on_event(BasicCommunication_OnAppRegistered); + application_manager_.connection_handler().ConnectToDevice(app->device()); + return; } } @@ -205,8 +216,7 @@ void SDLActivateAppRequest::Run() { return; } - if (app_to_activate->IsRegistered()) { - SDL_LOG_DEBUG("Application is registered. Activating."); + if (!app_to_activate->is_cloud_app() || app_to_activate->IsRegistered()) { auto main_state = app_to_activate->CurrentHmiState( mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (mobile_apis::HMILevel::INVALID_ENUM == main_state->hmi_level()) { @@ -215,13 +225,19 @@ void SDLActivateAppRequest::Run() { "yet, postpone activation"); auto& postponed_activation_ctrl = application_manager_.state_controller() .GetPostponedActivationController(); - postponed_activation_ctrl.AddAppToActivate(application_id, + postponed_activation_ctrl.AddAppToActivate(app_to_activate->app_id(), correlation_id()); return; } + } + + if (app_to_activate->IsRegistered()) { + SDL_LOG_DEBUG("Application is registered. Activating."); policy_handler_.OnActivateApp(application_id, correlation_id()); return; - } else if (app_to_activate->is_cloud_app()) { + } + + if (app_to_activate->is_cloud_app()) { SDL_LOG_DEBUG("Starting cloud application."); const ApplicationManagerSettings& settings = application_manager_.get_settings(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 2224f17c4e..9a9aa0c533 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -440,6 +440,8 @@ void FinishSendingResponseToMobile(const smart_objects::SmartObject& msg_params, &(msg_params[strings::app_hmi_type])); } + application->MarkRegistered(); + // Default HMI level should be set before any permissions validation, since // it relies on HMI level. app_manager.OnApplicationRegistered(application); @@ -732,7 +734,6 @@ void RegisterAppInterfaceRequest::Run() { } CheckLanguage(); - SendRegisterAppInterfaceResponseToMobile( ApplicationType::kNewApplication, status_notifier, add_info); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc index 82a5b536a8..53b1fdfc67 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc @@ -1368,6 +1368,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(mock_hmi_capabilities_, set_active_vr_language(_)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); + EXPECT_CALL(*app_ptr_, IsRegistered()).WillOnce(Return(true)); EXPECT_CALL(*app_ptr_, app_id()).WillOnce(Return(kAppId_)); EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang)); @@ -1412,6 +1413,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(mock_hmi_capabilities_, set_active_vr_language(_)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); + EXPECT_CALL(*app_ptr_, IsRegistered()).WillOnce(Return(true)); EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_)); EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang)); EXPECT_CALL(app_mngr_, state_controller()) @@ -1697,6 +1699,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(_)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); + EXPECT_CALL(*app_ptr_, IsRegistered()).WillOnce(Return(true)); EXPECT_CALL(*app_ptr_, app_id()).WillOnce(Return(kAppId_)); EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang)); @@ -1742,6 +1745,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(_)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); + EXPECT_CALL(*app_ptr_, IsRegistered()).WillOnce(Return(true)); EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_)); EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang)); EXPECT_CALL(mock_message_helper_, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index 443050b47f..44bd7f4a80 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -157,6 +157,8 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) { CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) .WillOnce(Return(state)); + EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(true)); + EXPECT_CALL(mock_policy_handler_, OnActivateApp(kAppID, kCorrelationID)); command->Run(); @@ -202,8 +204,14 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); - EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); - EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); + am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); + state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); + EXPECT_CALL(*mock_app, + CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillOnce(Return(state)); + + ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false)); + ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false)); ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle)); MockAppPtr mock_app_first(CreateMockApp()); @@ -264,8 +272,14 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); - EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); - EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); + am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); + state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); + EXPECT_CALL(*mock_app, + CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillOnce(Return(state)); + + ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false)); + ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false)); ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle)); DataAccessor accessor(app_list_, lock_); @@ -291,6 +305,12 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) { .WillOnce(Return(false)); EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); + am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); + state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); + EXPECT_CALL(*mock_app, + CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillOnce(Return(state)); + DataAccessor accessor(app_list_, lock_); EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor)); @@ -327,14 +347,15 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotActiveNONE_SUCCESS) { EXPECT_CALL(mock_state_controller_, IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); - EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(true)); + am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); - EXPECT_CALL(*mock_app, CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) .WillOnce(Return(state)); + EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(true)); + EXPECT_CALL(mock_policy_handler_, OnActivateApp(kAppID, kCorrelationID)); command->Run(); @@ -356,9 +377,16 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) { ON_CALL(app_mngr_, application(kAppID)).WillByDefault(Return(mock_app)); + am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); + state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); + EXPECT_CALL(*mock_app, + CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillOnce(Return(state)); + EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); - EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); - EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(false)); + ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false)); + ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false)); + EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); EXPECT_CALL(mock_state_controller_, @@ -397,6 +425,12 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); + am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); + state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); + EXPECT_CALL(*mock_app, + CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillOnce(Return(state)); + MockAppPtr mock_app_first(CreateMockApp()); ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle)); ON_CALL(*mock_app_first, is_foreground()).WillByDefault(Return(false)); @@ -429,6 +463,13 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) { EXPECT_CALL(mock_state_controller_, IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); + + am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); + state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); + EXPECT_CALL(*mock_app, + CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) + .WillOnce(Return(state)); + DataAccessor accessor(app_list_, lock_); EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor)); @@ -460,8 +501,8 @@ TEST_F(SDLActivateAppRequestTest, WaitingCloudApplication_ConnectDevice) { MockAppPtr mock_app(CreateMockApp()); EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); - EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(false)); - EXPECT_CALL(*mock_app, is_cloud_app()).WillOnce(Return(true)); + ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false)); + ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(true)); #ifndef EXTERNAL_PROPRIETARY_MODE EXPECT_CALL(app_mngr_, application(kAppID)) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index b0b05a3031..8d2875364d 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -4744,9 +4744,6 @@ void ApplicationManagerImpl::AddAppToRegisteredAppList( SDL_LOG_AUTO_TRACE(); DCHECK_OR_RETURN_VOID(application); sync_primitives::AutoLock lock(applications_list_lock_ptr_); - - // Add application to registered app list and set appropriate mark. - application->MarkRegistered(); applications_.insert(application); SDL_LOG_DEBUG("App with app_id: " << application->app_id() diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 606bc4c3f0..94d0a75c7f 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1848,7 +1848,7 @@ bool MessageHelper::CreateHMIApplicationStruct( if (file_system::FileExists(app->app_icon_path())) { message[strings::icon] = icon_path; } - if (app->IsRegistered()) { + if (!app->is_cloud_app() || app->IsRegistered()) { message[strings::hmi_display_language_desired] = app->ui_language(); message[strings::is_media_application] = app->is_media_application(); } else { -- cgit v1.2.1 From e44e292b2f0a87349e6297259474abb35cb5e542 Mon Sep 17 00:00:00 2001 From: RomanReznichenkoLuxoft <85177915+RomanReznichenkoLuxoft@users.noreply.github.com> Date: Fri, 15 Oct 2021 20:21:12 +0300 Subject: =?UTF-8?q?Removed=20the=20unit=20that=20interrupted=20the=20seque?= =?UTF-8?q?nce=20of=20closing=20the=20connect=E2=80=A6=20(#3785)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removed the unit that interrupted the sequence of closing the connection to the device via usb * Update logic for USB in transfer * fixup! Update logic for USB in transfer Co-authored-by: Andrii Kalinich --- .../src/usb/libusb/usb_connection.cc | 112 ++++++++++++--------- 1 file changed, 63 insertions(+), 49 deletions(-) diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc index 44e037e2b5..865784e9a5 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc @@ -81,7 +81,6 @@ UsbConnection::UsbConnection(const DeviceUID& device_uid, UsbConnection::~UsbConnection() { SDL_LOG_TRACE("enter with this" << this); Finalise(); - libusb_free_transfer(in_transfer_); delete[] in_buffer_; SDL_LOG_TRACE("exit"); } @@ -97,6 +96,12 @@ void OutTransferCallback(libusb_transfer* transfer) { bool UsbConnection::PostInTransfer() { SDL_LOG_TRACE("enter"); + + if (nullptr == in_transfer_) { + SDL_LOG_TRACE("exit with FALSE. Condition: nullptr == in_transfer_"); + return false; + } + libusb_fill_bulk_transfer(in_transfer_, device_handle_, in_endpoint_, @@ -128,36 +133,41 @@ std::string hex_data(const unsigned char* const buffer, } void UsbConnection::OnInTransfer(libusb_transfer* transfer) { - SDL_LOG_AUTO_TRACE(); - if (transfer->status == LIBUSB_TRANSFER_CANCELLED) { - SDL_LOG_DEBUG("Free already canceled transfer."); - libusb_free_transfer(transfer); - return; - } - SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer); - if (transfer->status == LIBUSB_TRANSFER_COMPLETED) { - SDL_LOG_DEBUG("USB incoming transfer, size:" - << transfer->actual_length << ", data:" - << hex_data(transfer->buffer, transfer->actual_length)); - ::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage( - 0, 0, in_buffer_, transfer->actual_length, false)); - controller_->DataReceiveDone(device_uid_, app_handle_, data); - } else { - SDL_LOG_ERROR("USB incoming transfer failed: " - << libusb_error_name(transfer->status)); - controller_->DataReceiveFailed( - device_uid_, app_handle_, DataReceiveError()); + switch (transfer->status) { + case LIBUSB_TRANSFER_COMPLETED: { + SDL_LOG_DEBUG("USB incoming transfer, size:" + << transfer->actual_length << ", data:" + << hex_data(transfer->buffer, transfer->actual_length)); + ::protocol_handler::RawMessagePtr data(new protocol_handler::RawMessage( + 0, 0, in_buffer_, transfer->actual_length, false)); + controller_->DataReceiveDone(device_uid_, app_handle_, data); + break; + } + + case LIBUSB_TRANSFER_CANCELLED: { + SDL_LOG_DEBUG("Free already canceled transfer."); + break; + } + + default: { + SDL_LOG_ERROR("USB incoming transfer failed: " + << libusb_error_name(transfer->status)); + controller_->DataReceiveFailed( + device_uid_, app_handle_, DataReceiveError()); + } } - if (disconnecting_) { + + if (waiting_in_transfer_cancel_) { + libusb_free_transfer(in_transfer_); + in_transfer_ = nullptr; waiting_in_transfer_cancel_ = false; - } else { - if (!PostInTransfer()) { - SDL_LOG_ERROR("USB incoming transfer failed with " - << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection."); - AbortConnection(); - } + } else if (!PostInTransfer()) { + SDL_LOG_ERROR("USB incoming transfer failed with " + << "LIBUSB_TRANSFER_NO_DEVICE. Abort connection."); + AbortConnection(); } + SDL_LOG_TRACE("exit"); } @@ -208,44 +218,48 @@ TransportAdapter::Error UsbConnection::PostOutTransfer() { void UsbConnection::OnOutTransfer(libusb_transfer* transfer) { SDL_LOG_AUTO_TRACE(); - if (transfer->status == LIBUSB_TRANSFER_CANCELLED) { - SDL_LOG_DEBUG("Free already canceled transfer."); - libusb_free_transfer(transfer); - return; - } - SDL_LOG_TRACE("enter with Libusb_transfer*: " << transfer); auto error_code = TransportAdapter::OK; { sync_primitives::AutoLock locker(out_messages_mutex_); - if (LIBUSB_TRANSFER_COMPLETED == transfer->status) { - bytes_sent_ += transfer->actual_length; - if (current_out_message_->data_size() == bytes_sent_) { - SDL_LOG_DEBUG( - "USB out transfer, data sent: " << current_out_message_.get()); - controller_->DataSendDone( - device_uid_, app_handle_, current_out_message_); + switch (transfer->status) { + case LIBUSB_TRANSFER_COMPLETED: { + bytes_sent_ += transfer->actual_length; + if (current_out_message_->data_size() == bytes_sent_) { + SDL_LOG_DEBUG( + "USB out transfer, data sent: " << current_out_message_.get()); + controller_->DataSendDone( + device_uid_, app_handle_, current_out_message_); + error_code = PopOutMessage(); + } + break; + } + + case LIBUSB_TRANSFER_CANCELLED: { + SDL_LOG_DEBUG("Free already canceled transfer."); + break; + } + + default: { + SDL_LOG_ERROR( + "USB out transfer failed: " << libusb_error_name(transfer->status)); + controller_->DataSendFailed( + device_uid_, app_handle_, current_out_message_, DataSendError()); error_code = PopOutMessage(); } - } else { - SDL_LOG_ERROR( - "USB out transfer failed: " << libusb_error_name(transfer->status)); - controller_->DataSendFailed( - device_uid_, app_handle_, current_out_message_, DataSendError()); - error_code = PopOutMessage(); } - if (current_out_message_.use_count() == 0) { + + if (waiting_out_transfer_cancel_ || current_out_message_.use_count() == 0) { libusb_free_transfer(transfer); out_transfer_ = nullptr; waiting_out_transfer_cancel_ = false; + return; } } if (TransportAdapter::FAIL == error_code) { AbortConnection(); } - - SDL_LOG_TRACE("exit"); } TransportAdapter::Error UsbConnection::SendData( -- cgit v1.2.1 From a0f004003ec76a92fac941cea37e8014822938c8 Mon Sep 17 00:00:00 2001 From: "Andrii Kalinich (GitHub)" Date: Thu, 21 Oct 2021 10:30:53 -0400 Subject: Fix issues with web app activation (#3799) * Add initial states for pending applications This would prevent crashes for cases when app will be attempted to be activated. * Fix UpdateAppList content * Fix checks in SDL.ActivateApp * Fix unit tests --- .../src/commands/hmi/sdl_activate_app_request.cc | 13 +++++-- .../commands/hmi/sdl_activate_app_request_test.cc | 41 ++-------------------- .../src/application_manager_impl.cc | 26 ++++++++++++++ .../src/message_helper/message_helper.cc | 2 +- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc index 88b3065fb0..e25ee93400 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/sdl_activate_app_request.cc @@ -139,7 +139,7 @@ void SDLActivateAppRequest::Run() { return; } - if (!app->is_cloud_app() || app->IsRegistered()) { + if (app->app_id() > 0 || app->IsRegistered()) { auto main_state = app->CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (mobile_apis::HMILevel::INVALID_ENUM == main_state->hmi_level()) { @@ -173,6 +173,15 @@ void SDLActivateAppRequest::Run() { application_manager_.connection_handler().ConnectToDevice(app->device()); return; } + + connection_handler::DeviceHandle device_handle = app->device(); + SDL_LOG_ERROR( + "Can't find regular foreground app with the same connection id: " + << device_handle); + SendErrorResponse(correlation_id(), + SDL_ActivateApp, + hmi_apis::Common_Result::NO_APPS_REGISTERED, + ""); } #else // EXTERNAL_PROPRIETARY_MODE @@ -216,7 +225,7 @@ void SDLActivateAppRequest::Run() { return; } - if (!app_to_activate->is_cloud_app() || app_to_activate->IsRegistered()) { + if (app_to_activate->app_id() > 0 || app_to_activate->IsRegistered()) { auto main_state = app_to_activate->CurrentHmiState( mobile_apis::PredefinedWindows::DEFAULT_WINDOW); if (mobile_apis::HMILevel::INVALID_ENUM == main_state->hmi_level()) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index 44bd7f4a80..b110d4bf9e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -157,6 +157,7 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) { CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) .WillOnce(Return(state)); + EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppID)); EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(true)); EXPECT_CALL(mock_policy_handler_, OnActivateApp(kAppID, kCorrelationID)); @@ -204,12 +205,6 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); - am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); - state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); - EXPECT_CALL(*mock_app, - CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillOnce(Return(state)); - ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false)); ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false)); ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle)); @@ -272,12 +267,6 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); - am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); - state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); - EXPECT_CALL(*mock_app, - CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillOnce(Return(state)); - ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false)); ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false)); ON_CALL(*mock_app, device()).WillByDefault(Return(kHandle)); @@ -305,12 +294,6 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) { .WillOnce(Return(false)); EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); - am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); - state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); - EXPECT_CALL(*mock_app, - CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillOnce(Return(state)); - DataAccessor accessor(app_list_, lock_); EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor)); @@ -348,14 +331,14 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotActiveNONE_SUCCESS) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); + ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(true)); + am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); EXPECT_CALL(*mock_app, CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) .WillOnce(Return(state)); - EXPECT_CALL(*mock_app, IsRegistered()).WillOnce(Return(true)); - EXPECT_CALL(mock_policy_handler_, OnActivateApp(kAppID, kCorrelationID)); command->Run(); @@ -377,12 +360,6 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) { ON_CALL(app_mngr_, application(kAppID)).WillByDefault(Return(mock_app)); - am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); - state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); - EXPECT_CALL(*mock_app, - CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillOnce(Return(state)); - EXPECT_CALL(*mock_app, device()).WillOnce(Return(kHandle)); ON_CALL(*mock_app, IsRegistered()).WillByDefault(Return(false)); ON_CALL(*mock_app, is_cloud_app()).WillByDefault(Return(false)); @@ -425,12 +402,6 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); - am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); - state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); - EXPECT_CALL(*mock_app, - CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillOnce(Return(state)); - MockAppPtr mock_app_first(CreateMockApp()); ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle)); ON_CALL(*mock_app_first, is_foreground()).WillByDefault(Return(false)); @@ -464,12 +435,6 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) { IsStateActive(am::HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) .WillOnce(Return(false)); - am::HmiStatePtr state = std::make_shared(mock_app, app_mngr_); - state->set_hmi_level(mobile_apis::HMILevel::HMI_NONE); - EXPECT_CALL(*mock_app, - CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) - .WillOnce(Return(state)); - DataAccessor accessor(app_list_, lock_); EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor)); diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 8d2875364d..7a5d5fc0dc 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1200,6 +1200,19 @@ void ApplicationManagerImpl::CreatePendingApplication( application->set_hybrid_app_preference(hybrid_app_preference_enum); application->set_cloud_app_certificate(app_properties.certificate); + HmiStatePtr initial_state = + CreateRegularState(application, + mobile_apis::WindowType::MAIN, + mobile_apis::HMILevel::INVALID_ENUM, + mobile_apis::AudioStreamingState::INVALID_ENUM, + mobile_apis::VideoStreamingState::INVALID_ENUM, + mobile_api::SystemContext::SYSCTXT_MAIN); + + application->SetInitialState( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + std::string(), // should not be tracked for main window + initial_state); + { sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); SDL_LOG_DEBUG( @@ -1284,6 +1297,19 @@ void ApplicationManagerImpl::CreatePendingLocalApplication( application->set_hybrid_app_preference(hybrid_app_preference_enum); application->set_cloud_app_certificate(app_properties.certificate); + HmiStatePtr initial_state = + CreateRegularState(application, + mobile_apis::WindowType::MAIN, + mobile_apis::HMILevel::INVALID_ENUM, + mobile_apis::AudioStreamingState::INVALID_ENUM, + mobile_apis::VideoStreamingState::INVALID_ENUM, + mobile_api::SystemContext::SYSCTXT_MAIN); + + application->SetInitialState( + mobile_apis::PredefinedWindows::DEFAULT_WINDOW, + std::string(), // should not be tracked for main window + initial_state); + sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_); apps_to_register_.insert(application); SDL_LOG_DEBUG("Insert " << application->name().c_str() diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 94d0a75c7f..bbe6189bc9 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -1848,7 +1848,7 @@ bool MessageHelper::CreateHMIApplicationStruct( if (file_system::FileExists(app->app_icon_path())) { message[strings::icon] = icon_path; } - if (!app->is_cloud_app() || app->IsRegistered()) { + if (app->app_id() > 0 || app->IsRegistered()) { message[strings::hmi_display_language_desired] = app->ui_language(); message[strings::is_media_application] = app->is_media_application(); } else { -- cgit v1.2.1 From 0907428858f2eeadc9707d4192971cf555a7785c Mon Sep 17 00:00:00 2001 From: JackLivio Date: Wed, 27 Oct 2021 10:05:41 -0400 Subject: Update rpc spec commit --- tools/rpc_spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rpc_spec b/tools/rpc_spec index 12c2d1dacc..6537500b45 160000 --- a/tools/rpc_spec +++ b/tools/rpc_spec @@ -1 +1 @@ -Subproject commit 12c2d1dacc4315be22bbc1f5e655f4464d9fae44 +Subproject commit 6537500b45f65e02d884da9d73d6820ba7b0b1f5 -- cgit v1.2.1