summaryrefslogtreecommitdiff
path: root/src/components/application_manager/test/mock/include/application_manager
diff options
context:
space:
mode:
authorJustin Dickow <jjdickow@gmail.com>2014-10-27 16:59:35 -0400
committerJustin Dickow <jjdickow@gmail.com>2014-10-27 16:59:35 -0400
commit1ad35342dfe2f92bc1deb734de504177596fc8d6 (patch)
treeb655799ef580fae979e1e66bf3b82dfdd3d42f45 /src/components/application_manager/test/mock/include/application_manager
parent9da0cfe821c3c9252a543e1e4a344867de9dceee (diff)
downloadsdl_core-1ad35342dfe2f92bc1deb734de504177596fc8d6.tar.gz
3.10.1
Signed-off-by: Justin Dickow <jjdickow@gmail.com>
Diffstat (limited to 'src/components/application_manager/test/mock/include/application_manager')
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/application.h11
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/application_impl.h11
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h11
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/commands/command.h18
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h17
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h18
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h77
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/message_helper.h6
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h6
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h43
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h2
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/request_controller.h20
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/request_info.h120
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h1
14 files changed, 276 insertions, 85 deletions
diff --git a/src/components/application_manager/test/mock/include/application_manager/application.h b/src/components/application_manager/test/mock/include/application_manager/application.h
index 636b0aaa41..5f1f598851 100644
--- a/src/components/application_manager/test/mock/include/application_manager/application.h
+++ b/src/components/application_manager/test/mock/include/application_manager/application.h
@@ -393,7 +393,6 @@ class Application : public virtual InitialApplicationData,
virtual bool MakeFullscreen() = 0;
virtual bool IsAudible() const = 0;
virtual void MakeNotAudible() = 0;
-
virtual bool allowed_support_navigation() const = 0;
virtual void set_allowed_support_navigation(bool allow) = 0;
virtual bool hmi_supports_navi_video_streaming() const = 0;
@@ -401,6 +400,9 @@ class Application : public virtual InitialApplicationData,
virtual bool hmi_supports_navi_audio_streaming() const = 0;
virtual void set_hmi_supports_navi_audio_streaming(bool supports) = 0;
+ virtual bool is_voice_communication_supported() const = 0;
+ virtual void set_voice_communication_supported(
+ bool is_voice_communication_supported) = 0;
virtual bool app_allowed() const = 0;
virtual bool has_been_activated() const = 0;
@@ -530,6 +532,13 @@ class Application : public virtual InitialApplicationData,
*/
virtual void UnsubscribeFromSoftButtons(int32_t cmd_id) = 0;
+ /**
+ * @brief Check's if it is media, voice communication or navigation application
+ *
+ * @return true if application is media, voice communication or navigation
+ */
+ virtual bool IsAudioApplication() const = 0;
+
protected:
// interfaces for NAVI retry sequence
diff --git a/src/components/application_manager/test/mock/include/application_manager/application_impl.h b/src/components/application_manager/test/mock/include/application_manager/application_impl.h
index 0a056df92b..dadfce0929 100644
--- a/src/components/application_manager/test/mock/include/application_manager/application_impl.h
+++ b/src/components/application_manager/test/mock/include/application_manager/application_impl.h
@@ -82,6 +82,9 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
bool hmi_supports_navi_audio_streaming() const;
void set_hmi_supports_navi_audio_streaming(bool supports);
+ virtual bool is_voice_communication_supported() const;
+ virtual void set_voice_communication_supported(
+ bool is_voice_communication_supported);
inline bool app_allowed() const;
bool has_been_activated() const;
@@ -166,6 +169,13 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
virtual void UnsubscribeFromSoftButtons(int32_t cmd_id);
+ /**
+ * @brief Check's if it is media, voice communication or navigation application
+ *
+ * @return true if application is media, voice communication or navigation
+ */
+ virtual bool IsAudioApplication() const;
+
protected:
/**
@@ -220,6 +230,7 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
std::set<uint32_t> subscribed_vehicle_info_;
UsageStatistics usage_report_;
ProtocolVersion protocol_version_;
+ bool is_voice_communication_application_;
// NAVI retry stream
volatile bool is_video_stream_retry_active_;
diff --git a/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h b/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h
index dbee738564..85048477a5 100644
--- a/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h
@@ -156,8 +156,8 @@ class ApplicationManagerImpl : public ApplicationManager,
MOCK_METHOD0(Stop, bool());
MOCK_METHOD1(OnMessageReceived, void (utils::SharedPtr<application_manager::Message>));
MOCK_METHOD1(OnErrorSending, void (utils::SharedPtr<application_manager::Message>));
- MOCK_METHOD1(OnMessageReceived, void (const RawMessagePtr));
- MOCK_METHOD1(OnMobileMessageSent, void (const RawMessagePtr));
+ MOCK_METHOD1(OnMessageReceived, void (const ::protocol_handler::RawMessagePtr));
+ MOCK_METHOD1(OnMobileMessageSent, void (const ::protocol_handler::RawMessagePtr));
MOCK_METHOD1(OnDeviceListUpdated, void (const connection_handler::DeviceMap&));
MOCK_METHOD0(OnFindNewApplicationsRequest, void ());
MOCK_METHOD1(RemoveDevice, void (const connection_handler::DeviceHandle&));
@@ -196,7 +196,6 @@ class ApplicationManagerImpl : public ApplicationManager,
MOCK_METHOD0(HeadUnitSuspend, void());
MOCK_METHOD1(LoadAppDataToHMI, bool(ApplicationSharedPtr));
MOCK_METHOD1(ActivateApplication, bool (ApplicationSharedPtr));
- MOCK_METHOD1(PutApplicationInLimited, mobile_api::HMILevel::eType (ApplicationSharedPtr));
MOCK_METHOD1(PutApplicationInFull, mobile_api::HMILevel::eType (ApplicationSharedPtr));
MOCK_METHOD2(UnregisterRevokedApplication, void(uint32_t, mobile_apis::Result::eType));
MOCK_METHOD1(SetUnregisterAllApplicationsReason, void(mobile_api::AppInterfaceUnregisteredReason::eType));
@@ -251,6 +250,8 @@ class ApplicationManagerImpl : public ApplicationManager,
MOCK_METHOD0(GetNextHMICorrelationID, uint32_t ());
MOCK_CONST_METHOD0(IsHMICooperating, bool());
MOCK_METHOD0(OnTimerSendTTSGlobalProperties, void());
+ MOCK_METHOD0(CreatePhoneCallAppList, void());
+ MOCK_METHOD0(ResetPhoneCallAppList, void());
MOCK_METHOD1(AddAppToTTSGlobalPropertiesList, void(const uint32_t));
MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList, void(const uint32_t));
MOCK_METHOD1(application_by_hmi_app, ApplicationSharedPtr(uint32_t));
@@ -259,6 +260,10 @@ class ApplicationManagerImpl : public ApplicationManager,
bool));
MOCK_METHOD4(UnregisterApplication, void(const uint32_t,mobile_apis::Result::eType,
bool, bool));
+ MOCK_CONST_METHOD0(get_limited_media_application, ApplicationSharedPtr());
+ MOCK_CONST_METHOD0(get_limited_navi_application, ApplicationSharedPtr());
+ MOCK_CONST_METHOD0(get_limited_voice_application, ApplicationSharedPtr());
+ MOCK_CONST_METHOD1(DoesAudioAppWithSameHMITypeExistInFullOrLimited, bool(ApplicationSharedPtr));
MOCK_CONST_METHOD0(active_application, ApplicationSharedPtr ());
MOCK_METHOD0(OnApplicationListUpdateTimer, void());
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command.h b/src/components/application_manager/test/mock/include/application_manager/commands/command.h
index 28c77b6229..587c3d834c 100644
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command.h
+++ b/src/components/application_manager/test/mock/include/application_manager/commands/command.h
@@ -90,6 +90,24 @@ class Command {
* @brief Retrieves correlation ID
*/
virtual uint32_t correlation_id() const = 0;
+
+ /*
+ * @brief Retrieves connection_key
+ */
+ virtual uint32_t connection_key() const = 0;
+
+ /*
+ * @brief Retrieves request ID
+ */
+ virtual int32_t function_id() const = 0;
+
+ /*
+ * @brief Function is called by RequestController when request execution time
+ * has exceed it's limit
+ *
+ */
+ virtual void onTimeOut() = 0;
+
};
} // namespace commands
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h
index 06637d7d84..a34716bd62 100644
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h
+++ b/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h
@@ -101,6 +101,23 @@ class CommandImpl : public Command {
*/
virtual uint32_t correlation_id() const;
+ /*
+ * @brief Retrieves connection key
+ */
+ virtual uint32_t connection_key() const;
+
+ /*
+ * @brief Retrieves request ID
+ */
+ virtual int32_t function_id() const;
+
+ /*
+ * @brief Function is called by RequestController when request execution time
+ * has exceed it's limit
+ *
+ */
+ virtual void onTimeOut();
+
// members
static const int32_t hmi_protocol_type_;
static const int32_t mobile_protocol_type_;
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h
index fb14078961..1bbba5aa0b 100644
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h
+++ b/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h
@@ -81,16 +81,6 @@ class CommandRequestImpl : public CommandImpl,
virtual void on_event(const event_engine::Event& event);
/*
- * @brief Retrieves request ID
- */
- inline int32_t function_id() const;
-
- /*
- * @brief Retrieves connection key
- */
- inline uint32_t connection_key() const;
-
- /*
* @brief Creates Mobile response
*
* @param success true if successful; false, if failed
@@ -194,14 +184,6 @@ protected:
void AddDisallowedParametersToInfo(smart_objects::SmartObject& response) const;
};
-int32_t CommandRequestImpl::function_id() const {
- return (*message_)[strings::params][strings::function_id].asInt();
-}
-
-uint32_t CommandRequestImpl::connection_key() const {
- return (*message_)[strings::params][strings::connection_key].asUInt();
-}
-
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h
new file mode 100644
index 0000000000..45d831eb03
--- /dev/null
+++ b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h
@@ -0,0 +1,77 @@
+/*
+ * 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_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_
+
+#include "application_manager/commands/hmi/notification_from_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+namespace hmi {
+
+
+/**
+ * @brief OnPhoneCallNotification command class
+ **/
+class OnPhoneCallNotification : public NotificationFromHMI {
+ public:
+ /**
+ * @brief OnPhoneCallNotification class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ explicit OnPhoneCallNotification(const MessageSharedPtr& message);
+
+ /**
+ * @brief OnPhoneCallNotification class destructor
+ **/
+ virtual ~OnPhoneCallNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnPhoneCallNotification);
+};
+
+} // namespace hmi
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_
diff --git a/src/components/application_manager/test/mock/include/application_manager/message_helper.h b/src/components/application_manager/test/mock/include/application_manager/message_helper.h
index e7a7631d69..69c7b7bba7 100644
--- a/src/components/application_manager/test/mock/include/application_manager/message_helper.h
+++ b/src/components/application_manager/test/mock/include/application_manager/message_helper.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -92,7 +92,9 @@ class MessageHelper {
*
**/
static void SendOnAppRegisteredNotificationToHMI(
- const Application& application_impl, bool resumption = false);
+ const Application& application_impl,
+ bool resumption = false,
+ bool need_restore_vr = false);
/**
* @brief Create mobile HashUpdateNotification
diff --git a/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h b/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h
index c84ba54212..67d51c0dab 100644
--- a/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h
+++ b/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -42,10 +42,10 @@ typedef utils::SharedPtr<application_manager::Message> MobileMessage;
class MobileMessageHandler {
public:
static application_manager::Message* HandleIncomingMessageProtocolV1(
- const RawMessagePtr message);
+ const protocol_handler::RawMessagePtr message);
static application_manager::Message* HandleIncomingMessageProtocolV2(
- const RawMessagePtr message);
+ const protocol_handler::RawMessagePtr message);
//! -------------------------------------------------------------
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h b/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h
index 5bc23c106a..dfc29fe00a 100644
--- a/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h
@@ -303,6 +303,18 @@ class PolicyHandler :
*/
uint16_t HeartBeatTimeout(const std::string& app_id) const;
+//TODO(AKutsan) REMOVE THIS UGLY HOTFIX
+ virtual void Increment(usage_statistics::GlobalCounterId type);
+ virtual void Increment(const std::string& app_id,
+ usage_statistics::AppCounterId type);
+ virtual void Set(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value);
+ virtual void Add(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int32_t timespan_seconds);
+
+
protected:
/**
@@ -338,6 +350,33 @@ protected:
const std::string ConvertUpdateStatus(policy::PolicyTableStatus status);
private:
+
+ class StatisticManagerImpl: public usage_statistics::StatisticsManager {
+ //TODO(AKutsan) REMOVE THIS UGLY HOTFIX
+ virtual void Increment(usage_statistics::GlobalCounterId type) {
+ return PolicyHandler::instance()->Increment(type);
+ }
+
+ virtual void Increment(const std::string& app_id,
+ usage_statistics::AppCounterId type) {
+ return PolicyHandler::instance()->Increment(app_id, type);
+ }
+
+ virtual void Set(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value) {
+ return PolicyHandler::instance()->Set(app_id, type, value);
+ }
+
+ virtual void Add(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int32_t timespan_seconds) {
+ return PolicyHandler::instance()->Add(app_id, type, timespan_seconds);
+ }
+ };
+ //TODO(AKutsan) REMOVE THIS UGLY HOTFIX
+
+
PolicyHandler();
static PolicyHandler* instance_;
static const std::string kLibrary;
@@ -365,6 +404,10 @@ private:
*/
std::map<std::string, std::string> app_to_device_link_;
+
+ utils::SharedPtr<StatisticManagerImpl> statistic_manager_impl_;
+
+
DISALLOW_COPY_AND_ASSIGN(PolicyHandler);
FRIEND_BASE_SINGLETON_CLASS_WITH_DELETER(PolicyHandler,
utils::deleters::Deleter<PolicyHandler>);
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h b/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h
index e1e67b1505..29c74aa96e 100644
--- a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h
+++ b/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h
@@ -50,7 +50,7 @@ class PTExchangeHandlerImpl : public PTExchangeHandler {
protected:
PolicyHandler* policy_handler_;
- threads::Thread retry_sequence_;
+ threads::Thread* retry_sequence_;
sync_primitives::Lock retry_sequence_lock_;
friend class RetrySequence;
diff --git a/src/components/application_manager/test/mock/include/application_manager/request_controller.h b/src/components/application_manager/test/mock/include/application_manager/request_controller.h
index b70608fbc2..2bc5f54666 100644
--- a/src/components/application_manager/test/mock/include/application_manager/request_controller.h
+++ b/src/components/application_manager/test/mock/include/application_manager/request_controller.h
@@ -131,7 +131,7 @@ class RequestController {
* @return Result code
*
*/
- TResult addHMIRequest(const RequestPtr& request);
+ TResult addHMIRequest(const RequestPtr request);
/**
* @ Add notification to collection
@@ -182,7 +182,7 @@ class RequestController {
*
* @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
+ * @param new_timeout_value New timeout to be set in milliseconds
*/
void updateRequestTimeout(const uint32_t& app_id,
const uint32_t& mobile_correlation_id,
@@ -196,7 +196,9 @@ class RequestController {
* @param app_time_scale - time scale (seconds)
* @param max_request_per_time_scale - maximum count of request that should be allowed for app_time_scale secconds
*/
- bool checkTimeScaleMaxRequest(const uint32_t& app_id, const uint32_t& app_time_scale, const uint32_t& max_request_per_time_scale);
+ bool checkTimeScaleMaxRequest(const uint32_t& app_id,
+ const uint32_t& app_time_scale,
+ const uint32_t& max_request_per_time_scale);
/**
* @brief Checs if this app as able to add new requests in current hmi_level, or limits was exceeded
@@ -205,7 +207,10 @@ class RequestController {
* @param app_time_scale - time scale (seconds)
* @param max_request_per_time_scale - maximum count of request that should be allowed for app_time_scale secconds
*/
- bool checkHMILevelTimeScaleMaxRequest(const mobile_apis::HMILevel::eType& hmi_level, const uint32_t& app_id, const uint32_t& app_time_scale, const uint32_t& max_request_per_time_scale);
+ bool checkHMILevelTimeScaleMaxRequest(const mobile_apis::HMILevel::eType& hmi_level,
+ const uint32_t& app_id,
+ const uint32_t& app_time_scale,
+ const uint32_t& max_request_per_time_scale);
void onTimer();
@@ -232,12 +237,7 @@ class RequestController {
volatile bool stop_flag_;
};
- /**
- * @brief Typedef for thread shared pointer
- */
- typedef utils::SharedPtr<Thread> ThreadSharedPtr;
-
- std::vector<ThreadSharedPtr> pool_;
+ std::vector<Thread*> pool_;
volatile TPoolState pool_state_;
uint32_t pool_size_;
sync_primitives::ConditionalVariable cond_var_;
diff --git a/src/components/application_manager/test/mock/include/application_manager/request_info.h b/src/components/application_manager/test/mock/include/application_manager/request_info.h
index 778e72c916..b1409488fd 100644
--- a/src/components/application_manager/test/mock/include/application_manager/request_info.h
+++ b/src/components/application_manager/test/mock/include/application_manager/request_info.h
@@ -1,4 +1,4 @@
-/**
+/**
* \file request_info.h
* \brief request information structure header file.
*
@@ -55,26 +55,30 @@ namespace request_controller {
typedef utils::SharedPtr<commands::CommandRequestImpl> MobileRequestPtr;
struct RequestInfo {
- RequestInfo(const uint64_t timeout_sec):
- timeout_sec_(timeout_sec) {
+ RequestInfo(const uint64_t timeout_sec)
+ : timeout_sec_(timeout_sec) {
start_time_ = date_time::DateTime::getCurrentTime();
updateEndTime();
}
- RequestInfo(const TimevalStruct& start_time,const uint64_t timeout_sec):
- start_time_(start_time),
+ RequestInfo(const TimevalStruct& start_time,const uint64_t timeout_sec)
+ : start_time_(start_time),
timeout_sec_(timeout_sec) {
updateEndTime();
- }
+ }
- virtual ~RequestInfo(){}
+ virtual ~RequestInfo(){}
- virtual uint32_t requestId() = 0;
- virtual commands::Command* request() = 0;
+ virtual uint32_t requestId() = 0;
+ virtual commands::Command* request() = 0;
void updateEndTime() {
end_time_ = date_time::DateTime::getCurrentTime();
end_time_.tv_sec += timeout_sec_;
+
+ // possible delay during IPC
+ const uint32_t hmi_delay_sec = 1;
+ end_time_.tv_sec += hmi_delay_sec;
}
void updateTimeOut(const uint64_t& timeout_sec) {
@@ -89,9 +93,11 @@ namespace request_controller {
}
return true;
}
+
TimevalStruct start_time() {
return start_time_;
}
+
uint64_t timeout_sec() {
return timeout_sec_;
}
@@ -100,42 +106,62 @@ namespace request_controller {
return end_time_;
}
+ uint32_t app_id() {
+ return app_id_;
+ }
+
+ mobile_apis::HMILevel::eType hmi_level() {
+ return hmi_level_;
+ }
+
protected:
- TimevalStruct start_time_;
- uint64_t timeout_sec_;
- TimevalStruct end_time_;
+ TimevalStruct start_time_;
+ uint64_t timeout_sec_;
+ TimevalStruct end_time_;
+ uint32_t app_id_;
+ mobile_apis::HMILevel::eType hmi_level_;
};
typedef utils::SharedPtr<RequestInfo> RequestInfoPtr;
struct RequestInfoComparator {
- bool operator() (const RequestInfoPtr lhs, const RequestInfoPtr rhs) const {
- date_time::TimeCompare compare_result = date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time());
- return compare_result == date_time::LESS;
+ bool operator() (const RequestInfoPtr lhs,
+ const RequestInfoPtr rhs) const {
+ date_time::TimeCompare compare_result =
+ date_time::DateTime::compareTime(lhs->end_time(), rhs->end_time());
+
+ return compare_result == date_time::LESS;
}
};
typedef std::set<RequestInfoPtr,RequestInfoComparator> RequestInfoSet;
struct HMIRequestInfo: public RequestInfo {
- HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec);
- HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time,const uint64_t timeout_sec);
+ HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec);
+ HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time,
+ const uint64_t timeout_sec);
+
RequestPtr request_;
uint32_t correlation_id_;
+
virtual uint32_t requestId() {
return correlation_id_;
}
+
virtual commands::Command* request() {
return request_.get();
}
};
struct MobileRequestInfo: public RequestInfo {
- MobileRequestInfo(MobileRequestPtr request, const uint64_t timeout_sec);
- MobileRequestInfo(MobileRequestPtr request, const TimevalStruct& start_time, const uint64_t timeout_sec);
- MobileRequestPtr request_;
- uint32_t app_id_;
- mobile_apis::HMILevel::eType hmi_level_;
+ MobileRequestInfo(RequestPtr request,
+ const uint64_t timeout_sec);
+
+ MobileRequestInfo(RequestPtr request,
+ const TimevalStruct& start_time,
+ const uint64_t timeout_sec);
+
+ RequestPtr request_;
uint32_t mobile_correlation_id_;
virtual uint32_t requestId() {
@@ -152,27 +178,26 @@ namespace request_controller {
* during time scale
*/
struct TimeScale {
- explicit TimeScale(const TimevalStruct& start, const TimevalStruct& end,
- const int32_t& app_id)
+ TimeScale(const TimevalStruct& start,
+ const TimevalStruct& end,
+ const uint32_t& app_id)
: start_(start),
end_(end),
app_id_(app_id) {}
bool operator()(RequestInfoPtr setEntry) {
- MobileRequestInfo* mobile_request_info = NULL;
- RequestInfo* request = setEntry.get();
- mobile_request_info = dynamic_cast<MobileRequestInfo*>(request);
- if (NULL == mobile_request_info) {
+
+ if (!setEntry.valid()) {
return false;
}
- if (mobile_request_info->app_id_ != app_id_) {
+ if (setEntry->app_id() != app_id_) {
return false;
}
- if (date_time::DateTime::getmSecs(mobile_request_info->start_time())
+ if (date_time::DateTime::getmSecs(setEntry->start_time())
< date_time::DateTime::getmSecs(start_) ||
- date_time::DateTime::getmSecs(mobile_request_info->start_time())
+ date_time::DateTime::getmSecs(setEntry->start_time())
> date_time::DateTime::getmSecs(end_)) {
return false;
}
@@ -181,9 +206,9 @@ namespace request_controller {
}
private:
- TimevalStruct start_;
- TimevalStruct end_;
- uint32_t app_id_;
+ TimevalStruct start_;
+ TimevalStruct end_;
+ uint32_t app_id_;
};
/**
@@ -191,30 +216,31 @@ namespace request_controller {
* during time scale for application in defined hmi level
*/
struct HMILevelTimeScale {
- explicit HMILevelTimeScale(
- const TimevalStruct& start, const TimevalStruct& end,
- const uint32_t& app_id, const mobile_apis::HMILevel::eType& hmi_level)
+ HMILevelTimeScale(const TimevalStruct& start,
+ const TimevalStruct& end,
+ const uint32_t& app_id,
+ const mobile_apis::HMILevel::eType& hmi_level)
: start_(start),
end_(end),
app_id_(app_id),
hmi_level_(hmi_level) {}
bool operator()(RequestInfoPtr setEntry) {
- MobileRequestInfo* mobile_request_info = NULL;
- mobile_request_info = dynamic_cast<MobileRequestInfo*>(setEntry.get());
- if (NULL == mobile_request_info) {
+ if (!setEntry.valid()) {
return false;
}
- if (mobile_request_info->app_id_ != app_id_) {
+
+ if (setEntry->app_id() != app_id_) {
return false;
}
- if (mobile_request_info->hmi_level_ != hmi_level_) {
+
+ if (setEntry->hmi_level() != hmi_level_) {
return false;
}
- if (date_time::DateTime::getSecs(mobile_request_info->start_time())
+ if (date_time::DateTime::getSecs(setEntry->start_time())
< date_time::DateTime::getSecs(start_) ||
- date_time::DateTime::getSecs(mobile_request_info->start_time())
+ date_time::DateTime::getSecs(setEntry->start_time())
> date_time::DateTime::getSecs(end_)) {
return false;
}
@@ -222,9 +248,9 @@ namespace request_controller {
return true;
}
private:
- TimevalStruct start_;
- TimevalStruct end_;
- uint32_t app_id_;
+ TimevalStruct start_;
+ TimevalStruct end_;
+ uint32_t app_id_;
mobile_apis::HMILevel::eType hmi_level_;
};
diff --git a/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h b/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h
index 1df8b21ad9..3d03989874 100644
--- a/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h
@@ -361,6 +361,7 @@ const char result[] = "result";
const char statistic_type[] = "statisticType";
const char error[] = "error";
const char policyfile[] = "policyfile";
+const char is_active[] = "isActive";
} // namespace hmi_notification