summaryrefslogtreecommitdiff
path: root/src/components/include
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2018-03-07 10:05:23 -0500
committerGitHub <noreply@github.com>2018-03-07 10:05:23 -0500
commitc8793c6520426155b3e20c2678ce66bf078f72ef (patch)
tree3951f52a1a4b39ef8572da8817fb199a8cf2d8d9 /src/components/include
parent1f574a2061bf5b746c6bf3734c647a4a6ba3dfd1 (diff)
parent95aec12cbd07087af530413e574415056e45e067 (diff)
downloadsdl_core-c8793c6520426155b3e20c2678ce66bf078f72ef.tar.gz
Merge branch 'develop' into hotfix/add_FAQ_to_READMEhotfix/add_FAQ_to_README
Diffstat (limited to 'src/components/include')
-rw-r--r--src/components/include/application_manager/application_manager.h720
-rw-r--r--src/components/include/application_manager/application_manager_settings.h4
-rw-r--r--src/components/include/application_manager/hmi_capabilities.h98
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h195
-rw-r--r--src/components/include/application_manager/policies/policy_handler_observer.h57
-rw-r--r--src/components/include/application_manager/request_controller_settings.h6
-rw-r--r--src/components/include/connection_handler/connection_handler.h243
-rw-r--r--src/components/include/connection_handler/connection_handler_observer.h168
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_adapter.h66
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_handler.h63
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_handler_settings.h2
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_observer.h54
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_sender.h48
-rw-r--r--src/components/include/media_manager/media_manager.h68
-rw-r--r--src/components/include/policy/policy_external/policy/policy_listener.h180
-rw-r--r--src/components/include/policy/policy_external/policy/policy_manager.h655
-rw-r--r--src/components/include/policy/policy_external/policy/policy_settings.h (renamed from src/components/include/policy/policy_settings.h)6
-rw-r--r--src/components/include/policy/policy_external/policy/usage_statistics/app_stopwatch.h50
-rw-r--r--src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h111
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_listener.h155
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_manager.h610
-rw-r--r--src/components/include/policy/policy_regular/policy/policy_settings.h42
-rw-r--r--src/components/include/policy/policy_regular/policy/usage_statistics/app_stopwatch.h50
-rw-r--r--src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h (renamed from src/components/include/policy/usage_statistics/statistics_manager.h)42
-rw-r--r--src/components/include/policy/policy_types.h318
-rw-r--r--src/components/include/protocol/bson_object_keys.h48
-rw-r--r--src/components/include/protocol/common.h11
-rw-r--r--src/components/include/protocol_handler/protocol_handler.h35
-rw-r--r--src/components/include/protocol_handler/protocol_handler_settings.h13
-rw-r--r--src/components/include/protocol_handler/session_observer.h133
-rw-r--r--src/components/include/protocol_handler/telemetry_observer.h57
-rw-r--r--src/components/include/rpc_base/validation_report.h125
-rw-r--r--src/components/include/security_manager/security_manager.h18
-rw-r--r--src/components/include/security_manager/security_manager_listener.h11
-rw-r--r--src/components/include/security_manager/security_manager_settings.h6
-rw-r--r--src/components/include/security_manager/security_query.h6
-rw-r--r--src/components/include/telemetry_monitor/telemetry_observable.h6
-rw-r--r--src/components/include/test/application_manager/mock_app_launch_settings.h1
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h321
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h4
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h99
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_observer.h1
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h11
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler_observer.h81
-rw-r--r--src/components/include/test/hmi_message_handler/mock_hmi_message_adapter.h (renamed from src/components/include/test/telemetry_monitor/mock_telemetry_observer.h)24
-rw-r--r--src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h8
-rw-r--r--src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h58
-rw-r--r--src/components/include/test/hmi_message_handler/mock_hmi_message_sender.h (renamed from src/components/include/test/hmi_message_handler/mock_hmi_message_handler.h)14
-rw-r--r--src/components/include/test/media_manager/mock_media_manager.h66
-rw-r--r--src/components/include/test/media_manager/mock_media_manager_settings.h6
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_cache_manager.h259
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_listener.h111
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_manager.h226
-rw-r--r--src/components/include/test/policy/policy_external/policy/mock_policy_settings.h58
-rw-r--r--src/components/include/test/policy/policy_external/policy/usage_statistics/mock_app_stopwatch.h54
-rw-r--r--src/components/include/test/policy/policy_external/policy/usage_statistics/mock_statistics_manager.h (renamed from src/components/include/test/policy/mock_statistics_manager.h)0
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h223
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h104
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h (renamed from src/components/include/test/policy/mock_policy_manager.h)78
-rw-r--r--src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h (renamed from src/components/include/test/policy/mock_policy_settings.h)0
-rw-r--r--src/components/include/test/policy/policy_regular/policy/usage_statistics/mock_app_stopwatch.h54
-rw-r--r--src/components/include/test/policy/policy_regular/policy/usage_statistics/mock_statistics_manager.h (renamed from src/components/include/test/policy/usage_statistics/mock_statistics_manager.h)0
-rw-r--r--src/components/include/test/policy/usage_statistics/mock_app_stopwatch.h1
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler.h10
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler_settings.h4
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_observer.h57
-rw-r--r--src/components/include/test/protocol_handler/mock_session_observer.h41
-rw-r--r--src/components/include/test/protocol_handler/mock_telemetry_observer.h54
-rw-r--r--src/components/include/test/resumption/mock_last_state.h53
-rw-r--r--src/components/include/test/security_manager/mock_security_manager.h3
-rw-r--r--src/components/include/test/security_manager/mock_security_manager_listener.h1
-rw-r--r--src/components/include/test/telemetry_monitor/mock_telemetry_observable.h6
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_listener.h94
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_mme_settings.h6
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_settings.h8
-rw-r--r--src/components/include/test/transport_manager/transport_adapter/mock_device.h71
-rw-r--r--src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h116
-rw-r--r--src/components/include/test/utils/test_async_waiter.h106
-rw-r--r--src/components/include/transport_manager/common.h10
-rw-r--r--src/components/include/transport_manager/transport_adapter/device.h29
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter.h42
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter_event.h50
-rw-r--r--src/components/include/transport_manager/transport_manager_listener.h17
-rw-r--r--src/components/include/transport_manager/transport_manager_listener_empty.h17
-rw-r--r--src/components/include/transport_manager/transport_manager_settings.h12
-rw-r--r--src/components/include/utils/callable.h26
-rw-r--r--src/components/include/utils/macro.h27
-rw-r--r--src/components/include/utils/memory_barrier.h6
-rw-r--r--src/components/include/utils/scope_guard.h6
-rw-r--r--src/components/include/utils/threads/CMakeLists.txt5
-rw-r--r--src/components/include/utils/threads/async_runner.h6
-rw-r--r--src/components/include/utils/threads/thread.h1
92 files changed, 6748 insertions, 478 deletions
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
new file mode 100644
index 0000000000..eb9159f0b3
--- /dev/null
+++ b/src/components/include/application_manager/application_manager.h
@@ -0,0 +1,720 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
+
+#include <string>
+#include <vector>
+#include <set>
+#include "application_manager/application.h"
+#include "application_manager/hmi_capabilities.h"
+#include "application_manager/commands/command.h"
+#include "connection_handler/connection_handler.h"
+#include "utils/data_accessor.h"
+#include "utils/shared_ptr.h"
+#include "telemetry_monitor/telemetry_observable.h"
+#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/application_manager_settings.h"
+#include "application_manager/state_controller.h"
+#include "application_manager/hmi_interfaces.h"
+#include "policy/policy_types.h"
+#ifdef SDL_REMOTE_CONTROL
+#include "functional_module/plugin_manager.h"
+#endif
+
+namespace resumption {
+class LastState;
+}
+
+namespace app_launch {
+class AppLaunchCtrl;
+} // namespace app_launch
+namespace media_manager {
+class MediaManager;
+}
+
+// Other compomnents class declaration
+namespace hmi_message_handler {
+class HMIMessageHandler;
+}
+namespace protocol_handler {
+class ProtocolHandler;
+}
+namespace connection_handler {
+class ConnectionHandler;
+}
+namespace resumption {
+class ResumeCtrl;
+}
+
+namespace application_manager {
+
+namespace event_engine {
+class EventDispatcher;
+}
+
+class Application;
+class StateControllerImpl;
+struct CommandParametersPermissions;
+using policy::RPCParams;
+typedef std::vector<ApplicationSharedPtr> AppSharedPtrs;
+struct ApplicationsAppIdSorter {
+ bool operator()(const ApplicationSharedPtr lhs,
+ const ApplicationSharedPtr rhs) const {
+ return lhs->app_id() < rhs->app_id();
+ }
+};
+
+struct ApplicationsPolicyAppIdSorter {
+ bool operator()(const ApplicationSharedPtr lhs,
+ const ApplicationSharedPtr rhs) {
+ if (lhs->policy_app_id() == rhs->policy_app_id()) {
+ return lhs->device() < rhs->device();
+ }
+ return lhs->policy_app_id() < rhs->policy_app_id();
+ }
+};
+
+typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplicationSet;
+
+typedef std::set<ApplicationSharedPtr, ApplicationsPolicyAppIdSorter>
+ AppsWaitRegistrationSet;
+
+// typedef for Applications list iterator
+typedef ApplicationSet::iterator ApplicationSetIt;
+
+// typedef for Applications list const iterator
+typedef ApplicationSet::const_iterator ApplicationSetConstIt;
+
+class ApplicationManager {
+ public:
+ virtual ~ApplicationManager() {}
+
+ /**
+ * Inits application manager
+ */
+ virtual bool Init(resumption::LastState& last_state,
+ media_manager::MediaManager* media_manager) = 0;
+
+ /**
+ * @brief Stop work.
+ *
+ * @return TRUE on success otherwise FALSE.
+ **/
+ virtual bool Stop() = 0;
+
+ virtual void set_hmi_message_handler(
+ hmi_message_handler::HMIMessageHandler* handler) = 0;
+ virtual void set_protocol_handler(
+ protocol_handler::ProtocolHandler* handler) = 0;
+ virtual void set_connection_handler(
+ connection_handler::ConnectionHandler* handler) = 0;
+
+ virtual DataAccessor<ApplicationSet> applications() const = 0;
+
+ virtual ApplicationSharedPtr application(uint32_t app_id) const = 0;
+ virtual ApplicationSharedPtr active_application() const = 0;
+
+ /**
+ * Function used only by HMI request/response/notification base classes
+ * to change HMI app id to Mobile app id and vice versa.
+ * Don't use it inside Core
+ */
+ virtual ApplicationSharedPtr application_by_hmi_app(
+ uint32_t hmi_app_id) const = 0;
+
+ virtual ApplicationSharedPtr application_by_policy_id(
+ const std::string& policy_app_id) const = 0;
+
+ virtual AppSharedPtrs applications_by_button(uint32_t button) = 0;
+ virtual AppSharedPtrs applications_with_navi() = 0;
+
+#ifdef SDL_REMOTE_CONTROL
+ /**
+ * @brief application find application by device and policy identifier
+ * @param device_id device id
+ * @param policy_app_id poilcy identifier
+ * @return pointer to application in case if application exist, in other case
+ * return empty shared pointer
+ */
+ virtual ApplicationSharedPtr application(
+ const std::string& device_id, const std::string& policy_app_id) const = 0;
+
+ virtual void ChangeAppsHMILevel(uint32_t app_id,
+ mobile_apis::HMILevel::eType level) = 0;
+
+ virtual std::vector<std::string> devices(
+ const std::string& policy_app_id) const = 0;
+
+ virtual void SendPostMessageToMobile(const MessagePtr& message) = 0;
+
+ virtual void SendPostMessageToHMI(const MessagePtr& message) = 0;
+
+ virtual functional_modules::PluginManager& GetPluginManager() = 0;
+#endif // SDL_REMOTE_CONTROL
+
+ virtual std::vector<ApplicationSharedPtr>
+ applications_with_mobile_projection() = 0;
+ /**
+ * @brief Returns media application with LIMITED HMI Level if exists
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer.
+ */
+ virtual ApplicationSharedPtr get_limited_media_application() const = 0;
+
+ /**
+ * @brief Returns navigation application with LIMITED HMI Level if exists
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer
+ */
+ virtual ApplicationSharedPtr get_limited_navi_application() const = 0;
+
+ /**
+ * @brief Returns voice communication application with
+ * LIMITED HMI Level if exists
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer
+ */
+ virtual ApplicationSharedPtr get_limited_voice_application() const = 0;
+
+ virtual ApplicationSharedPtr get_limited_mobile_projection_application()
+ const = 0;
+
+ /**
+ * @brief Retrieves application id associated with correlation id
+ *
+ * @param correlation_id Correlation ID of the HMI request
+ *
+ * @return application id associated with correlation id
+ */
+ virtual uint32_t application_id(const int32_t correlation_id) = 0;
+
+ /**
+ * @brief Sets application id correlation id
+ *
+ * @param correlation_id Correlation ID of the HMI request
+ * @param app_id Application ID
+ */
+ virtual void set_application_id(const int32_t correlation_id,
+ const uint32_t app_id) = 0;
+
+ /**
+ * @brief OnHMILevelChanged the callback that allows SDL to react when
+ * application's HMI level has been changed.
+ *
+ * @param app_id application identifier for which HMILevel has been chaned.
+ *
+ * @param from previous HMILevel.
+ * @param to current HMILevel.
+ */
+ virtual void OnHMILevelChanged(uint32_t app_id,
+ mobile_apis::HMILevel::eType from,
+ mobile_apis::HMILevel::eType to) = 0;
+
+ /**
+ * @brief Sends HMI status notification to mobile
+ *
+ * @param application_impl application with changed HMI status
+ *
+ **/
+ virtual void SendHMIStatusNotification(
+ const utils::SharedPtr<Application> app) = 0;
+
+ /**
+ * DEPRECATED
+ * @brief Checks if Application is subscribed for way points
+ * @param Application AppID
+ * @return true if Application is subscribed for way points
+ * otherwise false
+ */
+ virtual bool IsAppSubscribedForWayPoints(const uint32_t app_id) const = 0;
+
+ /**
+ * DEPRECATED
+ * @brief Subscribe Application for way points
+ * @param Application AppID
+ */
+ virtual void SubscribeAppForWayPoints(const uint32_t app_id) = 0;
+
+ /**
+ * DEPRECATED
+ * @brief Unsubscribe Application for way points
+ * @param Application AppID
+ */
+ virtual void UnsubscribeAppFromWayPoints(const uint32_t app_id) = 0;
+
+ /**
+ * @brief Checks if Application is subscribed for way points
+ * @param Application pointer
+ * @return true if Application is subscribed for way points
+ * otherwise false
+ */
+ virtual bool IsAppSubscribedForWayPoints(ApplicationSharedPtr app) const = 0;
+
+ /**
+ * @brief Subscribe Application for way points
+ * @param Application pointer
+ */
+ virtual void SubscribeAppForWayPoints(ApplicationSharedPtr app) = 0;
+
+ /**
+ * @brief Unsubscribe Application for way points
+ * @param Application pointer
+ */
+ virtual void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app) = 0;
+
+ /**
+ * @brief Is Any Application is subscribed for way points
+ * @return true if some app is subscribed otherwise false
+ */
+ virtual bool IsAnyAppSubscribedForWayPoints() const = 0;
+
+ /**
+ * @brief Get subscribed for way points
+ * @return reference to set of subscribed apps for way points
+ */
+ virtual const std::set<int32_t> GetAppsSubscribedForWayPoints() const = 0;
+
+ virtual void SendMessageToMobile(const commands::MessageSharedPtr message,
+ bool final_message = false) = 0;
+
+ virtual void SendMessageToHMI(const commands::MessageSharedPtr message) = 0;
+
+ virtual void RemoveHMIFakeParameters(
+ application_manager::MessagePtr& message) = 0;
+
+ virtual bool ManageHMICommand(const commands::MessageSharedPtr message) = 0;
+ virtual bool ManageMobileCommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandOrigin origin) = 0;
+
+ virtual MessageValidationResult ValidateMessageBySchema(
+ const Message& message) = 0;
+
+ virtual mobile_api::HMILevel::eType GetDefaultHmiLevel(
+ ApplicationConstSharedPtr application) const = 0;
+ /**
+ * @brief hmi_capabilities return capabilities of hmi
+ * @return capabilities of hmi
+ */
+ virtual HMICapabilities& hmi_capabilities() = 0;
+
+ virtual const HMICapabilities& hmi_capabilities() const = 0;
+
+ virtual void ProcessQueryApp(const smart_objects::SmartObject& sm_object,
+ const uint32_t connection_key) = 0;
+
+ /**
+ * @brief ProcessReconnection handles reconnection flow for application on
+ * transport switch
+ * @param application Pointer to switched application, must be validated
+ * before passing
+ * @param connection_key Connection key from registration request of switched
+ * application
+ */
+ virtual void ProcessReconnection(ApplicationSharedPtr application,
+ const uint32_t connection_key) = 0;
+
+ virtual bool is_attenuated_supported() const = 0;
+
+ /**
+ * @brief Checks if application with the same HMI type
+ * (media, voice communication or navi) exists
+ * in HMI_FULL or HMI_LIMITED level.
+ *
+ * @param app Pointer to application to compare with
+ *
+ * @return true if exist otherwise false
+ */
+ virtual bool IsAppTypeExistsInFullOrLimited(
+ ApplicationConstSharedPtr app) const = 0;
+
+ /**
+ * @brief Sets default HMI level and configure application after its
+ * registration
+ * @param app Application
+ */
+ virtual void OnApplicationRegistered(ApplicationSharedPtr app) = 0;
+
+ /**
+ * @brief OnApplicationSwitched starts activies postponed during application
+ * transport switching
+ * @param app Application
+ */
+ virtual void OnApplicationSwitched(ApplicationSharedPtr app) = 0;
+
+ virtual connection_handler::ConnectionHandler& connection_handler() const = 0;
+ virtual protocol_handler::ProtocolHandler& protocol_handler() const = 0;
+ virtual policy::PolicyHandlerInterface& GetPolicyHandler() = 0;
+ virtual const policy::PolicyHandlerInterface& GetPolicyHandler() const = 0;
+
+ virtual uint32_t GetNextHMICorrelationID() = 0;
+ virtual uint32_t GenerateNewHMIAppID() = 0;
+
+ /**
+ * @brief Ends opened navi services (audio/video) for application
+ * @param app_id Application id
+ */
+ virtual void EndNaviServices(uint32_t app_id) = 0;
+
+ /* @brief Starts audio passthru process
+ *
+ * @return true on success, false if passthru is already in process
+ */
+ virtual bool BeginAudioPassThrough() = 0;
+
+ /*
+ * @brief Finishes already started audio passthru process
+ *
+ * @return true on success, false if passthru is not active
+ */
+ virtual bool EndAudioPassThrough() = 0;
+
+ virtual void ConnectToDevice(const std::string& device_mac) = 0;
+
+ virtual void OnHMIStartedCooperation() = 0;
+
+ virtual bool IsHMICooperating() const = 0;
+ /**
+ * @brief Notifies all components interested in Vehicle Data update
+ * i.e. new value of odometer etc and returns list of applications
+ * subscribed for event.
+ * @param vehicle_info Enum value of type of vehicle data
+ * @param new value (for integer values currently) of vehicle data
+ */
+ virtual AppSharedPtrs IviInfoUpdated(
+ mobile_apis::VehicleDataType::eType vehicle_info, int value) = 0;
+
+ virtual ApplicationSharedPtr RegisterApplication(const utils::SharedPtr<
+ smart_objects::SmartObject>& request_for_registration) = 0;
+
+ virtual void SendUpdateAppList() = 0;
+
+ virtual void MarkAppsGreyOut(const connection_handler::DeviceHandle handle,
+ bool is_greyed_out) = 0;
+
+ /**
+ * @brief Returns pointer to application-to-be-registered (from QUERY_APP
+ * list)
+ * @param hmi_id HMI application id
+ * @return Pointer to application or uninitialized shared pointer
+ */
+ virtual ApplicationConstSharedPtr WaitingApplicationByID(
+ const uint32_t hmi_id) const = 0;
+
+ /**
+ * @brief Returns list of applications-to-be-registered (QUERY_APP list)
+ * @return Locked list of applications
+ */
+ virtual DataAccessor<AppsWaitRegistrationSet> AppsWaitingForRegistration()
+ const = 0;
+
+ virtual bool IsAppsQueriedFrom(
+ const connection_handler::DeviceHandle handle) const = 0;
+
+ virtual bool IsStopping() const = 0;
+
+ virtual void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) = 0;
+
+ virtual mobile_apis::Result::eType SaveBinary(
+ const std::vector<uint8_t>& binary_data,
+ const std::string& file_path,
+ const std::string& file_name,
+ const int64_t offset) = 0;
+ /*
+ * @brief Sets SDL access to all mobile apps
+ *
+ * @param allowed SDL access to all mobile apps
+ */
+ virtual void SetAllAppsAllowed(const bool allowed) = 0;
+
+ /*
+ * @brief Sets state for driver distraction
+ *
+ * @param state New state to be set
+ */
+ virtual void set_driver_distraction_state(
+ const hmi_apis::Common_DriverDistractionState::eType state) = 0;
+
+ /*
+ * @brief Starts audio pass thru thread
+ *
+ * @param session_key Session key of connection for Mobile side
+ * @param correlation_id Correlation id for response for Mobile side
+ * @param max_duration Max duration of audio recording in milliseconds
+ * @param sampling_rate Value for rate(8, 16, 22, 44 kHz)
+ * @param bits_per_sample The quality the audio is recorded.
+ * @param audio_type Type of audio data
+ */
+ virtual void StartAudioPassThruThread(int32_t session_key,
+ int32_t correlation_id,
+ int32_t max_duration,
+ int32_t sampling_rate,
+ int32_t bits_per_sample,
+ int32_t audio_type) = 0;
+
+ virtual void StartDevicesDiscovery() = 0;
+
+ virtual void StopAudioPassThru(int32_t application_key) = 0;
+
+ /**
+ * @brief TerminateRequest forces termination of request
+ * @param connection_key - application id of request
+ * @param corr_id correlation id of request
+ * @param function_id function id of request
+ */
+ virtual void TerminateRequest(const uint32_t connection_key,
+ const uint32_t corr_id,
+ const int32_t function_id) = 0;
+
+ /*
+ * @brief Closes application by id
+ *
+ * @param app_id Application id
+ * @param reason reason of unregistering application
+ * @param is_resuming describes - is this unregister
+ * is normal or need to be resumed\
+ * @param is_unexpected_disconnect
+ * Indicates if connection was unexpectedly lost(TM layer, HB)
+ */
+ virtual void UnregisterApplication(const uint32_t& app_id,
+ mobile_apis::Result::eType reason,
+ bool is_resuming = false,
+ bool is_unexpected_disconnect = false) = 0;
+
+ /**
+ * @ Updates request timeout
+ *
+ * @param connection_key Connection key of application
+ * @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,
+ uint32_t mobile_correlation_id,
+ uint32_t new_timeout_value) = 0;
+
+ virtual StateController& state_controller() = 0;
+
+ virtual void SetUnregisterAllApplicationsReason(
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) = 0;
+
+ /*
+ * @brief Called on Master_reset or Factory_defaults
+ * when User chooses to reset HU.
+ * Resets Policy Table if applicable.
+ */
+ virtual void HeadUnitReset(
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) = 0;
+
+ /**
+ * @brief Checks HMI level and returns true if streaming is allowed
+ * @param app_id Application id
+ * @param service_type Service type to check
+ * @return True if streaming is allowed, false in other case
+ */
+ virtual bool HMILevelAllowsStreaming(
+ uint32_t app_id, protocol_handler::ServiceType service_type) const = 0;
+
+ /**
+ * @brief Checks, if given RPC is allowed at current HMI level for specific
+ * application in policy table
+ * @param policy_app_id Application id
+ * @param hmi_level Current HMI level of application
+ * @param function_id FunctionID of RPC
+ * @param params_permissions Permissions for RPC parameters (e.g.
+ * SubscribeVehicleData) defined in policy table
+ * @return SUCCESS, if allowed, otherwise result code of check
+ */
+ virtual mobile_apis::Result::eType CheckPolicyPermissions(
+ const ApplicationSharedPtr app,
+ const std::string& function_id,
+ const RPCParams& rpc_params,
+ CommandParametersPermissions* params_permissions = NULL) = 0;
+
+ /**
+ * @brief IsApplicationForbidden allows to distinguish if application is
+ * not allowed to register, because of spamming.
+ *
+ * @param connection_key the connection key ofthe required application
+ *
+ * @param policy_app_id application's mobile(policy) identifier.
+ *
+ * @return true in case application is allowed to register, false otherwise.
+ */
+ virtual bool IsApplicationForbidden(
+ uint32_t connection_key, const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief IsAppInReconnectMode check if application belongs to session
+ * affected by transport switching at the moment
+ * @param policy_app_id Application id
+ * @return True if application is registered within session being switched,
+ * otherwise - false
+ */
+ virtual bool IsAppInReconnectMode(const std::string& policy_app_id) const = 0;
+
+ virtual resumption::ResumeCtrl& resume_controller() = 0;
+
+ /**
+ * @brief hmi_interfaces getter for hmi_interfaces component, that handle
+ * hmi_instrfaces state
+ * @return reference to hmi_interfaces component
+ */
+ virtual HmiInterfaces& hmi_interfaces() = 0;
+
+ virtual app_launch::AppLaunchCtrl& app_launch_ctrl() = 0;
+
+ /*
+ * @brief Converts connection string transport type representation
+ * to HMI Common_TransportType
+ *
+ * @param transport_type String representing connection type
+ *
+ * @return Corresponding HMI TransporType value
+ */
+ virtual hmi_apis::Common_TransportType::eType GetDeviceTransportType(
+ const std::string& transport_type) = 0;
+
+ /**
+ * @brief method adds application
+ * to tts_global_properties_app_list_
+ * @param app_id contains application which will
+ * send TTS global properties after timeout
+ */
+ virtual void AddAppToTTSGlobalPropertiesList(const uint32_t app_id) = 0;
+
+ /**
+ * Generate grammar ID
+ *
+ * @return New grammar ID
+ */
+ virtual uint32_t GenerateGrammarID() = 0;
+
+ virtual policy::DeviceConsent GetUserConsentForDevice(
+ const std::string& device_id) const = 0;
+
+ /**
+ * @brief Handle sequence for unauthorized application
+ * @param app_id Application id
+ */
+ virtual void OnAppUnauthorized(const uint32_t& app_id) = 0;
+
+ virtual bool ActivateApplication(ApplicationSharedPtr app) = 0;
+
+ /**
+ * @brief Callback calls when application starts/stops data streaming
+ * @param app_id Streaming application id
+ * @param service_type Streaming service type
+ * @param state Shows if streaming started or stopped
+ */
+ virtual void OnAppStreaming(uint32_t app_id,
+ protocol_handler::ServiceType service_type,
+ bool state) = 0;
+
+ /**
+ * @brief CreateRegularState create regular HMI state for application
+ * @param app Application
+ * @param hmi_level of returned state
+ * @param audio_state of returned state
+ * @param system_context of returned state
+ * @return new regular HMI state
+ */
+ virtual HmiStatePtr CreateRegularState(
+ utils::SharedPtr<Application> app,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state,
+ mobile_apis::SystemContext::eType system_context) const = 0;
+
+ /**
+ * DEPRECATED
+ * @brief CreateRegularState create regular HMI state for application
+ * @param app_id Application id
+ * @param hmi_level of returned state
+ * @param audio_state of returned state
+ * @param system_context of returned state
+ * @return new regular HMI state
+ */
+ virtual HmiStatePtr CreateRegularState(
+ uint32_t app_id,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state,
+ mobile_apis::SystemContext::eType system_context) const = 0;
+
+ virtual void SendAudioPassThroughNotification(
+ uint32_t session_key, std::vector<uint8_t>& binary_data) = 0;
+
+ /**
+ * @brief Checks if application can stream (streaming service is started and
+ * streaming is enabled in application)
+ * @param app_id Application id
+ * @param service_type Service type to check
+ * @return True if streaming is allowed, false in other case
+ */
+ virtual bool CanAppStream(
+ uint32_t app_id, protocol_handler::ServiceType service_type) const = 0;
+
+ /**
+ * @brief ForbidStreaming forbid the stream over the certain application.
+ * @param app_id the application's id which should stop streaming.
+ */
+ virtual void ForbidStreaming(uint32_t app_id) = 0;
+
+ /**
+ * @brief Called when application completes streaming configuration
+ * @param app_id Streaming application id
+ * @param service_type Streaming service type
+ * @param result true if configuration is successful, false otherwise
+ * @param rejected_params list of rejected parameters' name. Valid
+ * only when result is false.
+ */
+ virtual void OnStreamingConfigured(
+ uint32_t app_id,
+ protocol_handler::ServiceType service_type,
+ bool result,
+ std::vector<std::string>& rejected_params) = 0;
+
+ virtual const ApplicationManagerSettings& get_settings() const = 0;
+
+ virtual event_engine::EventDispatcher& event_dispatcher() = 0;
+
+ virtual uint32_t GetAvailableSpaceForApp(const std::string& folder_name) = 0;
+ virtual void OnTimerSendTTSGlobalProperties() = 0;
+ virtual void OnLowVoltage() = 0;
+ virtual void OnWakeUp() = 0;
+};
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
diff --git a/src/components/include/application_manager/application_manager_settings.h b/src/components/include/application_manager/application_manager_settings.h
index 899b098359..e745a831c6 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 bool launch_hmi() const = 0;
virtual const uint32_t& delete_file_in_none() const = 0;
virtual const std::vector<uint32_t>& supported_diag_modes() const = 0;
+ virtual const std::string& app_info_storage() const = 0;
virtual const uint32_t& list_files_in_none() const = 0;
virtual const std::string& tts_delimiter() const = 0;
virtual const uint32_t& put_file_in_none() const = 0;
@@ -86,13 +87,14 @@ class ApplicationManagerSettings : public RequestControlerSettings,
virtual const uint32_t& app_resuming_timeout() const = 0;
virtual uint16_t attempts_to_open_resumption_db() const = 0;
virtual uint16_t open_attempt_timeout_ms_resumption_db() const = 0;
- virtual void config_file_name(const std::string& fileName) = 0;
+ virtual void set_config_file_name(const std::string& fileName) = 0;
virtual const std::pair<uint32_t, int32_t>& start_stream_retry_amount()
const = 0;
virtual const std::string& app_icons_folder() const = 0;
virtual const uint32_t& app_icons_folder_max_size() const = 0;
virtual const uint32_t& app_icons_amount_to_remove() const = 0;
virtual const uint32_t& list_files_response_size() const = 0;
+ virtual const std::string& plugins_folder() const = 0;
};
} // namespace application_manager
diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h
index 39cedf3273..1283584ef8 100644
--- a/src/components/include/application_manager/hmi_capabilities.h
+++ b/src/components/include/application_manager/hmi_capabilities.h
@@ -38,18 +38,12 @@
#include "json/json.h"
#include "utils/macro.h"
#include "application_manager/hmi_language_handler.h"
+#include "smart_objects/smart_object.h"
-namespace NsSmartDeviceLink {
-namespace NsSmartObjects {
-class SmartObject;
-}
-}
namespace resumption {
class LastState;
}
-namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
-
namespace application_manager {
class ApplicationManager;
@@ -96,6 +90,9 @@ class HMICapabilities {
virtual bool is_ivi_cooperating() const = 0;
virtual void set_is_ivi_cooperating(const bool value) = 0;
+ virtual bool is_rc_cooperating() const = 0;
+ virtual void set_is_rc_cooperating(const bool value) = 0;
+
/*
* @brief Interface used to store information about software version of the
*target
@@ -415,6 +412,93 @@ class HMICapabilities {
*/
virtual bool phone_call_supported() const = 0;
+ /*
+ * @brief Interface to store whether HMI supports video streaming
+ *
+ * @param supported Indicates whether video streaming is supported by HMI
+ */
+ virtual void set_video_streaming_supported(const bool supported) = 0;
+
+ /*
+ * @brief Retrieves whether HMI supports video streaming
+ *
+ * @return TRUE if it supported, otherwise FALSE
+ */
+ virtual bool video_streaming_supported() const = 0;
+
+ /*
+ * @brief Interface to store whether HMI supports remote control
+ *
+ * @param supported Indicates whether remote control is supported by HMI
+ */
+ virtual void set_rc_supported(const bool supported) = 0;
+
+ /*
+ * @brief Retrieves whether HMI supports remote control
+ *
+ * @return TRUE if it supported, otherwise FALSE
+ */
+ virtual bool rc_supported() const = 0;
+
+ /*
+ * @brief Interface used to store information regarding
+ * the navigation "System Capability"
+ *
+ * @param navigation_capability contains information related
+ * to the navigation system capability.
+ */
+ virtual void set_navigation_capability(
+ const smart_objects::SmartObject& navigation_capability) = 0;
+
+ /*
+ * @brief Retrieves information regarding the navigation system capability
+ *
+ * @return NAVIGATION system capability
+ */
+ virtual const smart_objects::SmartObject* navigation_capability() const = 0;
+
+ /*
+ * @brief Interface used to store information regarding
+ * the phone "System Capability"
+ *
+ * @param phone_capability contains information related
+ * to the phone system capability.
+ */
+ virtual void set_phone_capability(
+ const smart_objects::SmartObject& phone_capability) = 0;
+
+ /*
+ * @brief Retrieves information regarding the phone call system capability
+ *
+ * @return PHONE_CALL system capability
+ */
+ virtual const smart_objects::SmartObject* phone_capability() const = 0;
+
+ /*
+ * @brief Sets HMI's video streaming related capability information
+ *
+ * @param video_streaming_capability the video streaming related capabilities
+ */
+ virtual void set_video_streaming_capability(
+ const smart_objects::SmartObject& video_streaming_capability) = 0;
+
+ /*
+ * @brief Retrieves HMI's video streaming related capabilities
+ *
+ * @return HMI's video streaming related capability information
+ */
+ virtual const smart_objects::SmartObject* video_streaming_capability()
+ const = 0;
+
+ /**
+ * @brief Sets available RC capabilities for further usage by RC functionality
+ * @param rc_capability capabilities to set
+ */
+ virtual void set_rc_capability(
+ const smart_objects::SmartObject& rc_capability) = 0;
+
+ virtual const smart_objects::SmartObject* rc_capability() const = 0;
+
virtual void Init(resumption::LastState* last_state) = 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 8fdb56b6df..f0859ece38 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,15 +39,21 @@
#include <vector>
#include <queue>
#include "interfaces/MOBILE_API.h"
-#include "policy/policy_types.h"
#include "application_manager/policies/policy_handler_observer.h"
+#include "application_manager/core_service.h"
+#include "application_manager/application.h"
#include "policy/usage_statistics/statistics_manager.h"
#include "utils/custom_string.h"
+#include "utils/callable.h"
#include "policy/policy_settings.h"
#include "smart_objects/smart_object.h"
+#include "policy/policy_types.h"
+#include "policy/policy_table/types.h"
+using namespace ::rpc::policy_table_interface_base;
namespace policy {
-namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+typedef utils::SharedPtr<utils::Callable> StatusNotifier;
+
class PolicyHandlerInterface {
public:
virtual ~PolicyHandlerInterface() {}
@@ -69,13 +75,21 @@ class PolicyHandlerInterface {
virtual void OnPermissionsUpdated(const std::string& policy_app_id,
const Permissions& permissions) = 0;
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ virtual void OnSnapshotCreated(const BinaryMessage& pt_string,
+ const std::vector<int>& retry_delay_seconds,
+ uint32_t timeout_exchange) = 0;
+#else // EXTERNAL_PROPRIETARY_MODE
+ virtual void OnSnapshotCreated(const BinaryMessage& pt_string) = 0;
+#endif // EXTERNAL_PROPRIETARY_MODE
+
virtual bool GetPriority(const std::string& policy_app_id,
std::string* priority) const = 0;
- virtual void CheckPermissions(const PTString& app_id,
- const PTString& hmi_level,
- const PTString& rpc,
- const RPCParams& rpc_params,
- CheckPermissionResult& result) = 0;
+ virtual void CheckPermissions(
+ const application_manager::ApplicationSharedPtr app,
+ const PTString& rpc,
+ const RPCParams& rpc_params,
+ CheckPermissionResult& result) = 0;
virtual uint32_t GetNotificationsNumber(
const std::string& priority) const = 0;
@@ -86,12 +100,24 @@ class PolicyHandlerInterface {
virtual bool GetInitialAppData(const std::string& application_id,
StringArray* nicknames = NULL,
StringArray* app_hmi_types = NULL) = 0;
- virtual void GetServiceUrls(const std::string& service_type,
- EndpointUrls& end_points) = 0;
+ virtual void GetUpdateUrls(const std::string& service_type,
+ EndpointUrls& out_end_points) = 0;
+ virtual void GetUpdateUrls(const uint32_t service_type,
+ EndpointUrls& out_end_points) = 0;
virtual std::string GetLockScreenIconUrl() const = 0;
- virtual void ResetRetrySequence() = 0;
virtual uint32_t NextRetryTimeout() = 0;
- virtual int TimeoutExchange() = 0;
+
+ /**
+ * Gets timeout to wait until receive response
+ * @return timeout in seconds
+ */
+ virtual uint32_t TimeoutExchangeSec() const = 0;
+
+ /**
+ * Gets timeout to wait until receive response
+ * @return timeout in miliseconds
+ */
+ virtual uint32_t TimeoutExchangeMSec() const = 0;
virtual void OnExceededTimeout() = 0;
virtual void OnSystemReady() = 0;
virtual void PTUpdatedAt(Counters counter, int value) = 0;
@@ -131,11 +157,11 @@ class PolicyHandlerInterface {
/**
* @brief Process user consent on mobile data connection access
- * @param Device id or empty string, if concern to all SDL functionality
- * @param User consent from response
+ * @param is_allowed - user consent from response
+ * @param device_mac - mac adress of device
*/
virtual void OnAllowSDLFunctionalityNotification(
- bool is_allowed, const std::string& device_id) = 0;
+ bool is_allowed, const std::string& device_mac) = 0;
/**
* @brief Increment counter for ignition cycles
@@ -166,14 +192,23 @@ class PolicyHandlerInterface {
virtual void SetDeviceInfo(const std::string& device_id,
const DeviceInfo& device_info) = 0;
- /**
- * @brief Store user-changed permissions consent to DB
- * @param connection_key Connection key of application or 0, if permissions
- * should be applied to all applications
- * @param permissions User-changed group permissions consent
- */
+/**
+*@brief Processes data from OnAppPermissionConsent notification with
+*permissions changes and ExternalConsent status changes done by user
+*@param connection_key Connection key of application, 0 if no key has been
+*provided
+*@param permissions Groups permissions changes
+*@param external_consent_status Customer connectivity settings status changes
+*/
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ virtual void OnAppPermissionConsent(
+ const uint32_t connection_key,
+ const PermissionConsent& permissions,
+ const ExternalConsentStatus& external_consent_status) = 0;
+#else
virtual void OnAppPermissionConsent(const uint32_t connection_key,
const PermissionConsent& permissions) = 0;
+#endif
/**
* @brief Get appropriate message parameters and send them with response
@@ -282,6 +317,11 @@ class PolicyHandlerInterface {
virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
+ virtual void OnPTUFinished(const bool ptu_result) = 0;
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ virtual void OnCertificateDecrypted(bool is_succeeded) = 0;
+#endif // EXTERNAL_PROPRIETARY_MODE
virtual bool CanUpdate() = 0;
virtual void OnDeviceConsentChanged(const std::string& device_id,
@@ -295,8 +335,11 @@ class PolicyHandlerInterface {
* @brief Allows to add new or update existed application during
* registration process
* @param application_id The policy aplication id.
+ * @return function that will notify update manager about new application
*/
- virtual void AddApplication(const std::string& application_id) = 0;
+ virtual StatusNotifier AddApplication(
+ const std::string& application_id,
+ const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0;
/**
* Checks whether application is revoked
@@ -326,7 +369,7 @@ class PolicyHandlerInterface {
/**
* @brief Handler on applications search completed
*/
- virtual void OnAppsSearchCompleted() = 0;
+ virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0;
/**
* @brief OnAppRegisteredOnMobile allows to handle event when application were
@@ -360,7 +403,13 @@ class PolicyHandlerInterface {
* @return Structure with vehicle information
*/
virtual const VehicleInfo GetVehicleInfo() const = 0;
-
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ /**
+ * @brief Gets meta information
+ * @return meta information
+ */
+ virtual const policy::MetaInfo GetMetaInfo() const = 0;
+#endif // EXTERNAL_PROPRIETARY_MODE
virtual void Increment(usage_statistics::GlobalCounterId type) = 0;
virtual void Increment(const std::string& app_id,
usage_statistics::AppCounterId type) = 0;
@@ -378,9 +427,105 @@ class PolicyHandlerInterface {
virtual const PolicySettings& get_settings() const = 0;
virtual const std::string RemoteAppsUrl() const = 0;
+ /**
+ * @brief OnDeviceSwitching Notifies policy manager on device switch event so
+ * policy permissions should be processed accordingly
+ * @param device_id_from Id of device being switched
+ * @param device_id_to Id of device on the new transport
+ */
+ virtual void OnDeviceSwitching(const std::string& device_id_from,
+ const std::string& device_id_to) = 0;
+
+#ifdef SDL_REMOTE_CONTROL
+ /**
+ * @brief Sets HMI default type for specified application
+ * @param application_id ID application
+ * @param app_types list of HMI types
+ */
+ virtual void SetDefaultHmiTypes(
+ const std::string& application_id,
+ const smart_objects::SmartObject* app_types) = 0;
+
+ /**
+ * Checks if application has HMI type
+ * @param application_id ID application
+ * @param hmi HMI type to check
+ * @param app_types additional list of HMI type to search in it
+ * @return true if hmi is contained in policy or app_types
+ */
+ virtual bool CheckHMIType(const std::string& application_id,
+ mobile_apis::AppHMIType::eType hmi,
+ const smart_objects::SmartObject* app_types) = 0;
+
+ /**
+ * Notifies about changing HMI level
+ * @param device_id unique identifier of device
+ * @param policy_app_id unique identifier of application in policy
+ * @param hmi_level default HMI level for this application
+ */
+ virtual void OnUpdateHMILevel(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level) = 0;
+
+ /**
+ * Checks if module for application is present in policy table
+ * @param app_id id of application
+ * @param module type
+ * @return true if module is present, otherwise - false
+ */
+ virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0;
+
+ /**
+ * @brief Notifies Remote apps about change in permissions
+ * @param device_id Device on which app is running
+ * @param application_id ID of app whose permissions are changed
+ */
+ virtual void OnRemoteAppPermissionsChanged(
+ const std::string& device_id, const std::string& application_id) = 0;
+
+ /**
+ * @brief Notifies Remote apps about change in HMI status
+ * @param device_id Device on which app is running
+ * @param policy_app_id ID of application
+ * @param hmi_level new HMI level for this application
+ */
+ virtual void OnUpdateHMIStatus(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level) = 0;
+
+ /**
+ * Gets all allowed module types
+ * @param app_id unique identifier of application
+ * @param list of allowed module types
+ * @return true if application has allowed modules
+ */
+ virtual bool GetModuleTypes(const std::string& policy_app_id,
+ std::vector<std::string>* modules) const = 0;
+#endif // SDL_REMOTE_CONTROL
+
private:
+/**
+ * @brief Processes data received via OnAppPermissionChanged notification
+ * from. Being started asyncronously from AppPermissionDelegate class.
+ * Sets updated permissions and ExternalConsent for registered applications
+*and
+ * applications which already have appropriate group assigned which related to
+ * devices already known by policy
+ * @param connection_key Connection key of application, 0 if no key has been
+ * provided within notification
+ * @param external_consent_status Customer connectivity settings changes to
+*process
+*@param permissions Permissions changes to process
+ */
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ virtual void OnAppPermissionConsentInternal(
+ const uint32_t connection_key,
+ const ExternalConsentStatus& external_consent_status,
+ PermissionConsent& out_permissions) = 0;
+#else
virtual void OnAppPermissionConsentInternal(
- const uint32_t connection_key, PermissionConsent& permissions) = 0;
+ const uint32_t connection_key, PermissionConsent& out_permissions) = 0;
+#endif
friend class AppPermissionDelegate;
};
diff --git a/src/components/include/application_manager/policies/policy_handler_observer.h b/src/components/include/application_manager/policies/policy_handler_observer.h
new file mode 100644
index 0000000000..1c32102184
--- /dev/null
+++ b/src/components/include/application_manager/policies/policy_handler_observer.h
@@ -0,0 +1,57 @@
+/*
+ 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_HANDLER_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_HANDLER_OBSERVER_H_
+
+#include <map>
+#include <vector>
+#include <string>
+
+namespace policy {
+
+class PolicyHandlerObserver {
+ public:
+ virtual void OnUpdateHMIAppType(
+ std::map<std::string, std::vector<std::string> > app_hmi_types) {}
+
+ virtual bool OnCertificateUpdated(const std::string& certificate_data) {
+ return false;
+ }
+
+ virtual void OnPTUFinished(const bool ptu_result) {}
+
+ virtual ~PolicyHandlerObserver() {}
+};
+} // namespace policy
+
+#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_POLICIES_POLICY_HANDLER_OBSERVER_H_
diff --git a/src/components/include/application_manager/request_controller_settings.h b/src/components/include/application_manager/request_controller_settings.h
index 297b3f7ba1..04b47a3b78 100644
--- a/src/components/include/application_manager/request_controller_settings.h
+++ b/src/components/include/application_manager/request_controller_settings.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_SETTINGS_H
-#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_SETTINGS_H
+#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_SETTINGS_H_
namespace application_manager {
class RequestControlerSettings {
@@ -45,4 +45,4 @@ class RequestControlerSettings {
virtual const uint32_t& pending_requests_amount() const = 0;
};
} // namespace application_manager
-#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_SETTINGS_H
+#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_REQUEST_CONTROLLER_SETTINGS_H_
diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h
new file mode 100644
index 0000000000..1fcf5e4477
--- /dev/null
+++ b/src/components/include/connection_handler/connection_handler.h
@@ -0,0 +1,243 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
+#define SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
+
+#include "connection_handler/connection_handler_settings.h"
+#include "transport_manager/transport_manager_listener.h"
+#include "protocol_handler/session_observer.h"
+#include "connection_handler/device.h"
+#include "connection_handler/connection.h"
+#include "connection_handler/devices_discovery_starter.h"
+#include "utils/macro.h"
+
+/**
+ * \namespace connection_handler
+ * \brief SmartDeviceLink connection_handler namespace.
+ */
+namespace connection_handler {
+
+enum CloseSessionReason { kCommon = 0, kFlood, kMalformed, kUnauthorizedApp };
+
+class ConnectionHandlerObserver;
+
+/**
+ * \class ConnectionHandler
+ * \brief SmartDeviceLink ConnectionHandler interface class
+ */
+class ConnectionHandler {
+ public:
+ /**
+ * \brief Sets observer pointer for ConnectionHandler.
+ * \param observer Pointer to observer object.
+ **/
+ virtual void set_connection_handler_observer(
+ ConnectionHandlerObserver* observer) = 0;
+
+ virtual void StartTransportManager() = 0;
+
+ virtual void ConnectToDevice(
+ connection_handler::DeviceHandle device_handle) = 0;
+
+ /**
+ * @brief RunAppOnDevice allows to run specific application on the certain
+ *device.
+ *
+ * @param device_handle device identifier to run application on.
+ *
+ * @param app_id application id also known as bundle id on some devices to
+ *run.
+ */
+ virtual void RunAppOnDevice(const std::string& device_handle,
+ const std::string& bundle_id) const = 0;
+
+ virtual void ConnectToAllDevices() = 0;
+
+ /**
+ * @brief Close the connection revoked by Policy
+ * @param connection_key pair of connection and session id
+ */
+ virtual void CloseRevokedConnection(uint32_t connection_key) = 0;
+
+ /**
+ * \brief Close all associated sessions and close the connection pointed by
+ * handle
+ */
+ virtual void CloseConnection(ConnectionHandle connection_handle) = 0;
+
+ /**
+ * \brief Return count of session for specified connection
+ * \param connection_key pair of connection handle and session id
+ */
+ virtual uint32_t GetConnectionSessionsCount(uint32_t connection_key) = 0;
+
+ /**
+ * Gets device id by mac address
+ * @param mac_address
+ * @return true if successfully
+ */
+ virtual bool GetDeviceID(const std::string& mac_address,
+ DeviceHandle* device_handle) = 0;
+
+ /**
+ * Close session associated with the key
+ */
+ virtual void CloseSession(uint32_t key, CloseSessionReason close_reason) = 0;
+
+ /**
+ * Close session
+ */
+ virtual void CloseSession(ConnectionHandle connection_handle,
+ uint8_t session_id,
+ CloseSessionReason close_reason) = 0;
+
+ /**
+ * @brief SendEndService allows to end up specific service.
+ *
+ * @param key application identifier whose service should be closed.
+ *
+ * @param service_type the service that should be closed.
+ */
+ virtual void SendEndService(uint32_t key, uint8_t service_type) = 0;
+
+ /**
+ * \brief Start heartbeat for specified session
+ *
+ * \param connection_key pair of connection and session id
+ */
+ virtual void StartSessionHeartBeat(uint32_t connection_key) = 0;
+
+ /**
+ * \brief Send heartbeat to mobile app
+ */
+ virtual void SendHeartBeat(ConnectionHandle connection_handle,
+ uint8_t session_id) = 0;
+
+ /**
+ * Sets heart beat timeout for specified session
+ * @param connection_key pair of connection and session id
+ * @param timeout in milliseconds
+ */
+ virtual void SetHeartBeatTimeout(uint32_t connection_key,
+ uint32_t timeout) = 0;
+
+ /**
+ * \brief Keep connection associated with the key from being closed by
+ * heartbeat monitor
+ */
+ virtual void KeepConnectionAlive(uint32_t connection_key,
+ uint8_t session_id) = 0;
+
+ /**
+ * \brief binds protocol version with session
+ *
+ * \param connection_key pair of connection and session id
+ * \param protocol_version contains protocol version of
+ * \registered application.
+ */
+ virtual void BindProtocolVersionWithSession(uint32_t connection_key,
+ uint8_t protocol_version) = 0;
+
+ /**
+ * \brief information about given Connection Key.
+ * \param key Unique key used by other components as session identifier
+ * \param app_id Returned: ApplicationID
+ * \param sessions_list Returned: List of session keys
+ * \param device_id Returned: DeviceID
+ * \return int32_t -1 in case of error or 0 in case of success
+ */
+ virtual int32_t GetDataOnSessionKey(
+ uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ connection_handler::DeviceHandle* device_id) const = 0;
+
+ /**
+ * DEPRECATED
+ * \brief information about given Connection Key.
+ * \param key Unique key used by other components as session identifier
+ * \param app_id Returned: ApplicationID
+ * \param sessions_list Returned: List of session keys
+ * \param device_id Returned: DeviceID
+ * \return int32_t -1 in case of error or 0 in case of success
+ */
+ DEPRECATED virtual int32_t GetDataOnSessionKey(
+ uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ uint32_t* device_id) const = 0;
+
+ /**
+ * @brief GetConnectedDevicesMAC allows to obtain MAC adresses for all
+ * currently connected devices.
+ *
+ * @param device_macs collection of MAC adresses for connected devices.
+ */
+ virtual void GetConnectedDevicesMAC(
+ std::vector<std::string>& device_macs) const = 0;
+
+ /**
+ * \brief Connection handler settings getter
+ * \return pointer to connection handler settings class
+ */
+ virtual const ConnectionHandlerSettings& get_settings() const = 0;
+
+ virtual const protocol_handler::SessionObserver& get_session_observer() = 0;
+
+ virtual DevicesDiscoveryStarter& get_device_discovery_starter() = 0;
+
+ /**
+ * \brief Invoked when observer's OnServiceStartedCallback is completed
+ * \param session_key the key of started session passed to
+ * OnServiceStartedCallback().
+ * \param result true if observer accepts starting service, false otherwise
+ * \param rejected_params list of rejected parameters' name. Only valid when
+ * result is false. Note that even if result is false, this may be empty.
+ *
+ * \note This is invoked only once but can be invoked by multiple threads.
+ * Also it can be invoked before OnServiceStartedCallback() returns.
+ **/
+ virtual void NotifyServiceStartedResult(
+ uint32_t session_key,
+ bool result,
+ std::vector<std::string>& rejected_params) = 0;
+
+ protected:
+ /**
+ * \brief Destructor
+ */
+ virtual ~ConnectionHandler() {}
+};
+} // namespace connection_handler
+
+#endif // SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h
new file mode 100644
index 0000000000..1bd919f30e
--- /dev/null
+++ b/src/components/include/connection_handler/connection_handler_observer.h
@@ -0,0 +1,168 @@
+/*
+ * 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_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_OBSERVER_H_
+
+#include <string>
+#include "connection_handler/device.h"
+#include "connection_handler/connection.h"
+#include "connection_handler/connection_handler.h"
+#include "protocol/service_type.h"
+
+#ifdef ENABLE_SECURITY
+#include "security_manager/ssl_context.h"
+#endif // ENABLE_SECURITY
+
+struct BsonObject;
+
+/**
+ * \namespace connection_handler
+ * \brief SmartDeviceLink connection_handler namespace.
+ */
+namespace connection_handler {
+
+/**
+ * \class ConnectionHandlerObserver
+ * \brief ConnectionHandlerObserver class
+ */
+class ConnectionHandlerObserver {
+ public:
+ /**
+ * \brief Available devices list updated.
+ *
+ * Called when device scanning initiated with scanForNewDevices
+ * is completed.
+ *
+ * \param DeviceList New list of available devices.
+ **/
+ virtual void OnDeviceListUpdated(
+ const connection_handler::DeviceMap& device_list) = 0;
+
+ /**
+ * @brief Reaction to "Find new applications" request
+ */
+ virtual void OnFindNewApplicationsRequest() = 0;
+
+ /**
+ * \brief Removes device.
+ *
+ * Called when device has been removed from a list.
+ *
+ * \param DeviceHandle Handle of removed device.
+ **/
+ virtual void RemoveDevice(
+ const connection_handler::DeviceHandle& device_handle) = 0;
+
+ /**
+ * \brief Callback function used by connection_handler
+ * when Mobile Application initiates start of new service.
+ * \param deviceHandle Device identifier within which session has to be
+ * started.
+ * \param sessionKey Key of started session.
+ * \param type Established service type
+ */
+ virtual bool OnServiceStartedCallback(
+ const connection_handler::DeviceHandle& device_handle,
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type) = 0;
+
+ /**
+ * \brief Callback function used by connection_handler
+ * when Mobile Application initiates start of new service.
+ * Result must be notified through NotifyServiceStartedResult().
+ * \param deviceHandle Device identifier within which session has to be
+ * started.
+ * \param sessionKey Key of started session.
+ * \param type Established service type
+ * \param params Configuration parameters for this service
+ */
+ virtual void OnServiceStartedCallback(
+ const connection_handler::DeviceHandle& device_handle,
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type,
+ const BsonObject* params) = 0;
+
+ /**
+ * \brief Callback function used by connection_handler
+ * when Mobile Application initiates service ending.
+ * \param session_key Key of session which should be ended
+ * \param type Type of service which should be ended
+ * \param close_reson Service close reason
+ */
+ virtual void OnServiceEndedCallback(
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type,
+ const connection_handler::CloseSessionReason& close_reason) = 0;
+
+ /**
+ * @brief OnDeviceSwitchingStart is invoked on device transport switching
+ * start (e.g. from Bluetooth to USB)
+ * @param device_from device params being switched to new transport
+ * @param device_to device params on the new transport
+ */
+ virtual void OnDeviceSwitchingStart(const Device& device_from,
+ const Device& device_to) = 0;
+
+ /**
+ * @brief OnDeviceSwitchingFinish is invoked on device trasport switching end
+ * i.e. timeout for switching is expired
+ * @param device_uid UID of device being switched
+ */
+ virtual void OnDeviceSwitchingFinish(const std::string& device_uid) = 0;
+
+#ifdef ENABLE_SECURITY
+ /**
+ * @brief Get unique handshake context by application id
+ * @param key id of application
+ * @return generated handshake context or empty context if application with
+ * provided id does not exist
+ */
+ virtual security_manager::SSLContext::HandshakeContext GetHandshakeContext(
+ uint32_t key) const = 0;
+
+ /**
+ * @brief Check if application with specified app_id has NAVIGATION HMI type
+ * @param app_id id of application to check
+ * @return true if application is navi otherwise returns false
+ */
+ virtual bool CheckAppIsNavi(const uint32_t app_id) const = 0;
+#endif // ENABLE_SECURITY
+ protected:
+ /**
+ * \brief Destructor
+ */
+ virtual ~ConnectionHandlerObserver() {}
+};
+} // namespace connection_handler
+
+#endif // SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_OBSERVER_H_
diff --git a/src/components/include/hmi_message_handler/hmi_message_adapter.h b/src/components/include/hmi_message_handler/hmi_message_adapter.h
new file mode 100644
index 0000000000..704cc619be
--- /dev/null
+++ b/src/components/include/hmi_message_handler/hmi_message_adapter.h
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_ADAPTER_H_
+#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_ADAPTER_H_
+
+#include "hmi_message_handler/hmi_message_sender.h"
+
+namespace hmi_message_handler {
+/**
+ * \class HMIMessageAdapter
+ * \brief Interface class describing methods neccessary for exchanging message
+ * between ApplicationManager and HMI. Adapter for concrete transport connection
+ * SDL with HMI has to implement this interface.
+ */
+class HMIMessageAdapter : public HMIMessageSender {
+ public:
+ /**
+ * \brief Destructor
+ */
+ virtual ~HMIMessageAdapter() {}
+
+ protected:
+ /**
+ * \brief Interface for subscriptions.
+ * Each class implementing interface should use it according to
+ * standarts of transport for which it is to be an adapter.
+ * For example, Adapter for MessageBroker will use it to subscribe to
+ * notifications
+ * from HMI.
+ */
+ virtual void SubscribeTo() = 0;
+};
+
+} // namespace hmi_message_handler
+
+#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_ADAPTER_H_
diff --git a/src/components/include/hmi_message_handler/hmi_message_handler.h b/src/components/include/hmi_message_handler/hmi_message_handler.h
new file mode 100644
index 0000000000..411d19fb75
--- /dev/null
+++ b/src/components/include/hmi_message_handler/hmi_message_handler.h
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_H_
+#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_H_
+
+#include "hmi_message_handler/hmi_message_sender.h"
+#include "hmi_message_handler/hmi_message_observer.h"
+#include "hmi_message_handler/hmi_message_handler_settings.h"
+
+namespace hmi_message_handler {
+
+class HMIMessageAdapter;
+/**
+ * \class HMIMessageHandler
+ * \brief Abstract class for handling different HMI adapters;
+ * establishing interface for message exchange between SDL core and HMI.
+ */
+class HMIMessageHandler : public HMIMessageObserver, public HMIMessageSender {
+ public:
+ virtual ~HMIMessageHandler() {}
+ virtual void AddHMIMessageAdapter(HMIMessageAdapter* adapter) = 0;
+ virtual void RemoveHMIMessageAdapter(HMIMessageAdapter* adapter) = 0;
+
+ /**
+ * \brief Hmi message handler settings getter
+ * \return pointer to hmi message handler settings class
+ */
+ virtual const HMIMessageHandlerSettings& get_settings() const = 0;
+};
+
+} // namespace hmi_message_handler
+
+#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_H_
diff --git a/src/components/include/hmi_message_handler/hmi_message_handler_settings.h b/src/components/include/hmi_message_handler/hmi_message_handler_settings.h
index 5386869555..8b24f2cf7d 100644
--- a/src/components/include/hmi_message_handler/hmi_message_handler_settings.h
+++ b/src/components/include/hmi_message_handler/hmi_message_handler_settings.h
@@ -44,7 +44,7 @@ class HMIMessageHandlerSettings {
public:
virtual ~HMIMessageHandlerSettings() {}
- virtual const uint64_t& thread_min_stack_size() const = 0;
+ virtual const uint64_t thread_min_stack_size() const = 0;
};
} // namespace hmi_message_handler
#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_SETTINGS_H_
diff --git a/src/components/include/hmi_message_handler/hmi_message_observer.h b/src/components/include/hmi_message_handler/hmi_message_observer.h
new file mode 100644
index 0000000000..0676615b53
--- /dev/null
+++ b/src/components/include/hmi_message_handler/hmi_message_observer.h
@@ -0,0 +1,54 @@
+/*
+ * 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_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_OBSERVER_H_
+
+#include "utils/shared_ptr.h"
+
+namespace application_manager {
+class Message;
+}
+
+namespace hmi_message_handler {
+
+class HMIMessageObserver {
+ public:
+ virtual ~HMIMessageObserver() {}
+ virtual void OnMessageReceived(
+ utils::SharedPtr<application_manager::Message> message) = 0;
+ virtual void OnErrorSending(
+ utils::SharedPtr<application_manager::Message> message) = 0;
+};
+}
+
+#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_OBSERVER_H_
diff --git a/src/components/include/hmi_message_handler/hmi_message_sender.h b/src/components/include/hmi_message_handler/hmi_message_sender.h
new file mode 100644
index 0000000000..91c20a1986
--- /dev/null
+++ b/src/components/include/hmi_message_handler/hmi_message_sender.h
@@ -0,0 +1,48 @@
+/*
+ * 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_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_SENDER_H_
+#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_SENDER_H_
+
+#include "application_manager/message.h"
+
+namespace hmi_message_handler {
+typedef utils::SharedPtr<application_manager::Message> MessageSharedPointer;
+
+class HMIMessageSender {
+ public:
+ virtual ~HMIMessageSender() {}
+ virtual void SendMessageToHMI(MessageSharedPointer message) = 0;
+};
+}
+
+#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_SENDER_H_
diff --git a/src/components/include/media_manager/media_manager.h b/src/components/include/media_manager/media_manager.h
new file mode 100644
index 0000000000..64acbcbc0b
--- /dev/null
+++ b/src/components/include/media_manager/media_manager.h
@@ -0,0 +1,68 @@
+/*
+ * 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_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_H_
+
+#include <string>
+#include "protocol/service_type.h"
+#include "media_manager/media_manager_settings.h"
+namespace media_manager {
+
+class MediaManager {
+ public:
+ virtual void PlayA2DPSource(int32_t application_key) = 0;
+ virtual void StopA2DPSource(int32_t application_key) = 0;
+
+ virtual void StartMicrophoneRecording(int32_t application_key,
+ const std::string& outputFileName,
+ int32_t duration) = 0;
+ virtual void StopMicrophoneRecording(int32_t application_key) = 0;
+
+ virtual void StartStreaming(int32_t application_key,
+ protocol_handler::ServiceType service_type) = 0;
+ virtual void StopStreaming(int32_t application_key,
+ protocol_handler::ServiceType service_type) = 0;
+ virtual void FramesProcessed(int32_t application_key,
+ int32_t frame_number) = 0;
+ /**
+ * \brief Media manager settings getter
+ * \return pointer to media manager settings class
+ */
+ virtual const MediaManagerSettings& settings() const = 0;
+
+ virtual ~MediaManager() {}
+};
+
+} // namespace media_manager
+
+#endif // SRC_COMPONENTS_INCLUDE_MEDIA_MANAGER_MEDIA_MANAGER_H_
diff --git a/src/components/include/policy/policy_external/policy/policy_listener.h b/src/components/include/policy/policy_external/policy/policy_listener.h
new file mode 100644
index 0000000000..e850a3fa2b
--- /dev/null
+++ b/src/components/include/policy/policy_external/policy/policy_listener.h
@@ -0,0 +1,180 @@
+/*
+ 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_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_LISTENER_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_LISTENER_H_
+
+#include <queue>
+
+#include "policy/policy_types.h"
+#include "utils/custom_string.h"
+
+namespace policy {
+
+namespace custom_str = utils::custom_string;
+
+class PolicyListener {
+ public:
+ virtual ~PolicyListener() {}
+ virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ const Permissions& permissions,
+ const policy::HMILevel& default_hmi) = 0;
+ virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ const Permissions& permissions) = 0;
+ virtual void OnPendingPermissionChange(const std::string& policy_app_id) = 0;
+ virtual void OnUpdateStatusChanged(const std::string&) = 0;
+
+ /**
+ * Gets device ID
+ * @param policy_app_id
+ * @return device ID
+ * @deprecated see std::vector<std::string> GetDevicesIds(const std::string&)
+ */
+ virtual std::string OnCurrentDeviceIdUpdateRequired(
+ const std::string& policy_app_id) = 0;
+ virtual void OnSystemInfoUpdateRequired() = 0;
+ virtual custom_str::CustomString GetAppName(
+ const std::string& policy_app_id) = 0;
+ virtual void OnUpdateHMIAppType(
+ std::map<std::string, StringArray> app_hmi_types) = 0;
+
+ /**
+ * @brief CanUpdate allows to find active application
+ * and check whether related device consented.
+ *
+ * @return true if there are at least one application has been registered
+ * with consented device.
+ */
+ virtual bool CanUpdate() = 0;
+
+ /**
+ * @brief OnSnapshotCreated the notification which will be sent
+ * when snapshot for PTU has been created.
+ *
+ * @param pt_string the snapshot
+ *
+ * @param retry_seconds retry sequence timeouts.
+ *
+ * @param timeout_exceed timeout.
+ */
+ virtual void OnSnapshotCreated(const BinaryMessage& pt_string,
+ const std::vector<int>& retry_seconds,
+ uint32_t timeout_exceed) = 0;
+
+ /**
+ * @brief Make appropriate changes for related applications permissions and
+ * notify them, if it possible
+ * @param device_id Unique device id, which consent had been changed
+ * @param device_consent Device consent, which is done by user
+ */
+ virtual void OnDeviceConsentChanged(const std::string& device_id,
+ bool is_allowed) = 0;
+
+ /**
+ * @brief Sends OnAppPermissionsChanged notification to HMI
+ * @param permissions contains parameter for OnAppPermisionChanged
+ * @param policy_app_id contains policy application id
+ */
+ virtual void SendOnAppPermissionsChanged(
+ const AppPermissions& permissions,
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief GetAvailableApps allows to obtain list of registered applications.
+ */
+ virtual void GetAvailableApps(std::queue<std::string>&) = 0;
+
+ /**
+ * @brief OnCertificateUpdated the callback which signals if certificate field
+ * has been updated during PTU
+ *
+ * @param certificate_data the value of the updated field.
+ */
+ virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
+
+ /**
+ * @brief OnPTUFinishedd the callback which signals PTU has finished
+ *
+ * @param ptu_result the result from the PTU - true if successful,
+ * otherwise false.
+ */
+ virtual void OnPTUFinished(const bool ptu_result) = 0;
+
+ /**
+ * @brief Collects currently registered applications ids linked to their
+ * device id
+ * @return Collection of device_id-to-app_id links
+ */
+ virtual void GetRegisteredLinks(
+ std::map<std::string, std::string>& out_links) const = 0;
+
+#ifdef SDL_REMOTE_CONTROL
+ /**
+ * Gets devices ids by policy application id
+ * @param policy_app_id
+ * @return list devices ids
+ */
+ virtual std::vector<std::string> GetDevicesIds(
+ const std::string& policy_app_id) = 0;
+
+ /**
+ * Notifies about changing HMI level
+ * @param device_id unique identifier of device
+ * @param policy_app_id unique identifier of application in policy
+ * @param hmi_level default HMI level for this application
+ */
+ virtual void OnUpdateHMILevel(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level) = 0;
+
+ /**
+ * @brief Notifies Remote apps about change in permissions
+ * @param device_id Device on which app is running
+ * @param application_id ID of app whose permissions are changed
+ */
+ virtual void OnRemoteAppPermissionsChanged(
+ const std::string& device_id, const std::string& application_id) = 0;
+
+ /**
+ * Notifies about changing HMI status
+ * @param device_id unique identifier of device
+ * @param policy_app_id unique identifier of application in policy
+ * @param hmi_level default HMI level for this application
+ */
+ virtual void OnUpdateHMIStatus(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level) = 0;
+
+#endif // SDL_REMOTE_CONTROL
+};
+} // namespace policy
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_LISTENER_H_
diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h
new file mode 100644
index 0000000000..24905671fa
--- /dev/null
+++ b/src/components/include/policy/policy_external/policy/policy_manager.h
@@ -0,0 +1,655 @@
+/*
+ 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_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_MANAGER_H_
+
+#include <vector>
+
+#include "utils/callable.h"
+
+#include "policy/policy_types.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_listener.h"
+#include "policy/usage_statistics/statistics_manager.h"
+
+#ifdef SDL_REMOTE_CONTROL
+#include "policy/access_remote.h"
+#endif // SDL_REMOTE_CONTROL
+
+namespace policy {
+class PolicySettings;
+typedef utils::SharedPtr<utils::Callable> StatusNotifier;
+
+class PolicyManager : public usage_statistics::StatisticsManager {
+ public:
+ /**
+ * @brief The NotificationMode enum defines whether application will be
+ * notified about changes done (e.g. after consents were changed) or not
+ */
+ enum NotificationMode { kSilentMode, kNotifyApplicationMode };
+ virtual ~PolicyManager() {}
+
+ /**
+ * @brief set_listener set new policy listener instance
+ * @param listener new policy listener
+ */
+ virtual void set_listener(PolicyListener* listener) = 0;
+
+ /**
+ * @brief Inits Policy Table
+ * @param file_name path to preloaded PT file
+ * @param settings pointer to policy init settings
+ * @return true if init is successful
+ */
+ virtual bool InitPT(const std::string& file_name,
+ const PolicySettings* settings) = 0;
+
+ /**
+ * @brief Updates Policy Table from binary message received from
+ * mobile device. Saves to Policy Table diff between Policy Table
+ * sent in snapshot and received Policy Table.
+ * @param file name of file with update policy table
+ * @param pt_content PTU as binary string
+ * @return true if successfully
+ */
+ virtual bool LoadPT(const std::string& file,
+ const BinaryMessage& pt_content) = 0;
+
+ /**
+ * @brief Resets Policy Table
+ * @param file_name Path to preloaded PT file
+ * @return true if successfully
+ */
+ virtual bool ResetPT(const std::string& file_name) = 0;
+
+ /**
+ * @brief Gets last URL for sending PTS to from PT itself
+ * @param service_type Service specifies user of URL
+ * @return last URL or empty string if endpoint entry is empty
+ */
+ virtual std::string GetUpdateUrl(int service_type) = 0;
+
+ /**
+ * @brief Gets all URLs for sending PTS to from PT itself.
+ * @param service_type Service specifies user of URL
+ * @return vector of urls
+ */
+ virtual void GetUpdateUrls(const uint32_t service_type,
+ EndpointUrls& out_end_points) = 0;
+ virtual void GetUpdateUrls(const std::string& service_type,
+ EndpointUrls& out_end_points) = 0;
+
+ /**
+ * @brief GetLockScreenIcon allows to obtain lock screen icon url;
+ * @return url which point to the resourse where lock screen icon could be
+ *obtained.
+ */
+ virtual std::string GetLockScreenIconUrl() const = 0;
+
+ /**
+ * @brief PTU is needed, for this PTS has to be formed and sent.
+ */
+ virtual void RequestPTUpdate() = 0;
+
+ /**
+ * @brief Check if specified RPC for specified application
+ * has permission to be executed in specified HMI Level
+ * and also its permitted params.
+ * @param app_id Id of application provided during registration
+ * @param hmi_level Current HMI Level of application
+ * @param rpc Name of RPC
+ * @param rpc_params List of RPC params
+ * @param CheckPermissionResult containing flag if HMI Level is allowed
+ * and list of allowed params.
+ */
+ virtual void CheckPermissions(const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ const RPCParams& rpc_params,
+ CheckPermissionResult& result) = 0;
+
+ /**
+ * @brief Clear all record of user consents. Used during Factory Reset.
+ * @return bool Success of operation
+ */
+ virtual bool ResetUserConsent() = 0;
+
+ /**
+ * @brief Returns current status of policy table for HMI
+ * @return Current status of policy table
+ */
+ virtual std::string GetPolicyTableStatus() const = 0;
+
+ /**
+ * @brief Checks is PT exceeded kilometers
+ * @param kilometers current kilometers at odometer
+ * @return true if exceeded
+ */
+ virtual void KmsChanged(int kilometers) = 0;
+
+ /**
+ * @brief Increments counter of ignition cycles
+ */
+ virtual void IncrementIgnitionCycles() = 0;
+
+ /**
+ * @brief Exchange by hmi or mobile request
+ * @return Current status of policy table
+ */
+ virtual std::string ForcePTExchange() = 0;
+
+ /**
+ * @brief Exchange by user request
+ * @return Current status of policy table
+ */
+ virtual std::string ForcePTExchangeAtUserRequest() = 0;
+
+ /**
+ * @brief Resets retry sequence
+ */
+ virtual void ResetRetrySequence() = 0;
+
+ /**
+ * @brief Gets timeout to wait before next retry updating PT
+ * If timeout is less or equal to zero then the retry sequence is not need.
+ * @return timeout in seconds
+ */
+ virtual int NextRetryTimeout() = 0;
+
+ /**
+ * @brief Gets timeout to wait until receive response
+ * @return timeout in seconds
+ */
+ virtual uint32_t TimeoutExchangeMSec() = 0;
+
+ /**
+ * @brief List of timeouts in seconds between retries
+ * when attempt to update PT fails
+ * @return List of delays between attempts.
+ */
+ virtual const std::vector<int> RetrySequenceDelaysSeconds() = 0;
+
+ /**
+ * @brief Handler of exceeding timeout of exchanging policy table
+ */
+ virtual void OnExceededTimeout() = 0;
+
+ /**
+ * @brief Handler of PTS sending out
+ */
+ virtual void OnUpdateStarted() = 0;
+
+ /**
+ * @brief Gets user consent for mobile device data connection
+ * @param device_id Unique device identifier
+ * @return status of device consent
+ */
+ virtual DeviceConsent GetUserConsentForDevice(
+ const std::string& device_id) const = 0;
+
+ /**
+ * @brief Gets user consent for application
+ * @param device_id Device id
+ * @param policy_app_id Unique application id
+ * @param permissions Array of functional groups permissions
+ */
+ virtual void GetUserConsentForApp(
+ const std::string& device_id,
+ const std::string& policy_app_id,
+ std::vector<FunctionalGroupPermission>& permissions) = 0;
+
+ /**
+ * @brief Set user consent for mobile device data connection
+ * @param device_id Unique device identifier
+ * @param is_allowed User consent for usage device data connection
+ */
+ virtual void SetUserConsentForDevice(const std::string& device_id,
+ const bool is_allowed) = 0;
+
+ /**
+ * @brief Update Application Policies as reaction
+ * on User allowing/disallowing device this app is running on.
+ * @param app_id Unique application id
+ * @param is_device_allowed true if user allowing device otherwise false
+ * @return true if operation was successful
+ */
+ virtual bool ReactOnUserDevConsentForApp(const std::string& app_id,
+ const bool is_device_allowed) = 0;
+
+ /**
+ * @brief Sets counter value that passed for receiving PT UPdate.
+ */
+ virtual void PTUpdatedAt(Counters counter, int value) = 0;
+
+ /**
+ * @brief Retrieves data from app_policies about app on its registration:
+ * @param application_id - id of registered app
+ * @param nicknames Synonyms for application
+ * @param app_hmi_types Section on HMI where app can appear (Navigation, Phone
+ * etc)
+ */
+ virtual bool GetInitialAppData(const std::string& application_id,
+ StringArray* nicknames = NULL,
+ StringArray* app_hmi_types = NULL) = 0;
+
+ /**
+ * @brief Add's device to policy table
+ * @param device_id Device mac address
+ * @param connection_type Device connection type
+ */
+ virtual void AddDevice(const std::string& device_id,
+ const std::string& connection_type) = 0;
+
+ /**
+ * @brief Stores device parameters received during application registration
+ * to policy table
+ * @param device_id Device mac address
+ * @param device_info Received device parameters
+ */
+ virtual void SetDeviceInfo(const std::string& device_id,
+ const DeviceInfo& device_info) = 0;
+
+ /**
+ * @brief Set user consent for application functional groups
+ * @param permissions User-defined application group pemissions.
+ * The permissions is not const reference because it may contains
+ * valid data as well as invalid. So we will remove all invalid data
+ * from this structure.
+ * @param mode notification mode
+ */
+ virtual void SetUserConsentForApp(const PermissionConsent& permissions,
+ const NotificationMode mode) = 0;
+
+ /**
+ * @brief Get default HMI level for application
+ * @param policy_app_id Unique application id
+ * @param default_hmi Default HMI level for application or empty, if value
+ * was not set
+ * @return true, if succedeed, otherwise - false
+ */
+ virtual bool GetDefaultHmi(const std::string& policy_app_id,
+ std::string* default_hmi) const = 0;
+
+ /**
+ * @brief Get priority for application
+ * @param policy_app_id Unique application id
+ * @param priority Priority for application or empty, if value was not set
+ * @return true, if succedeed, otherwise - false
+ */
+ virtual bool GetPriority(const std::string& policy_app_id,
+ std::string* priority) const = 0;
+
+ /**
+ * @brief Get user friendly messages for given RPC messages and language
+ * @param message_codes RPC message codes
+ * @param language Language
+ * @param active_hmi_language Currently active language
+ * @return Array of structs with appropriate message parameters
+ */
+ virtual std::vector<UserFriendlyMessage> GetUserFriendlyMessages(
+ const std::vector<std::string>& message_code,
+ const std::string& language,
+ const std::string& active_hmi_language) = 0;
+
+ /**
+ * @brief Checks if the application is revoked
+ * @param app_id application id
+ * @return true if application is revoked
+ */
+ virtual bool IsApplicationRevoked(const std::string& app_id) const = 0;
+
+ /**
+ * @brief Get resulting RPCs permissions for application which started on
+ * specific device
+ * @param device_id Device id
+ * @param policy_app_id Unique application id
+ * @param permissions Array of functional groups permissions
+ */
+ virtual void GetPermissionsForApp(
+ const std::string& device_id,
+ const std::string& policy_app_id,
+ std::vector<FunctionalGroupPermission>& permissions) = 0;
+
+ /**
+ * @brief Gets specific application permissions changes since last policy
+ * table update
+ * @param policy_app_id Unique application id
+ * @return Permissions changes
+ */
+ virtual AppPermissions GetAppPermissionsChanges(
+ const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Removes specific application permissions changes
+ * @param app_id Unique application id
+ */
+ virtual void RemovePendingPermissionChanges(const std::string& app_id) = 0;
+
+ /**
+ * @brief Return device id, which hosts specific application
+ * @param policy_app_id Application id, which is required to update device id
+ */
+ virtual std::string& GetCurrentDeviceId(
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Set current system language
+ * @param language Language
+ */
+ virtual void SetSystemLanguage(const std::string& language) = 0;
+
+ /**
+ * @brief Set data from GetSystemInfo response to policy table
+ * @param ccpu_version CCPU version
+ * @param wers_country_code WERS country code
+ * @param language System language
+ */
+ virtual void SetSystemInfo(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language) = 0;
+
+ /**
+ * @brief Send OnPermissionsUpdated for choosen application
+ * @param application_id Unique application id
+ */
+ virtual void SendNotificationOnPermissionsUpdated(
+ const std::string& application_id) = 0;
+
+ /**
+ * @brief Marks device as upaired
+ * @param device_id id device
+ */
+ virtual void MarkUnpairedDevice(const std::string& device_id) = 0;
+
+ /**
+ * @brief Adds, application to the db or update existed one
+ * run PTU if policy update is necessary for application.
+ * @param application_id Unique application id
+ * @param hmi_types application HMI types
+ * @return function that will notify update manager about new application
+ */
+ virtual StatusNotifier AddApplication(
+ const std::string& application_id,
+ const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0;
+
+ /**
+ * @brief Removes unpaired device records and related records from DB
+ * @return true, if succedeed, otherwise - false
+ */
+ virtual bool CleanupUnpairedDevices() = 0;
+
+ /**
+ * @brief Check if app can keep context.
+ * @param app_id Unique application id
+ * @return true if app can keep context, otherwise - false
+ */
+ virtual bool CanAppKeepContext(const std::string& app_id) const = 0;
+
+ /**
+ * @brief Check if app can steal focus.
+ * @param app_id Unique application id
+ * @return true if app can steal focus, otherwise - false
+ */
+ virtual bool CanAppStealFocus(const std::string& app_id) const = 0;
+
+ /**
+ * @brief Runs necessary operations, which is depends on external system
+ * state, e.g. getting system-specific parameters which are need to be
+ * filled into policy table
+ */
+ virtual void OnSystemReady() = 0;
+
+ /**
+ * @brief Get number of notification by priority
+ * @param priority Specified priority
+ * @return notification number
+ */
+ virtual uint32_t GetNotificationsNumber(
+ const std::string& priority) const = 0;
+
+ /**
+ * @brief Allows to update Vehicle Identification Number in policy table.
+ * @param new value for the parameter.
+ */
+ virtual void SetVINValue(const std::string& value) = 0;
+
+ /**
+ * @brief Checks, if application has policy assigned w/o data consent
+ * @param policy_app_id Unique application id
+ * @return true, if policy assigned w/o data consent, otherwise -false
+ */
+ virtual bool IsPredataPolicy(const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Returns heart beat timeout
+ * @param app_id application id
+ * @return if timeout was set then value in milliseconds greater zero
+ * otherwise heart beat for specific application isn't set
+ */
+ virtual uint32_t HeartBeatTimeout(const std::string& app_id) const = 0;
+
+ /**
+ * @brief SaveUpdateStatusRequired allows to save update status.
+ * @param is_update_needed true if update needed
+ */
+ virtual void SaveUpdateStatusRequired(bool is_update_needed) = 0;
+
+ /**
+ * @brief Handler on applications search started
+ */
+ virtual void OnAppsSearchStarted() = 0;
+
+ /**
+ * @brief Handler on applications search completed
+ * @param trigger_ptu contains true if PTU should be triggered
+ */
+ virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0;
+
+ /**
+ * @brief OnAppRegisteredOnMobile allows to handle event when application were
+ * succesfully registered on mobile device.
+ * It will send OnAppPermissionSend notification and will try to start PTU. *
+ * @param application_id registered application.
+ */
+ virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0;
+
+ virtual void OnDeviceSwitching(const std::string& device_id_from,
+ const std::string& device_id_to) = 0;
+
+ /**
+ * @brief Gets request types for application
+ * @param policy_app_id Unique application id
+ * @return request types of application
+ */
+ virtual const std::vector<std::string> GetAppRequestTypes(
+ const std::string policy_app_id) const = 0;
+
+ /**
+ * @brief Get information about vehicle
+ * @return vehicle information
+ */
+ virtual const VehicleInfo GetVehicleInfo() const = 0;
+
+ /**
+ * @brief Gets meta information
+ * @return meta information
+ */
+ virtual const MetaInfo GetMetaInfo() const = 0;
+
+ /**
+ * @brief RetrieveCertificate Allows to obtain certificate in order
+ * to start secure connection.
+ * @return The certificate in PKCS#7 format.
+ */
+ virtual std::string RetrieveCertificate() const = 0;
+
+ /**
+ * @brief HasCertificate check whether policy table has certificate
+ * int module_config section.
+ * @return true in case certificate exists, false otherwise
+ */
+ virtual bool HasCertificate() const = 0;
+
+ /**
+ * @brief Sets decrypted certificate in policy table
+ * @param certificate content of certificate
+ */
+ virtual void SetDecryptedCertificate(const std::string& certificate) = 0;
+
+ /**
+ * @brief Getter for policy settings
+ * @return policy settings instance
+ */
+ virtual const PolicySettings& get_settings() const = 0;
+
+ /**
+ * @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
+ */
+ virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0;
+
+#ifdef SDL_REMOTE_CONTROL
+ /**
+ * @brief Assigns new HMI types for specified application
+ * @param application_id Unique application id
+ * @param hmi_types new HMI types list
+ */
+ virtual void SetDefaultHmiTypes(const std::string& application_id,
+ const std::vector<int>& hmi_types) = 0;
+ /**
+ * @brief Gets HMI types
+ * @param application_id ID application
+ * @param app_types list to save HMI types
+ * @return true if policy has specific policy for this application
+ */
+ virtual bool GetHMITypes(const std::string& application_id,
+ std::vector<int>* app_types) = 0;
+
+ /**
+ * @brief Checks if module for application is present in policy table
+ * @param app_id id of application
+ * @param module type
+ * @return true if module is present, otherwise - false
+ */
+ virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0;
+
+ /**
+ * @brief Send OnPermissionsChange notification to mobile app
+ * when it's permissions are changed.
+ * @param device_id Device on which app is running
+ * @param application_id ID of app whose permissions are changed
+ */
+ virtual void SendAppPermissionsChanged(const std::string& device_id,
+ const std::string& application_id) = 0;
+
+ /**
+ * @brief Gets all allowed module types
+ * @param policy_app_id unique identifier of application
+ * @param modules list of allowed module types
+ * @return true if application has allowed modules
+ */
+ virtual bool GetModuleTypes(const std::string& policy_app_id,
+ std::vector<std::string>* modules) const = 0;
+
+ /**
+ * @brief Setter for access_remote instance
+ * @param access_remote pointer to new access_remote instance
+ */
+ virtual void set_access_remote(
+ utils::SharedPtr<AccessRemote> access_remote) = 0;
+#endif // SDL_REMOTE_CONTROL
+
+ /**
+ * @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
+ * application index
+ * @param rs contains the application index and url index from the
+ * urls vector that are to be sent on the next OnSystemRequest
+ * @param urls vector of vectors that contain urls for each application
+ * @return Pair of application index and url index
+ */
+ virtual AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs,
+ const EndpointUrls& urls) const = 0;
+
+ /**
+ * @brief Checks, if SDL needs to update it's policy table section
+ "external_consent_status"
+ * @param ExternalConsent status
+ * @return true if such check is needed, false - if not.
+ */
+ virtual bool IsNeedToUpdateExternalConsentStatus(
+ const ExternalConsentStatus& status) const = 0;
+
+ /**
+ * @brief Saves customer connectivity settings status
+ * @param status ExternalConsent status
+ * @return true if succeeded, otherwise - false
+ */
+ virtual bool SetExternalConsentStatus(
+ const ExternalConsentStatus& status) = 0;
+
+ /**
+ * @brief Gets customer connectivity settings status
+ * @return ExternalConsent status
+ */
+ virtual ExternalConsentStatus GetExternalConsentStatus() = 0;
+
+ protected:
+ /**
+ * @brief Checks is PT exceeded IgnitionCycles
+ * @return true if exceeded
+ */
+ virtual bool ExceededIgnitionCycles() = 0;
+
+ /**
+ * @brief Checks is PT exceeded days
+ * @return true if exceeded
+ */
+ virtual bool ExceededDays() = 0;
+
+ /**
+ * @brief StartPTExchange allows to start PTU. The function will check
+ * if one is required and starts the update flow in only case when previous
+ * condition is true.
+ */
+ virtual void StartPTExchange() = 0;
+};
+
+} // namespace policy
+
+extern "C" policy::PolicyManager* CreateManager();
+extern "C" void DeleteManager(policy::PolicyManager*);
+
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_POLICY_MANAGER_H_
diff --git a/src/components/include/policy/policy_settings.h b/src/components/include/policy/policy_external/policy/policy_settings.h
index 7e5b7d6f93..def9fca05a 100644
--- a/src/components/include/policy/policy_settings.h
+++ b/src/components/include/policy/policy_external/policy/policy_settings.h
@@ -1,5 +1,5 @@
-#ifndef POLICY_HANDLER_SETTINGS_H
-#define POLICY_HANDLER_SETTINGS_H
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
#include <string>
#include <stdint.h>
@@ -39,4 +39,4 @@ class PolicySettings {
virtual ~PolicySettings() {}
};
} // namespace policy
-#endif // POLICY_HANDLER_SETTINGS_H
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
diff --git a/src/components/include/policy/policy_external/policy/usage_statistics/app_stopwatch.h b/src/components/include/policy/policy_external/policy/usage_statistics/app_stopwatch.h
new file mode 100644
index 0000000000..3f01a30a62
--- /dev/null
+++ b/src/components/include/policy/policy_external/policy/usage_statistics/app_stopwatch.h
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
+
+#include "policy/usage_statistics/statistics_manager.h"
+
+namespace usage_statistics {
+
+class AppStopwatch {
+ public:
+ virtual ~AppStopwatch() {}
+ virtual void Start(AppStopwatchId stopwatch_type) = 0;
+ virtual void Switch(AppStopwatchId stopwatch_type) = 0;
+ virtual void WriteTime() = 0;
+};
+
+} // namespace usage_statistics
+
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
diff --git a/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h b/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h
new file mode 100644
index 0000000000..7186400ff4
--- /dev/null
+++ b/src/components/include/policy/policy_external/policy/usage_statistics/statistics_manager.h
@@ -0,0 +1,111 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
+
+#include <stdint.h>
+#include <string>
+
+namespace usage_statistics {
+
+enum GlobalCounterId {
+ GLOBAL_COUNTER_NONE,
+ IAP_BUFFER_FULL,
+ SYNC_OUT_OF_MEMORY,
+ SYNC_REBOOTS
+};
+
+enum AppInfoId { APP_INFO_NONE, LANGUAGE_GUI, LANGUAGE_VUI };
+
+enum AppStopwatchId {
+ STOPWATCH_NONE,
+ SECONDS_HMI_FULL,
+ SECONDS_HMI_LIMITED,
+ SECONDS_HMI_BACKGROUND,
+ SECONDS_HMI_NONE
+};
+
+enum AppCounterId {
+ APP_COUNTER_NONE,
+ USER_SELECTIONS,
+ REJECTIONS_SYNC_OUT_OF_MEMORY,
+ REJECTIONS_NICKNAME_MISMATCH,
+ REJECTIONS_DUPLICATE_NAME,
+ REJECTED_RPC_CALLS,
+ RPCS_IN_HMI_NONE,
+ REMOVALS_MISBEHAVED,
+ RUN_ATTEMPTS_WHILE_REVOKED,
+ COUNT_OF_TLS_ERRORS,
+};
+
+class StatisticsManager {
+ public:
+ virtual ~StatisticsManager() {}
+
+ /**
+ * @brief Increments global counter
+ * @param type counter type
+ */
+ virtual void Increment(GlobalCounterId type) = 0;
+
+ /**
+ * @brief Increments specified application counter
+ * @param app_id Unique ID of application
+ * @param type application counter type
+ */
+ virtual void Increment(const std::string& app_id, AppCounterId type) = 0;
+
+ /**
+ * @brief Sets specified application info value
+ * @param app_id Unique ID of application
+ * @param type application info type
+ * @param value new value for counter
+ */
+ virtual void Set(const std::string& app_id,
+ AppInfoId type,
+ const std::string& value) = 0;
+
+ /**
+ * @brief Add seconds for specified application stopwatch
+ * @param app_id Unique ID of application
+ * @param type application stopwatch type
+ * @param timespan_seconds seconds to add
+ */
+ virtual void Add(const std::string& app_id,
+ AppStopwatchId type,
+ int32_t timespan_seconds) = 0;
+};
+
+} // namespace usage_statistics
+
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_EXTERNAL_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
diff --git a/src/components/include/policy/policy_regular/policy/policy_listener.h b/src/components/include/policy/policy_regular/policy/policy_listener.h
new file mode 100644
index 0000000000..e8de37d5de
--- /dev/null
+++ b/src/components/include/policy/policy_regular/policy/policy_listener.h
@@ -0,0 +1,155 @@
+/*
+ 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_LISTENER_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_LISTENER_H_
+
+#include <queue>
+
+#include "policy/policy_types.h"
+#include "utils/custom_string.h"
+
+namespace policy {
+
+namespace custom_str = utils::custom_string;
+
+class PolicyListener {
+ public:
+ virtual ~PolicyListener() {}
+ virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ const Permissions& permissions,
+ const policy::HMILevel& default_hmi) = 0;
+ virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ const Permissions& permissions) = 0;
+ virtual void OnPendingPermissionChange(const std::string& policy_app_id) = 0;
+ virtual void OnUpdateStatusChanged(const std::string&) = 0;
+ virtual std::string OnCurrentDeviceIdUpdateRequired(
+ const std::string& policy_app_id) = 0;
+ virtual void OnSystemInfoUpdateRequired() = 0;
+ virtual custom_str::CustomString GetAppName(
+ const std::string& policy_app_id) = 0;
+ virtual void OnUpdateHMIAppType(
+ std::map<std::string, StringArray> app_hmi_types) = 0;
+
+ /**
+ * @brief CanUpdate allows to find active application
+ * and check whether related device consented.
+ *
+ * @return true if there are at least one application has been registered
+ * with consented device.
+ */
+ virtual bool CanUpdate() = 0;
+
+ /**
+ * @brief OnSnapshotCreated the notification which will be sent
+ * when snapshot for PTU has been created.
+ *
+ * @param pt_string the snapshot
+ *
+ * @param retry_seconds retry sequence timeouts.
+ *
+ * @param timeout_exceed timeout.
+ */
+ virtual void OnSnapshotCreated(const BinaryMessage& pt_string) = 0;
+
+ /**
+ * @brief Make appropriate changes for related applications permissions and
+ * notify them, if it possible
+ * @param device_id Unique device id, which consent had been changed
+ * @param device_consent Device consent, which is done by user
+ */
+ virtual void OnDeviceConsentChanged(const std::string& device_id,
+ bool is_allowed) = 0;
+
+ /**
+ * @brief Sends OnAppPermissionsChanged notification to HMI
+ * @param permissions contains parameter for OnAppPermisionChanged
+ * @param policy_app_id contains policy application id
+ */
+ virtual void SendOnAppPermissionsChanged(
+ const AppPermissions& permissions,
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief GetAvailableApps allows to obtain list of registered applications.
+ */
+ virtual void GetAvailableApps(std::queue<std::string>&) = 0;
+
+ /**
+ * @brief OnCertificateUpdated the callback which signals if certificate field
+ * has been updated during PTU
+ *
+ * @param certificate_data the value of the updated field.
+ */
+ virtual void OnCertificateUpdated(const std::string& certificate_data) = 0;
+
+#ifdef SDL_REMOTE_CONTROL
+ /**
+ * Gets devices ids by policy application id
+ * @param policy_app_id
+ * @return list devices ids
+ */
+ virtual std::vector<std::string> GetDevicesIds(
+ const std::string& policy_app_id) = 0;
+
+ /**
+ * Notifies about changing HMI level
+ * @param device_id unique identifier of device
+ * @param policy_app_id unique identifier of application in policy
+ * @param hmi_level default HMI level for this application
+ */
+ virtual void OnUpdateHMILevel(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level) = 0;
+
+ /**
+ * @brief Notifies Remote apps about change in permissions
+ * @param device_id Device on which app is running
+ * @param application_id ID of app whose permissions are changed
+ */
+ virtual void OnRemoteAppPermissionsChanged(
+ const std::string& device_id, const std::string& application_id) = 0;
+
+ /**
+ * Notifies about changing HMI status
+ * @param device_id unique identifier of device
+ * @param policy_app_id unique identifier of application in policy
+ * @param hmi_level default HMI level for this application
+ */
+ virtual void OnUpdateHMIStatus(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level) = 0;
+
+#endif // SDL_REMOTE_CONTROL
+};
+} // namespace policy
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_LISTENER_H_
diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h
new file mode 100644
index 0000000000..3e90cfc094
--- /dev/null
+++ b/src/components/include/policy/policy_regular/policy/policy_manager.h
@@ -0,0 +1,610 @@
+/*
+ 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_
+
+#include <vector>
+#include <cstdint>
+
+#include "utils/callable.h"
+#include "policy/policy_types.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_listener.h"
+#include "policy/usage_statistics/statistics_manager.h"
+#ifdef SDL_REMOTE_CONTROL
+#include "policy/access_remote.h"
+#endif // SDL_REMOTE_CONTROL
+
+namespace policy {
+class PolicySettings;
+typedef utils::SharedPtr<utils::Callable> StatusNotifier;
+
+class PolicyManager : public usage_statistics::StatisticsManager {
+ public:
+ virtual ~PolicyManager() {}
+
+ /**
+ * @brief set_listener set new policy listener instance
+ * @param listener new policy listener
+ */
+ virtual void set_listener(PolicyListener* listener) = 0;
+
+ /**
+ * @brief Inits Policy Table
+ * @param file_name path to preloaded PT file
+ * @param settings pointer to policy init settings
+ * @return true if init is successful
+ */
+ virtual bool InitPT(const std::string& file_name,
+ const PolicySettings* settings) = 0;
+
+ /**
+ * @brief Updates Policy Table from binary message received from
+ * mobile device. Saves to Policy Table diff between Policy Table
+ * sent in snapshot and received Policy Table.
+ * @param file name of file with update policy table
+ * @param pt_content PTU as binary string
+ * @return true if successfully
+ */
+ virtual bool LoadPT(const std::string& file,
+ const BinaryMessage& pt_content) = 0;
+
+ /**
+ * @brief Resets Policy Table
+ * @param file_name Path to preloaded PT file
+ * @return true if successfully
+ */
+ virtual bool ResetPT(const std::string& file_name) = 0;
+
+ /**
+ * @brief GetLockScreenIcon allows to obtain lock screen icon url;
+ * @return url which point to the resourse where lock screen icon could be
+ *obtained.
+ */
+ virtual std::string GetLockScreenIconUrl() const = 0;
+
+ /**
+ * @brief Gets all URLs for sending PTS to from PT itself.
+ * @param service_type Service specifies user of URL
+ * @param out_end_points output vector of urls
+ */
+ virtual void GetUpdateUrls(const std::string& service_type,
+ EndpointUrls& out_end_points) = 0;
+ virtual void GetUpdateUrls(const uint32_t service_type,
+ EndpointUrls& out_end_points) = 0;
+
+ /**
+ * @brief PTU is needed, for this PTS has to be formed and sent.
+ */
+ virtual bool RequestPTUpdate() = 0;
+
+ /**
+ * @brief Check if specified RPC for specified application
+ * has permission to be executed in specified HMI Level
+ * and also its permitted params.
+ * @param device_id Id of device of application
+ * @param app_id Id of application provided during registration
+ * @param hmi_level Current HMI Level of application
+ * @param rpc Name of RPC
+ * @param rpc_params List of RPC params
+ * @param result containing flag if HMI Level is allowed and list of
+ * allowed params.
+ */
+ virtual void CheckPermissions(const PTString& device_id,
+ const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ const RPCParams& rpc_params,
+ CheckPermissionResult& result) = 0;
+
+ /**
+ * @brief Changes isConsentNeeded for app pending permissions, in case
+ * user set permissions before app activation.
+ * @param Unique app id
+ * @param Current permissions for app
+ */
+ virtual void CheckPendingPermissionsChanges(
+ const std::string& policy_app_id,
+ const std::vector<FunctionalGroupPermission>& current_permissions) = 0;
+
+ /**
+ * @brief Clear all record of user consents. Used during Factory Reset.
+ * @return bool Success of operation
+ */
+ virtual bool ResetUserConsent() = 0;
+
+ /**
+ * @brief Returns current status of policy table for HMI
+ * @return Current status of policy table
+ */
+ virtual std::string GetPolicyTableStatus() const = 0;
+
+ /**
+ * @brief Checks is PT exceeded kilometers
+ * @param kilometers current kilometers at odometer
+ * @return true if exceeded
+ */
+ virtual void KmsChanged(int kilometers) = 0;
+
+ /**
+ * @brief Increments counter of ignition cycles
+ */
+ virtual void IncrementIgnitionCycles() = 0;
+
+ /**
+ * @brief Exchange by hmi or mobile request
+ * @return Current status of policy table
+ */
+ virtual std::string ForcePTExchange() = 0;
+
+ /**
+ * @brief Exchange by user request
+ * @return Current status of policy table
+ */
+ virtual std::string ForcePTExchangeAtUserRequest() = 0;
+
+ /**
+ * @brief Gets timeout to wait before next retry updating PT
+ * If timeout is less or equal to zero then the retry sequence is not need.
+ * @return timeout in seconds
+ */
+ virtual uint32_t NextRetryTimeout() = 0;
+
+ /**
+ * @brief Gets timeout to wait until receive response
+ * @return timeout in seconds
+ */
+ virtual uint32_t TimeoutExchangeMSec() = 0;
+
+ /**
+ * @brief List of timeouts in seconds between retries
+ * when attempt to update PT fails
+ * @return List of delays between attempts.
+ */
+ virtual const std::vector<int> RetrySequenceDelaysSeconds() = 0;
+
+ /**
+ * @brief Handler of exceeding timeout of exchanging policy table
+ */
+ virtual void OnExceededTimeout() = 0;
+
+ /**
+ * @brief Handler of PTS sending out
+ */
+ virtual void OnUpdateStarted() = 0;
+
+ /**
+ * @brief Gets user consent for mobile device data connection
+ * @param device_id Unique device identifier
+ * @return status of device consent
+ */
+ virtual DeviceConsent GetUserConsentForDevice(
+ const std::string& device_id) const = 0;
+
+ /**
+ * @brief Gets user consent for application
+ * @param device_id Device id
+ * @param policy_app_id Unique application id
+ * @param permissions Array of functional groups permissions
+ */
+ virtual void GetUserConsentForApp(
+ const std::string& device_id,
+ const std::string& policy_app_id,
+ std::vector<FunctionalGroupPermission>& permissions) = 0;
+
+ /**
+ * @brief Set user consent for mobile device data connection
+ * @param device_id Unique device identifier
+ * @param is_allowed User consent for usage device data connection
+ */
+ virtual void SetUserConsentForDevice(const std::string& device_id,
+ bool is_allowed) = 0;
+
+ /**
+ * @brief Update Application Policies as reaction
+ * on User allowing/disallowing device this app is running on.
+ * @param app_id Unique application id
+ * @param is_device_allowed true if user allowing device otherwise false
+ * @return true if operation was successful
+ */
+ virtual bool ReactOnUserDevConsentForApp(const std::string app_id,
+ bool is_device_allowed) = 0;
+
+ /**
+ * @brief Sets counter value that passed for receiving PT UPdate.
+ */
+ virtual void PTUpdatedAt(Counters counter, int value) = 0;
+
+ /**
+ * @brief Retrieves data from app_policies about app on its registration:
+ * @param application_id - id of registered app
+ * @param nicknames Synonyms for application
+ * @param app_hmi_types Section on HMI where app can appear (Navigation, Phone
+ * etc)
+ */
+ virtual bool GetInitialAppData(const std::string& application_id,
+ StringArray* nicknames = NULL,
+ StringArray* app_hmi_types = NULL) = 0;
+
+ /**
+ * @brief Add's device to policy table
+ * @param device_id Device mac address
+ * @param connection_type Device connection type
+ */
+ virtual void AddDevice(const std::string& device_id,
+ const std::string& connection_type) = 0;
+
+ /**
+ * @brief Stores device parameters received during application registration
+ * to policy table
+ * @param device_id Device mac address
+ * @param device_info Received device parameters
+ */
+ virtual void SetDeviceInfo(const std::string& device_id,
+ const DeviceInfo& device_info) = 0;
+
+ /**
+ * @brief Set user consent for application functional groups
+ * @param permissions User-defined application group pemissions.
+ * The permissions is not const reference because it may contains
+ * valid data as well as invalid. So we will remove all invalid data
+ * from this structure.
+ */
+ virtual void SetUserConsentForApp(const PermissionConsent& permissions) = 0;
+
+ /**
+ * @brief Get default HMI level for application
+ * @param policy_app_id Unique application id
+ * @param default_hmi Default HMI level for application or empty, if value
+ * was not set
+ * @return true, if succedeed, otherwise - false
+ */
+ virtual bool GetDefaultHmi(const std::string& policy_app_id,
+ std::string* default_hmi) const = 0;
+
+ /**
+ * @brief Get priority for application
+ * @param policy_app_id Unique application id
+ * @param priority Priority for application or empty, if value was not set
+ * @return true, if succedeed, otherwise - false
+ */
+ virtual bool GetPriority(const std::string& policy_app_id,
+ std::string* priority) const = 0;
+
+ /**
+ * @brief Get user friendly messages for given RPC messages and language
+ * @param message_codes RPC message codes
+ * @param language Language
+ * @return Array of structs with appropriate message parameters
+ */
+ virtual std::vector<UserFriendlyMessage> GetUserFriendlyMessages(
+ const std::vector<std::string>& message_code,
+ const std::string& language) = 0;
+
+ /**
+ * @brief Checks if the application is revoked
+ * @param app_id application id
+ * @return true if application is revoked
+ */
+ virtual bool IsApplicationRevoked(const std::string& app_id) const = 0;
+
+ /**
+ * @brief Get resulting RPCs permissions for application which started on
+ * specific device
+ * @param device_id Device id
+ * @param policy_app_id Unique application id
+ * @param permissions Array of functional groups permissions
+ */
+ virtual void GetPermissionsForApp(
+ const std::string& device_id,
+ const std::string& policy_app_id,
+ std::vector<FunctionalGroupPermission>& permissions) = 0;
+
+ /**
+ * @brief Gets specific application permissions changes since last policy
+ * table update
+ * @param policy_app_id Unique application id
+ * @return Permissions changes
+ */
+ virtual AppPermissions GetAppPermissionsChanges(
+ const std::string& policy_app_id) = 0;
+
+ /**
+ * @brief Removes specific application permissions changes
+ * @param app_id Unique application id
+ */
+ virtual void RemovePendingPermissionChanges(const std::string& app_id) = 0;
+
+ /**
+ * @brief Return device id, which hosts specific application
+ * @param policy_app_id Application id, which is required to update device id
+ */
+ virtual std::string& GetCurrentDeviceId(
+ const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Set current system language
+ * @param language Language
+ */
+ virtual void SetSystemLanguage(const std::string& language) = 0;
+
+ /**
+ * @brief Set data from GetSystemInfo response to policy table
+ * @param ccpu_version CCPU version
+ * @param wers_country_code WERS country code
+ * @param language System language
+ */
+ virtual void SetSystemInfo(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language) = 0;
+
+ /**
+ * @brief Send OnPermissionsUpdated for choosen application
+ * @param application_id Unique application id
+ */
+ virtual void SendNotificationOnPermissionsUpdated(
+ const std::string& application_id) = 0;
+
+ /**
+ * @brief Marks device as upaired
+ * @param device_id id device
+ */
+ virtual void MarkUnpairedDevice(const std::string& device_id) = 0;
+
+ /**
+ * @brief Adds, application to the db or update existed one
+ * run PTU if policy update is necessary for application.
+ * @param application_id Unique application id
+ * @param hmi_types application HMI types
+ * @return function that will notify update manager about new application
+ */
+ virtual StatusNotifier AddApplication(
+ const std::string& application_id,
+ const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) = 0;
+
+ /**
+ * @brief Removes unpaired device records and related records from DB
+ * @return true, if succedeed, otherwise - false
+ */
+ virtual bool CleanupUnpairedDevices() = 0;
+
+ /**
+ * @brief Check if app can keep context.
+ * @param app_id Unique application id
+ * @return true if app can keep context, otherwise - false
+ */
+ virtual bool CanAppKeepContext(const std::string& app_id) const = 0;
+
+ /**
+ * @brief Check if app can steal focus.
+ * @param app_id Unique application id
+ * @return true if app can steal focus, otherwise - false
+ */
+ virtual bool CanAppStealFocus(const std::string& app_id) const = 0;
+
+ /**
+ * @brief Runs necessary operations, which is depends on external system
+ * state, e.g. getting system-specific parameters which are need to be
+ * filled into policy table
+ */
+ virtual void OnSystemReady() = 0;
+
+ /**
+ * @brief Get number of notification by priority
+ * @param priority Specified priority
+ * @return notification number
+ */
+ virtual uint32_t GetNotificationsNumber(
+ const std::string& priority) const = 0;
+
+ /**
+ * @brief Allows to update Vehicle Identification Number in policy table.
+ * @param new value for the parameter.
+ */
+ virtual void SetVINValue(const std::string& value) = 0;
+
+ /**
+ * @brief Checks, if application has policy assigned w/o data consent
+ * @param policy_app_id Unique application id
+ * @return true, if policy assigned w/o data consent, otherwise -false
+ */
+ virtual bool IsPredataPolicy(const std::string& policy_app_id) const = 0;
+
+ /**
+ * @brief Returns heart beat timeout
+ * @param app_id application id
+ * @return if timeout was set then value in milliseconds greater zero
+ * otherwise heart beat for specific application isn't set
+ */
+ virtual uint32_t HeartBeatTimeout(const std::string& app_id) const = 0;
+
+ /**
+ * @brief SaveUpdateStatusRequired allows to save update status.
+ * @param is_update_needed true if update needed
+ */
+ virtual void SaveUpdateStatusRequired(bool is_update_needed) = 0;
+
+ /**
+ * @brief Handler on applications search started
+ */
+ virtual void OnAppsSearchStarted() = 0;
+
+ /**
+ * @brief Handler on applications search completed
+ * @param trigger_ptu contains true if PTU should be triggered
+ */
+ virtual void OnAppsSearchCompleted(const bool trigger_ptu) = 0;
+
+ /**
+ * @brief Gets request types for application
+ * @param policy_app_id Unique application id
+ * @return request types of application
+ */
+ virtual const std::vector<std::string> GetAppRequestTypes(
+ const std::string policy_app_id) const = 0;
+
+ /**
+ * @brief Get information about vehicle
+ * @return vehicle information
+ */
+ virtual const VehicleInfo GetVehicleInfo() const = 0;
+
+ /**
+ * @brief OnAppRegisteredOnMobile allows to handle event when application were
+ * succesfully registered on mobile device.
+ * It will send OnAppPermissionSend notification and will try to start PTU. *
+ * @param application_id registered application.
+ */
+ virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0;
+
+ virtual void OnDeviceSwitching(const std::string& device_id_from,
+ const std::string& device_id_to) = 0;
+
+ /**
+ * @brief RetrieveCertificate Allows to obtain certificate in order
+ * to start secure connection.
+ * @return The certificate in PKCS#7 format.
+ */
+ virtual std::string RetrieveCertificate() const = 0;
+
+ /**
+ * @brief HasCertificate check whether policy table has certificate
+ * int module_config section.
+ * @return true in case certificate exists, false otherwise
+ */
+ virtual bool HasCertificate() const = 0;
+
+ /**
+ * @brief Getter for policy settings
+ * @return policy settings instance
+ */
+ virtual const PolicySettings& get_settings() const = 0;
+
+ /**
+ * @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
+ */
+ virtual AppIdURL GetNextUpdateUrl(const EndpointUrls& urls) = 0;
+#ifdef SDL_REMOTE_CONTROL
+ /**
+ * @brief Assigns new HMI types for specified application
+ * @param application_id Unique application id
+ * @param hmi_types new HMI types list
+ */
+ virtual void SetDefaultHmiTypes(const std::string& application_id,
+ const std::vector<int>& hmi_types) = 0;
+
+ /**
+ * @brief Gets HMI types
+ * @param application_id ID application
+ * @param app_types list to save HMI types
+ * @return true if policy has specific policy for this application
+ */
+ virtual bool GetHMITypes(const std::string& application_id,
+ std::vector<int>* app_types) = 0;
+
+ /**
+ * @brief Checks if module for application is present in policy table
+ * @param app_id id of application
+ * @param module type
+ * @return true if module is present, otherwise - false
+ */
+ virtual bool CheckModule(const PTString& app_id, const PTString& module) = 0;
+
+ /**
+ * @brief Send OnPermissionsChange notification to mobile app
+ * when it's permissions are changed.
+ * @param device_id Device on which app is running
+ * @param application_id ID of app whose permissions are changed
+ */
+ virtual void SendAppPermissionsChanged(const std::string& device_id,
+ const std::string& application_id) = 0;
+
+ /**
+ * @brief Gets all allowed module types
+ * @param policy_app_id unique identifier of application
+ * @param modules list of allowed module types
+ * @return true if application has allowed modules
+ */
+ virtual bool GetModuleTypes(const std::string& policy_app_id,
+ std::vector<std::string>* modules) const = 0;
+
+ /**
+ * @brief Setter for access_remote instance
+ * @param access_remote pointer to new access_remote instance
+ */
+ virtual void set_access_remote(
+ utils::SharedPtr<AccessRemote> access_remote) = 0;
+#endif // SDL_REMOTE_CONTROL
+
+ /**
+ * @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
+ * application index
+ * @param rs contains the application index and url index from the
+ * urls vector that are to be sent on the next OnSystemRequest
+ * @param urls vector of vectors that contain urls for each application
+ * @return Pair of application index and url index
+ */
+ virtual AppIdURL RetrySequenceUrl(const struct RetrySequenceURL& rs,
+ const EndpointUrls& urls) const = 0;
+
+ protected:
+ /**
+ * @brief Checks is PT exceeded IgnitionCycles
+ * @return true if exceeded
+ */
+ virtual bool ExceededIgnitionCycles() = 0;
+
+ /**
+ * @brief Checks is PT exceeded days
+ * @return true if exceeded
+ */
+ virtual bool ExceededDays() = 0;
+
+ /**
+ * @brief StartPTExchange allows to start PTU. The function will check
+ * if one is required and starts the update flow in only case when previous
+ * condition is true.
+ */
+ virtual void StartPTExchange() = 0;
+};
+
+} // namespace policy
+
+extern "C" policy::PolicyManager* CreateManager();
+extern "C" void DeleteManager(policy::PolicyManager*);
+
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_POLICY_MANAGER_H_
diff --git a/src/components/include/policy/policy_regular/policy/policy_settings.h b/src/components/include/policy/policy_regular/policy/policy_settings.h
new file mode 100644
index 0000000000..def9fca05a
--- /dev/null
+++ b/src/components/include/policy/policy_regular/policy/policy_settings.h
@@ -0,0 +1,42 @@
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
+#include <string>
+#include <stdint.h>
+
+namespace policy {
+class PolicySettings {
+ public:
+ /**
+ * @brief Should Policy be turned off? (Library not loaded)
+ * @return Flag
+ */
+ virtual bool enable_policy() const = 0;
+ /*
+ * @brief Path to preloaded policy file
+ */
+ virtual const std::string& preloaded_pt_file() const = 0;
+
+ /**
+ * @brief Returns application storage path
+ */
+ virtual const std::string& app_storage_folder() const = 0;
+
+ virtual uint16_t attempts_to_open_policy_db() const = 0;
+
+ virtual uint16_t open_attempt_timeout_ms() const = 0;
+
+ /**
+ * @brief Path to policies snapshot file
+ * @return file path
+ */
+ virtual const std::string& policies_snapshot_file_name() const = 0;
+
+ /**
+ * @brief Returns system files folder path
+ */
+ virtual const std::string& system_files_path() const = 0;
+
+ virtual ~PolicySettings() {}
+};
+} // namespace policy
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_SETTINGS_H_
diff --git a/src/components/include/policy/policy_regular/policy/usage_statistics/app_stopwatch.h b/src/components/include/policy/policy_regular/policy/usage_statistics/app_stopwatch.h
new file mode 100644
index 0000000000..0bcd585737
--- /dev/null
+++ b/src/components/include/policy/policy_regular/policy/usage_statistics/app_stopwatch.h
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
+
+#include "policy/usage_statistics/statistics_manager.h"
+
+namespace usage_statistics {
+
+class AppStopwatch {
+ public:
+ virtual ~AppStopwatch() {}
+ virtual void Start(AppStopwatchId stopwatch_type) = 0;
+ virtual void Switch(AppStopwatchId stopwatch_type) = 0;
+ virtual void WriteTime() = 0;
+};
+
+} // namespace usage_statistics
+
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
diff --git a/src/components/include/policy/usage_statistics/statistics_manager.h b/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h
index 2b2c875d11..23df30510b 100644
--- a/src/components/include/policy/usage_statistics/statistics_manager.h
+++ b/src/components/include/policy/policy_regular/policy/usage_statistics/statistics_manager.h
@@ -30,19 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
-#define SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
#include <stdint.h>
#include <string>
namespace usage_statistics {
-enum GlobalCounterId { IAP_BUFFER_FULL, SYNC_OUT_OF_MEMORY, SYNC_REBOOTS };
+enum GlobalCounterId {
+ GLOBAL_COUNTER_NONE,
+ IAP_BUFFER_FULL,
+ SYNC_OUT_OF_MEMORY,
+ SYNC_REBOOTS
+};
-enum AppInfoId { LANGUAGE_GUI, LANGUAGE_VUI };
+enum AppInfoId { APP_INFO_NONE, LANGUAGE_GUI, LANGUAGE_VUI };
enum AppStopwatchId {
+ STOPWATCH_NONE,
SECONDS_HMI_FULL,
SECONDS_HMI_LIMITED,
SECONDS_HMI_BACKGROUND,
@@ -50,6 +56,7 @@ enum AppStopwatchId {
};
enum AppCounterId {
+ APP_COUNTER_NONE,
USER_SELECTIONS,
REJECTIONS_SYNC_OUT_OF_MEMORY,
REJECTIONS_NICKNAME_MISMATCH,
@@ -64,11 +71,36 @@ enum AppCounterId {
class StatisticsManager {
public:
virtual ~StatisticsManager() {}
+
+ /**
+ * @brief Increments global counter
+ * @param type counter type
+ */
virtual void Increment(GlobalCounterId type) = 0;
+
+ /**
+ * @brief Increments specified application counter
+ * @param app_id Unique ID of application
+ * @param type application counter type
+ */
virtual void Increment(const std::string& app_id, AppCounterId type) = 0;
+
+ /**
+ * @brief Sets specified application info value
+ * @param app_id Unique ID of application
+ * @param type application info type
+ * @param value new value for counter
+ */
virtual void Set(const std::string& app_id,
AppInfoId type,
const std::string& value) = 0;
+
+ /**
+ * @brief Add seconds for specified application stopwatch
+ * @param app_id Unique ID of application
+ * @param type application stopwatch type
+ * @param timespan_seconds seconds to add
+ */
virtual void Add(const std::string& app_id,
AppStopwatchId type,
int32_t timespan_seconds) = 0;
@@ -76,4 +108,4 @@ class StatisticsManager {
} // namespace usage_statistics
-#endif // SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_POLICY_REGULAR_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
diff --git a/src/components/include/policy/policy_types.h b/src/components/include/policy/policy_types.h
deleted file mode 100644
index f03278619c..0000000000
--- a/src/components/include/policy/policy_types.h
+++ /dev/null
@@ -1,318 +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_POLICY_INCLUDE_POLICY_POLICY_TYPES_H_
-#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TYPES_H_
-
-#include <string>
-#include <vector>
-#include <map>
-#include <set>
-#include "utils/shared_ptr.h"
-#include "utils/helpers.h"
-
-namespace policy {
-
-// TODO(PV): specify errors
-enum PolicyErrorEnum {};
-
-const std::string kDefaultDeviceMacAddress = "00:00:00:00:00:00";
-const std::string kDefaultDeviceName = "MyDevice";
-const std::string kDefaultDeviceConnectionType = "UNKNOWN";
-
-/**
- * @brief Constants for special ids in application policies section of
- * policy table
- */
-const std::string kPreDataConsentId = "pre_DataConsent";
-const std::string kDefaultId = "default";
-const std::string kDeviceId = "device";
-
-/*
- * @brief Status of policy table update
- */
-enum PolicyTableStatus {
- StatusUpToDate = 0,
- StatusUpdatePending,
- StatusUpdateRequired,
- StatusUnknown
-};
-
-// Code generator uses String class name, so this typedef was renamed to PTSring
-typedef std::string PTString;
-typedef std::vector<uint8_t> BinaryMessage;
-typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr;
-
-typedef std::string HMILevel;
-typedef std::string Parameter;
-typedef std::string RpcName;
-typedef std::vector<std::string> RPCParams;
-
-typedef std::map<std::string, std::set<policy::HMILevel> > HMIPermissions;
-typedef std::map<std::string, std::set<policy::Parameter> >
- ParameterPermissions;
-
-struct RpcPermissions {
- HMIPermissions hmi_permissions;
- ParameterPermissions parameter_permissions;
-};
-
-typedef std::map<RpcName, RpcPermissions> Permissions;
-
-/**
- * @brief Typedef for use with AllowApp request/notification
- */
-typedef std::vector<std::string> PermissionsList;
-
-/**
- * @brief Typedef for getting initial application data, e.g. nickname list
- */
-typedef std::vector<std::string> StringArray;
-
-enum PermitResult { kRpcAllowed = 0, kRpcDisallowed, kRpcUserDisallowed };
-
-/**
- * @struct Stores result of check:
- * if HMI Level was allowed for RPC to work in
- * and list of parameters allowed for RPC if specified in PT.
- */
-struct CheckPermissionResult {
- CheckPermissionResult() : hmi_level_permitted(kRpcDisallowed) {}
-
- PermitResult hmi_level_permitted;
- std::vector<PTString> list_of_allowed_params;
- std::vector<PTString> list_of_disallowed_params;
- std::vector<PTString> list_of_undefined_params;
-};
-
-/**
- @struct Holds Url string and optional policy app id.
- */
-struct EndpointData {
- explicit EndpointData(const std::string& url_string = "")
- : app_id("default") {
- if (false == url_string.empty()) {
- url.push_back(url_string);
- }
- }
- std::vector<std::string> url;
- std::string app_id;
-};
-
-typedef std::vector<EndpointData> EndpointUrls;
-
-/**
- * @brief Struct contains device data to be used for dialogs, generation of IDs
- */
-struct DeviceParams {
- DeviceParams()
- : device_name(kDefaultDeviceName)
- , device_mac_address(kDefaultDeviceMacAddress)
- , device_connection_type(kDefaultDeviceConnectionType)
- , device_handle(0) {}
-
- std::string device_name;
- std::string device_mac_address;
- std::string device_connection_type;
- uint32_t device_handle;
-};
-
-/**
- * @brief User consent for device data usage
- */
-enum DeviceConsent {
- kDeviceAllowed = 0,
- kDeviceDisallowed,
- kDeviceHasNoConsent
-};
-
-/**
- * @brief Struct contains parameters, which can be received during application
- * registration and should be stored in policy table
- */
-struct DeviceInfo {
- DeviceInfo() : max_number_rfcom_ports(0) {}
-
- std::string hardware;
- std::string firmware_rev;
- std::string os;
- std::string os_ver;
- std::string carrier;
- uint32_t max_number_rfcom_ports;
- std::string connection_type;
-
- void AdoptDeviceType(const std::string& deviceType) {
- connection_type = "USB_serial_number";
- using namespace helpers;
- static const std::string bluetooth("BLUETOOTH");
- static const std::string wifi("WIFI");
- if (Compare<std::string, EQ, ONE>(deviceType, bluetooth, wifi)) {
- connection_type.assign("BTMAC");
- }
- }
-};
-
-/**
- * @brief User consent for functional group
- */
-enum GroupConsent { kGroupAllowed = 0, kGroupDisallowed, kGroupUndefined };
-
-/**
- * @brief Contains user permission for RPC functional group with specific name
- * and id from DB
- */
-struct FunctionalGroupPermission {
- FunctionalGroupPermission() : group_id(0), state(kGroupUndefined) {}
-
- bool operator==(const FunctionalGroupPermission& rhs) {
- if (this->group_id == rhs.group_id &&
- this->group_alias == rhs.group_alias &&
- this->group_name == rhs.group_name) {
- return true;
- }
- return false;
- }
-
- std::string group_alias;
- std::string group_name;
- int32_t group_id;
- GroupConsent state;
-};
-
-/**
- * @brief Stores data to be sent to HMI on application permissions change
- */
-struct AppPermissions {
- AppPermissions(const std::string& app_id)
- : application_id(app_id)
- , isAppPermissionsRevoked(false)
- , appRevoked(false)
- , appPermissionsConsentNeeded(false)
- , appUnauthorized(false)
- , requestTypeChanged(false) {}
-
- std::string application_id;
- bool isAppPermissionsRevoked;
- std::vector<policy::FunctionalGroupPermission> appRevokedPermissions;
- bool appRevoked;
- bool appPermissionsConsentNeeded;
- bool appUnauthorized;
- bool isSDLAllowed;
- std::string priority;
- DeviceParams deviceInfo;
- bool requestTypeChanged;
- std::vector<std::string> requestType;
-};
-
-/**
- * @brief Contains parameters for user-defined consent for appication
- * functional groups on given device
- */
-struct PermissionConsent {
- std::string device_id;
- std::string policy_app_id;
- std::vector<FunctionalGroupPermission> group_permissions;
- std::string consent_source;
-};
-
-/**
- * @brief Contain data for GetUserFriendyMessage response
- */
-struct UserFriendlyMessage {
- std::string message_code;
-};
-
-/**
- * @brief Types of functional groups in policy table
- */
-enum GroupType {
- kTypeDefault = 0, // groups assigned to 'default' permissions section
- kTypeAllowed, // groups allowed by user for specific application
- kTypeDisallowed, // groups disallowed by user for specific application
- kTypeUnconsented, // groups disallowed by default but consent may be changed
- // by user
- kTypePreconsented, // groups allowed for specific application without
- // user consent by default (could be changed by user)
- kTypeGeneral, // groups assigned to specific application
- kTypePreDataConsented, // groups assigned to 'pre_DataConsent' permissions
- // section
- kTypeDevice // groups assigned to 'device' permissions section
-};
-
-/**
- * @brief Array of functional group id from DB
- */
-typedef std::vector<int32_t> FunctionalGroupIDs;
-
-/**
- * @brief Array of functional group ids sorted by types
- */
-typedef std::map<GroupType, FunctionalGroupIDs> FunctionalIdType;
-
-/**
- * @brief Array of functional group ids binded to user_consent_prompt (e.g.
- * VehicleData) and group name (e.g. VehicleData-4)
- */
-typedef std::map<uint32_t, std::pair<std::string, std::string> >
- FunctionalGroupNames;
-
-/**
- * @brief Array of device ids, which are an identifiers in policy table
- */
-typedef std::vector<std::string> DeviceIds;
-
-/**
- * @brief Counters that calculated on receiving of succesful update
- */
-enum Counters { KILOMETERS, DAYS_AFTER_EPOCH };
-
-/**
- * @struct Vehicle information
- */
-struct VehicleInfo {
- std::string vehicle_make;
- std::string vehicle_model;
- std::string vehicle_year;
-};
-
-/**
- * @brief The MetaInfo information
- */
-struct MetaInfo {
- std::string ccpu_version;
- std::string wers_country_code;
- std::string language;
-};
-
-} // namespace policy
-
-#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TYPES_H_
diff --git a/src/components/include/protocol/bson_object_keys.h b/src/components/include/protocol/bson_object_keys.h
new file mode 100644
index 0000000000..6f80aeec2b
--- /dev/null
+++ b/src/components/include/protocol/bson_object_keys.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2017, 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.
+ */
+
+namespace protocol_handler {
+
+namespace strings {
+
+extern const char* hash_id;
+extern const char* protocol_version;
+extern const char* mtu;
+extern const char* rejected_params;
+extern const char* height;
+extern const char* width;
+extern const char* video_protocol;
+extern const char* video_codec;
+
+} // namespace strings
+
+} // namespace protocol_handler
diff --git a/src/components/include/protocol/common.h b/src/components/include/protocol/common.h
index ce4c4adf6f..00d57a9bf5 100644
--- a/src/components/include/protocol/common.h
+++ b/src/components/include/protocol/common.h
@@ -56,8 +56,9 @@ const uint8_t PROTOCOL_HEADER_V2_SIZE = 12;
*\brief Protocol versions constants
* First 4-bit field of AppLink protocol packet
*/
-enum {
-
+enum MajorProtocolVersion {
+ PROTOCOL_VERSION_UNKNOWN = -1,
+ PROTOCOL_VERSION_HMI = 0x00,
/**
*\brief Constant: number of protocol version (1).
*/
@@ -85,6 +86,12 @@ enum {
*/
PROTOCOL_VERSION_4 = 0x04,
/**
+ *@brief Constant: number of protocol version (5).
+ * Supports constructed payloads for protocol packets
+ * SDL4.4 feature.
+ */
+ PROTOCOL_VERSION_5 = 0x05,
+ /**
*\brief Maximum value of packet version field (size 4-bit) specified AppLink
*Protocol v.7
*/
diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h
index 183db21532..6aafd7d53f 100644
--- a/src/components/include/protocol_handler/protocol_handler.h
+++ b/src/components/include/protocol_handler/protocol_handler.h
@@ -43,6 +43,8 @@ namespace protocol_handler {
class ProtocolObserver;
class SessionObserver;
+struct SessionContext;
+
/**
* \class ProtocolHandler
* \brief Interface for component parsing protocol header
@@ -108,6 +110,39 @@ class ProtocolHandler {
virtual const ProtocolHandlerSettings& get_settings() const = 0;
virtual SessionObserver& get_session_observer() = 0;
+ /**
+ * \brief Called by connection handler to notify the result of
+ * OnSessionStartedCallback().
+ * \param connection_id Identifier of connection within which session exists
+ * \param session_id session ID passed to OnSessionStartedCallback()
+ * \param generated_session_id Generated session ID, will be 0 if session is
+ * not started
+ * \param hash_id Generated Hash ID
+ * \param protection whether the service will be protected
+ * \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.
+ */
+ DEPRECATED virtual void NotifySessionStartedResult(
+ int32_t connection_id,
+ uint8_t session_id,
+ uint8_t generated_session_id,
+ uint32_t hash_id,
+ bool protection,
+ std::vector<std::string>& rejected_params) = 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.
+ */
+ virtual void NotifySessionStarted(
+ const SessionContext& context,
+ std::vector<std::string>& rejected_params) = 0;
+
protected:
/**
* \brief Destructor
diff --git a/src/components/include/protocol_handler/protocol_handler_settings.h b/src/components/include/protocol_handler/protocol_handler_settings.h
index 987b0ac449..e1107cb2a9 100644
--- a/src/components/include/protocol_handler/protocol_handler_settings.h
+++ b/src/components/include/protocol_handler/protocol_handler_settings.h
@@ -15,6 +15,10 @@ class ProtocolHandlerSettings {
virtual ~ProtocolHandlerSettings() {}
virtual size_t maximum_payload_size() const = 0;
+ virtual size_t maximum_control_payload_size() const = 0;
+ virtual size_t maximum_rpc_payload_size() const = 0;
+ virtual size_t maximum_audio_payload_size() const = 0;
+ virtual size_t maximum_video_payload_size() const = 0;
virtual size_t message_frequency_count() const = 0;
virtual size_t message_frequency_time() const = 0;
virtual bool malformed_message_filtering() const = 0;
@@ -25,11 +29,16 @@ class ProtocolHandlerSettings {
*/
virtual uint32_t heart_beat_timeout() const = 0;
- virtual uint16_t max_supported_protocol_version() const = 0;
/*
* @brief Protocol version, from .ini file.
*/
- virtual bool enable_protocol_4() const = 0;
+ virtual uint16_t max_supported_protocol_version() const = 0;
+
+ /*
+ * @brief Returns true, if SDL 4.0 is enabled
+ * @deprecated Use max_supported_protocol_version instead
+ */
+ DEPRECATED virtual bool enable_protocol_4() const = 0;
virtual uint32_t multiframe_waiting_timeout() const = 0;
#ifdef ENABLE_SECURITY
diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h
index 5e630c6c74..ccf000a18d 100644
--- a/src/components/include/protocol_handler/session_observer.h
+++ b/src/components/include/protocol_handler/session_observer.h
@@ -36,13 +36,17 @@
#include <list>
#include <string>
#include "transport_manager/transport_manager.h"
+#include "utils/macro.h"
#ifdef ENABLE_SECURITY
#include "security_manager/ssl_context.h"
#endif // ENABLE_SECURITY
- /**
- *\namespace protocol_handlerHandler
- *\brief Namespace for SmartDeviceLink ProtocolHandler related functionality.
- */
+
+struct BsonObject;
+
+/**
+ *\namespace protocol_handler
+ *\brief Namespace for SmartDeviceLink ProtocolHandler related functionality.
+ */
namespace protocol_handler {
/**
* \brief HASH_ID constants.
@@ -52,6 +56,60 @@ namespace protocol_handler {
enum { HASH_ID_NOT_SUPPORTED = 0, HASH_ID_WRONG = 0xFFFF0000 };
/**
+ * @brief Struct with data containing attributes of starting session
+ **/
+struct SessionContext {
+ transport_manager::ConnectionUID connection_id_;
+ uint8_t initial_session_id_;
+ uint8_t new_session_id_;
+ protocol_handler::ServiceType service_type_;
+ uint32_t hash_id_;
+ bool is_protected_;
+ bool is_new_service_;
+ bool is_ptu_required_;
+
+ /**
+ * @brief Constructor
+ */
+ SessionContext()
+ : connection_id_(0)
+ , initial_session_id_(0)
+ , new_session_id_(0)
+ , service_type_(protocol_handler::kInvalidServiceType)
+ , hash_id_(0)
+ , is_protected_(false)
+ , is_new_service_(false)
+ , is_ptu_required_(false) {}
+
+ /**
+ * @brief Constructor
+ * @param connection_id_ Connection identifier within which session is
+ * started.
+ * @param session_id Session ID specified to OnSessionStartedCallback()
+ * @param new_session_id Session ID generated
+ * @param service_type Type of service
+ * @param hash_id Hash ID generated from connection_handle and
+ * new_session_id
+ * @param is_protected Whether service will be protected
+ * @param is_new_service Whether service was already established
+ **/
+ SessionContext(transport_manager::ConnectionUID connection_id,
+ uint8_t session_id,
+ uint8_t new_session_id,
+ protocol_handler::ServiceType service_type,
+ uint32_t hash_id,
+ const bool is_protected)
+ : connection_id_(connection_id)
+ , initial_session_id_(session_id)
+ , new_session_id_(new_session_id)
+ , service_type_(service_type)
+ , hash_id_(hash_id)
+ , is_protected_(is_protected)
+ , is_new_service_(false)
+ , is_ptu_required_(false) {}
+};
+
+/**
* \class SessionObserver
* \brief Interface for making a bridge between ProtocolHandler and
* ConnectionHandler components.
@@ -72,8 +130,9 @@ class SessionObserver {
* \param is_protected would be service protected
* \param hash_id pointer for session hash identifier, uint32_t* hash_id
* \return uint32_t Id (number) of new session if successful, otherwise 0.
+ * \deprecated
*/
- virtual uint32_t OnSessionStartedCallback(
+ DEPRECATED virtual uint32_t OnSessionStartedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
const protocol_handler::ServiceType& service_type,
@@ -82,6 +141,25 @@ class SessionObserver {
/**
* \brief Callback function used by ProtocolHandler
+ * when Mobile Application initiates start of new session.
+ * Result must be notified through NotifySessionStartedContext().
+ * \param connection_handle Connection identifier within which session
+ * has to be started.
+ * \param sessionId Identifier of the session to be start
+ * \param service_type Type of service
+ * \param protocol_version Version of protocol
+ * \param is_protected would be service protected
+ * \param params configuration parameters specified by mobile
+ */
+ virtual void OnSessionStartedCallback(
+ const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ const protocol_handler::ServiceType& service_type,
+ const bool is_protected,
+ const BsonObject* params) = 0;
+
+ /**
+ * \brief Callback function used by ProtocolHandler
* when Mobile Application initiates session ending.
* \param connection_handle Connection identifier within which session exists
* \param sessionId Identifier of the session to be ended
@@ -90,8 +168,9 @@ class SessionObserver {
* If not equal to hash assigned to session on start then operation fails.
* \param service_type Type of service
* \return uint32_t 0 if operation fails, session key otherwise
+ * \deprecated
*/
- virtual uint32_t OnSessionEndedCallback(
+ DEPRECATED virtual uint32_t OnSessionEndedCallback(
const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
const uint32_t& hashCode,
@@ -99,6 +178,23 @@ class SessionObserver {
/**
* \brief Callback function used by ProtocolHandler
+ * when Mobile Application initiates session ending.
+ * \param connection_handle Connection identifier within which session exists
+ * \param sessionId Identifier of the session to be ended
+ * \param hashCode Hash used only in second version of SmartDeviceLink
+ * protocol. (Set to HASH_ID_WRONG if the hash is incorrect)
+ * If not equal to hash assigned to session on start then operation fails.
+ * \param service_type Type of service
+ * \return uint32_t 0 if operation fails, session key otherwise
+ */
+ virtual uint32_t OnSessionEndedCallback(
+ const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ uint32_t* hashCode,
+ const protocol_handler::ServiceType& service_type) = 0;
+
+ /**
+ * \brief Callback function used by ProtocolHandler
* when Mobile Application start message flood
* \param connection_key used by other components as application identifier
*/
@@ -135,6 +231,7 @@ class SessionObserver {
uint8_t* sessionId) const = 0;
/**
+ * DEPRECATED
* \brief information about given Connection Key.
* \param key Unique key used by other components as session identifier
* \param app_id Returned: ApplicationID
@@ -148,6 +245,20 @@ class SessionObserver {
uint32_t* device_id) const = 0;
/**
+ * \brief information about given Connection Key.
+ * \param key Unique key used by other components as session identifier
+ * \param app_id Returned: ApplicationID
+ * \param sessions_list Returned: List of session keys
+ * \param device_id Returned: DeviceID
+ * \return int32_t -1 in case of error or 0 in case of success
+ */
+ virtual int32_t GetDataOnSessionKey(
+ uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ transport_manager::DeviceHandle* device_id) const = 0;
+
+ /**
* \brief information about device
* \param device_handle
* \param device_name Returned: name of device
@@ -216,6 +327,16 @@ class SessionObserver {
const uint32_t& key,
const protocol_handler::ServiceType& service_type) = 0;
+ /**
+ * @brief Check if session contains service with specified service type
+ * @param connection_key unique id of session to check
+ * @param service_type type of service to check
+ * @return true if session contains service with specified service type
+ */
+ virtual bool SessionServiceExists(
+ const uint32_t connection_key,
+ const protocol_handler::ServiceType& service_type) const = 0;
+
virtual security_manager::SSLContext::HandshakeContext GetHandshakeContext(
uint32_t key) const = 0;
#endif // ENABLE_SECURITY
diff --git a/src/components/include/protocol_handler/telemetry_observer.h b/src/components/include/protocol_handler/telemetry_observer.h
new file mode 100644
index 0000000000..a76fbce717
--- /dev/null
+++ b/src/components/include/protocol_handler/telemetry_observer.h
@@ -0,0 +1,57 @@
+/*
+ * 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_INCLUDE_PROTOCOL_HANDLER_TELEMETRY_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_TELEMETRY_OBSERVER_H_
+#include "protocol/common.h"
+
+#include <stdint.h>
+#include "utils/date_time.h"
+
+namespace protocol_handler {
+
+class PHTelemetryObserver {
+ public:
+ struct MessageMetric {
+ RawMessagePtr raw_msg;
+ uint32_t message_id;
+ uint8_t connection_key;
+ TimevalStruct begin;
+ TimevalStruct end;
+ };
+ virtual void StartMessageProcess(uint32_t message_id,
+ const TimevalStruct& start_time) = 0;
+ virtual void EndMessageProcess(utils::SharedPtr<MessageMetric> m) = 0;
+ virtual ~PHTelemetryObserver() {}
+};
+} // protocol_handler
+#endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_TELEMETRY_OBSERVER_H_
diff --git a/src/components/include/rpc_base/validation_report.h b/src/components/include/rpc_base/validation_report.h
new file mode 100644
index 0000000000..82f265e594
--- /dev/null
+++ b/src/components/include/rpc_base/validation_report.h
@@ -0,0 +1,125 @@
+/*
+ * 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_RPC_BASE_INCLUDE_RPC_BASE_VALIDATION_REPORT_H_
+#define SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_VALIDATION_REPORT_H_
+
+#include <string>
+#include <list>
+
+namespace rpc {
+
+class ValidationReport;
+typedef std::list<ValidationReport> ValidationReports;
+
+class ValidationReport {
+ public:
+ explicit ValidationReport(const std::string& object_name);
+ const std::string& object_name() const;
+ const std::string& validation_info() const;
+ void set_validation_info(const std::string& info);
+ const ValidationReports& subobject_reports() const;
+ ValidationReport& ReportSubobject(const std::string& object_name);
+
+ private:
+ std::string object_name_;
+ std::string validation_info_;
+ ValidationReports subobject_reports_;
+};
+
+std::string PrettyFormat(const ValidationReport& report);
+
+// Implementation
+
+namespace impl {
+inline void PrettyFormat(const ValidationReport& report,
+ const std::string& parent_path,
+ std::string* result) {
+ std::string object_path = parent_path;
+ if (!object_path.empty() && report.object_name()[0] != '[') {
+ object_path.append(".");
+ }
+ const ValidationReports& subreports = report.subobject_reports();
+ object_path.append(report.object_name());
+ if (!report.validation_info().empty()) {
+ // Insert newline between entries
+ if (!result->empty()) {
+ result->append("\n");
+ }
+ result->append(object_path);
+ result->append(": ");
+ result->append(report.validation_info());
+ }
+ for (ValidationReports::const_iterator i = subreports.begin(),
+ end = subreports.end();
+ i != end;
+ ++i) {
+ PrettyFormat(*i, object_path, result);
+ }
+}
+} // namespace impl
+
+inline ValidationReport::ValidationReport(const std::string& object_name)
+ : object_name_(object_name) {}
+
+inline const std::string& ValidationReport::object_name() const {
+ return object_name_;
+}
+
+inline const std::string& ValidationReport::validation_info() const {
+ return validation_info_;
+}
+
+inline void ValidationReport::set_validation_info(const std::string& info) {
+ validation_info_ = info;
+}
+
+inline const std::list<ValidationReport>& ValidationReport::subobject_reports()
+ const {
+ return subobject_reports_;
+}
+
+inline ValidationReport& ValidationReport::ReportSubobject(
+ const std::string& object_name) {
+ subobject_reports_.push_back(ValidationReport(object_name));
+ return subobject_reports_.back();
+}
+
+inline std::string PrettyFormat(const ValidationReport& report) {
+ std::string result;
+ impl::PrettyFormat(report, "", &result);
+ return result;
+}
+
+} // namespace rpc
+
+#endif // SRC_COMPONENTS_RPC_BASE_INCLUDE_RPC_BASE_VALIDATION_REPORT_H_
diff --git a/src/components/include/security_manager/security_manager.h b/src/components/include/security_manager/security_manager.h
index 8ed0ff2912..8f772f6a13 100644
--- a/src/components/include/security_manager/security_manager.h
+++ b/src/components/include/security_manager/security_manager.h
@@ -128,6 +128,24 @@ class SecurityManager : public protocol_handler::ProtocolObserver {
virtual void StartHandshake(uint32_t connection_key) = 0;
/**
+ * @brief Check whether certificate should be updated
+ * @return true if certificate should be updated otherwise false
+ */
+ virtual bool IsCertificateUpdateRequired() = 0;
+
+ /**
+ * @brief Notify all listeners that certificate update required
+ * Allows to notify that certificate should be updated
+ */
+ virtual void NotifyOnCertificateUpdateRequired() = 0;
+
+ /**
+ * @brief Check if policy certificate data is empty
+ * @return true if policy certificate data is empty otherwise false
+ */
+ virtual bool IsPolicyCertificateDataEmpty() = 0;
+
+ /**
* \brief Add/Remove for SecurityManagerListener
*/
virtual void AddListener(SecurityManagerListener* const listener) = 0;
diff --git a/src/components/include/security_manager/security_manager_listener.h b/src/components/include/security_manager/security_manager_listener.h
index 577c7c4378..aeb3334a56 100644
--- a/src/components/include/security_manager/security_manager_listener.h
+++ b/src/components/include/security_manager/security_manager_listener.h
@@ -31,6 +31,9 @@
*/
#ifndef SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_LISTENER_H_
#define SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_LISTENER_H_
+
+#include <string>
+
namespace security_manager {
class SecurityManagerListener {
@@ -48,6 +51,14 @@ class SecurityManagerListener {
* @brief Notify listeners that certificate update is required.
*/
virtual void OnCertificateUpdateRequired() = 0;
+
+ /**
+ * @brief Get certificate data from policy
+ * @param reference to string where to save certificate data
+ * @return true if listener saved some data to string otherwise false
+ */
+ virtual bool GetPolicyCertificateData(std::string& data) const = 0;
+
virtual ~SecurityManagerListener() {}
};
} // namespace security_manager
diff --git a/src/components/include/security_manager/security_manager_settings.h b/src/components/include/security_manager/security_manager_settings.h
index 70f0452ef2..c6b97f85cc 100644
--- a/src/components/include/security_manager/security_manager_settings.h
+++ b/src/components/include/security_manager/security_manager_settings.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_SUCURITY_MANAGER_SUCURITY_MANAGER_SETTINGS_H_
-#define SRC_COMPONENTS_INCLUDE_SUCURITY_MANAGER_SUCURITY_MANAGER_SETTINGS_H_
+#ifndef SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_SETTINGS_H_
namespace security_manager {
enum Mode { CLIENT, SERVER };
@@ -55,4 +55,4 @@ class CryptoManagerSettings {
};
} // namespace security_manager
-#endif // SRC_COMPONENTS_INCLUDE_SUCURITY_MANAGER_SUCURITY_MANAGER_SETTINGS_H_
+#endif // SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_SETTINGS_H_
diff --git a/src/components/include/security_manager/security_query.h b/src/components/include/security_manager/security_query.h
index 71d148b909..cdad1c746c 100644
--- a/src/components/include/security_manager/security_query.h
+++ b/src/components/include/security_manager/security_query.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_SECURITY_QUERY_H_
-#define SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_SECURITY_QUERY_H_
+#ifndef SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_QUERY_H_
+#define SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_QUERY_H_
#include <stdint.h>
#include <cstddef>
@@ -191,4 +191,4 @@ class SecurityQuery {
*/
typedef utils::SharedPtr<SecurityQuery> SecurityQueryPtr;
} // namespace security_manager
-#endif // SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_SECURITY_QUERY_H_
+#endif // SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_QUERY_H_
diff --git a/src/components/include/telemetry_monitor/telemetry_observable.h b/src/components/include/telemetry_monitor/telemetry_observable.h
index bafa916925..034deb3c2e 100644
--- a/src/components/include/telemetry_monitor/telemetry_observable.h
+++ b/src/components/include/telemetry_monitor/telemetry_observable.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_RESOURCE_OBSERVEABLE_H
-#define SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_RESOURCE_OBSERVEABLE_H
+#ifndef SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TELEMETRY_OBSERVABLE_H_
+#define SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TELEMETRY_OBSERVABLE_H_
namespace telemetry_monitor {
template <class TelemetryObserver>
@@ -40,4 +40,4 @@ class TelemetryObservable {
virtual void SetTelemetryObserver(TelemetryObserver* observer) = 0;
};
} // namespace telemetry_monitor
-#endif // SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_RESOURCE_OBSERVEABLE_H
+#endif // SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TELEMETRY_OBSERVABLE_H_
diff --git a/src/components/include/test/application_manager/mock_app_launch_settings.h b/src/components/include/test/application_manager/mock_app_launch_settings.h
index 2ceaefcae4..c59eb276ce 100644
--- a/src/components/include/test/application_manager/mock_app_launch_settings.h
+++ b/src/components/include/test/application_manager/mock_app_launch_settings.h
@@ -33,7 +33,6 @@
#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APP_LAUNCH_SETTINGS_H_
#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APP_LAUNCH_SETTINGS_H_
-#include <string>
#include "gmock/gmock.h"
#include "application_manager/app_launch_settings.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
new file mode 100644
index 0000000000..58edcb637a
--- /dev/null
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -0,0 +1,321 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_H_
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+
+#include "application_manager/application_manager.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/application_manager_settings.h"
+#include "application_manager/commands/command.h"
+#include "application_manager/hmi_capabilities.h"
+#include "application_manager/state_controller.h"
+#include "application_manager/message.h"
+#include "resumption/last_state.h"
+#include "interfaces/MOBILE_API.h"
+#include "application_manager/app_launch/app_launch_ctrl.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/state_controller.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class MockApplicationManager : public application_manager::ApplicationManager {
+ public:
+ 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));
+ MOCK_METHOD1(set_protocol_handler,
+ void(protocol_handler::ProtocolHandler* handler));
+ MOCK_METHOD1(set_connection_handler,
+ void(connection_handler::ConnectionHandler* handler));
+ MOCK_CONST_METHOD0(applications,
+ DataAccessor<application_manager::ApplicationSet>());
+ MOCK_CONST_METHOD1(
+ application, application_manager::ApplicationSharedPtr(uint32_t app_id));
+ MOCK_CONST_METHOD0(active_application,
+ application_manager::ApplicationSharedPtr());
+
+#ifdef SDL_REMOTE_CONTROL
+ MOCK_CONST_METHOD2(application,
+ application_manager::ApplicationSharedPtr(
+ const std::string& device_id,
+ const std::string& policy_app_id));
+ MOCK_METHOD2(ChangeAppsHMILevel,
+ void(uint32_t app_id, mobile_apis::HMILevel::eType level));
+ MOCK_METHOD0(GetPluginManager, functional_modules::PluginManager&());
+ MOCK_CONST_METHOD1(
+ devices, std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_METHOD1(SendPostMessageToMobile,
+ void(const application_manager::MessagePtr& message));
+ MOCK_METHOD1(SendPostMessageToHMI,
+ void(const application_manager::MessagePtr& message));
+#endif // SDL_REMOTE_CONTROL
+
+ MOCK_CONST_METHOD1(
+ application_by_hmi_app,
+ application_manager::ApplicationSharedPtr(uint32_t hmi_app_id));
+ MOCK_CONST_METHOD1(application_by_policy_id,
+ application_manager::ApplicationSharedPtr(
+ const std::string& policy_app_id));
+ MOCK_METHOD1(
+ applications_by_button,
+ std::vector<application_manager::ApplicationSharedPtr>(uint32_t button));
+ MOCK_METHOD0(applications_with_navi,
+ std::vector<application_manager::ApplicationSharedPtr>());
+ MOCK_METHOD0(applications_with_mobile_projection,
+ std::vector<application_manager::ApplicationSharedPtr>());
+ MOCK_CONST_METHOD0(get_limited_media_application,
+ application_manager::ApplicationSharedPtr());
+ MOCK_CONST_METHOD0(get_limited_navi_application,
+ application_manager::ApplicationSharedPtr());
+ MOCK_CONST_METHOD0(get_limited_voice_application,
+ application_manager::ApplicationSharedPtr());
+ MOCK_CONST_METHOD0(get_limited_mobile_projection_application,
+ application_manager::ApplicationSharedPtr());
+ MOCK_METHOD1(application_id, uint32_t(const int32_t correlation_id));
+ MOCK_METHOD2(set_application_id,
+ void(const int32_t correlation_id, const uint32_t app_id));
+ MOCK_METHOD3(OnHMILevelChanged,
+ void(uint32_t app_id,
+ mobile_apis::HMILevel::eType from,
+ mobile_apis::HMILevel::eType to));
+ MOCK_METHOD1(
+ SendHMIStatusNotification,
+ void(const utils::SharedPtr<application_manager::Application> app));
+ MOCK_METHOD2(SendMessageToMobile,
+ void(application_manager::commands::MessageSharedPtr, bool));
+ MOCK_METHOD1(
+ SendMessageToHMI,
+ void(const application_manager::commands::MessageSharedPtr message));
+ MOCK_METHOD1(RemoveHMIFakeParameters,
+ void(application_manager::MessagePtr& message));
+ MOCK_METHOD1(
+ ManageHMICommand,
+ bool(const application_manager::commands::MessageSharedPtr message));
+ MOCK_METHOD2(
+ ManageMobileCommand,
+ bool(const application_manager::commands::MessageSharedPtr message,
+ application_manager::commands::Command::CommandOrigin origin));
+ MOCK_CONST_METHOD1(
+ GetDefaultHmiLevel,
+ mobile_apis::HMILevel::eType(
+ application_manager::ApplicationConstSharedPtr application));
+ MOCK_METHOD0(hmi_capabilities, application_manager::HMICapabilities&());
+ MOCK_CONST_METHOD0(hmi_capabilities,
+ const application_manager::HMICapabilities&());
+ MOCK_METHOD2(ProcessQueryApp,
+ void(const smart_objects::SmartObject& sm_object,
+ const uint32_t connection_key));
+ MOCK_CONST_METHOD0(is_attenuated_supported, bool());
+ MOCK_CONST_METHOD1(IsAppTypeExistsInFullOrLimited,
+ bool(application_manager::ApplicationConstSharedPtr app));
+ MOCK_METHOD1(OnApplicationRegistered,
+ void(application_manager::ApplicationSharedPtr app));
+ MOCK_METHOD1(OnApplicationSwitched,
+ void(application_manager::ApplicationSharedPtr app));
+ MOCK_CONST_METHOD0(connection_handler,
+ connection_handler::ConnectionHandler&());
+ MOCK_CONST_METHOD0(protocol_handler, protocol_handler::ProtocolHandler&());
+ MOCK_METHOD0(GetPolicyHandler, policy::PolicyHandlerInterface&());
+ MOCK_CONST_METHOD0(GetPolicyHandler, const policy::PolicyHandlerInterface&());
+ MOCK_METHOD0(GetNextHMICorrelationID, uint32_t());
+ MOCK_METHOD0(GenerateNewHMIAppID, uint32_t());
+ MOCK_METHOD1(EndNaviServices, void(uint32_t app_id));
+ MOCK_METHOD0(BeginAudioPassThrough, bool());
+ MOCK_METHOD0(EndAudioPassThrough, bool());
+ MOCK_METHOD1(ConnectToDevice, void(const std::string& device_mac));
+ MOCK_METHOD0(OnHMIStartedCooperation, void());
+ MOCK_CONST_METHOD0(IsHMICooperating, bool());
+ MOCK_METHOD2(IviInfoUpdated,
+ std::vector<application_manager::ApplicationSharedPtr>(
+ mobile_apis::VehicleDataType::eType vehicle_info,
+ int value));
+ MOCK_METHOD1(RegisterApplication,
+ application_manager::ApplicationSharedPtr(const utils::SharedPtr<
+ smart_objects::SmartObject>& request_for_registration));
+ MOCK_METHOD0(SendUpdateAppList, void());
+ MOCK_METHOD2(MarkAppsGreyOut,
+ void(const connection_handler::DeviceHandle handle,
+ bool is_greyed_out));
+ MOCK_CONST_METHOD1(IsAppsQueriedFrom,
+ bool(const connection_handler::DeviceHandle handle));
+ MOCK_CONST_METHOD0(IsStopping, bool());
+ MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList,
+ void(const uint32_t app_id));
+ MOCK_METHOD4(
+ SaveBinary,
+ mobile_apis::Result::eType(const std::vector<uint8_t>& binary_data,
+ const std::string& file_path,
+ const std::string& file_name,
+ const int64_t offset));
+ MOCK_METHOD1(SetAllAppsAllowed, void(const bool allowed));
+ MOCK_METHOD1(
+ set_driver_distraction_state,
+ void(const hmi_apis::Common_DriverDistractionState::eType state));
+ MOCK_METHOD6(StartAudioPassThruThread,
+ void(int32_t session_key,
+ int32_t correlation_id,
+ int32_t max_duration,
+ int32_t sampling_rate,
+ int32_t bits_per_sample,
+ int32_t audio_type));
+ MOCK_METHOD0(StartDevicesDiscovery, void());
+ MOCK_METHOD1(StopAudioPassThru, void(int32_t application_key));
+ MOCK_METHOD3(TerminateRequest,
+ void(const uint32_t connection_key,
+ const uint32_t corr_id,
+ const int32_t function_id));
+ MOCK_METHOD4(UnregisterApplication,
+ void(const uint32_t&, mobile_apis::Result::eType, bool, bool));
+ MOCK_METHOD3(updateRequestTimeout,
+ void(uint32_t connection_key,
+ uint32_t mobile_correlation_id,
+ uint32_t new_timeout_value));
+ MOCK_METHOD0(state_controller, application_manager::StateController&());
+ MOCK_METHOD1(SetUnregisterAllApplicationsReason,
+ void(mobile_apis::AppInterfaceUnregisteredReason::eType reason));
+ MOCK_METHOD1(HeadUnitReset,
+ void(mobile_apis::AppInterfaceUnregisteredReason::eType reason));
+ MOCK_CONST_METHOD2(HMILevelAllowsStreaming,
+ bool(uint32_t app_id,
+ protocol_handler::ServiceType service_type));
+ MOCK_METHOD4(CheckPolicyPermissions,
+ mobile_apis::Result::eType(
+ const application_manager::ApplicationSharedPtr app,
+ const std::string& function_id,
+ const application_manager::RPCParams& rpc_params,
+ application_manager::CommandParametersPermissions*
+ params_permissions));
+ MOCK_CONST_METHOD2(IsApplicationForbidden,
+ bool(uint32_t connection_key,
+ const std::string& policy_app_id));
+ MOCK_METHOD0(resume_controller, resumption::ResumeCtrl&());
+ MOCK_METHOD0(hmi_interfaces, application_manager::HmiInterfaces&());
+ MOCK_METHOD0(app_launch_ctrl, app_launch::AppLaunchCtrl&());
+ MOCK_METHOD1(
+ GetDeviceTransportType,
+ hmi_apis::Common_TransportType::eType(const std::string& transport_type));
+ MOCK_METHOD1(AddAppToTTSGlobalPropertiesList, void(const uint32_t app_id));
+ MOCK_METHOD0(GenerateGrammarID, uint32_t());
+ MOCK_CONST_METHOD1(GetUserConsentForDevice,
+ policy::DeviceConsent(const std::string& device_id));
+ MOCK_METHOD1(OnAppUnauthorized, void(const uint32_t& app_id));
+ MOCK_METHOD1(ActivateApplication,
+ bool(application_manager::ApplicationSharedPtr app));
+ MOCK_METHOD3(OnAppStreaming,
+ void(uint32_t app_id,
+ protocol_handler::ServiceType service_type,
+ bool state));
+ MOCK_CONST_METHOD4(CreateRegularState,
+ application_manager::HmiStatePtr(
+ application_manager::ApplicationSharedPtr app,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state,
+ mobile_apis::SystemContext::eType system_context));
+ DEPRECATED MOCK_CONST_METHOD4(
+ CreateRegularState,
+ application_manager::HmiStatePtr(
+ uint32_t app_id,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state,
+ mobile_apis::SystemContext::eType system_context));
+
+ MOCK_METHOD2(SendAudioPassThroughNotification,
+ void(uint32_t session_key, std::vector<uint8_t>& binary_data));
+ MOCK_CONST_METHOD2(CanAppStream,
+ bool(uint32_t app_id,
+ protocol_handler::ServiceType service_type));
+ MOCK_METHOD1(ForbidStreaming, void(uint32_t app_id));
+ MOCK_CONST_METHOD0(get_settings,
+ const application_manager::ApplicationManagerSettings&());
+ MOCK_METHOD0(event_dispatcher,
+ application_manager::event_engine::EventDispatcher&());
+
+ DEPRECATED MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints,
+ bool(const uint32_t));
+ DEPRECATED MOCK_METHOD1(SubscribeAppForWayPoints, void(const uint32_t));
+ DEPRECATED MOCK_METHOD1(UnsubscribeAppFromWayPoints, void(const uint32_t));
+ MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints,
+ bool(application_manager::ApplicationSharedPtr));
+ MOCK_METHOD1(SubscribeAppForWayPoints,
+ void(application_manager::ApplicationSharedPtr));
+ MOCK_METHOD1(UnsubscribeAppFromWayPoints,
+ void(application_manager::ApplicationSharedPtr));
+ MOCK_CONST_METHOD0(IsAnyAppSubscribedForWayPoints, bool());
+ MOCK_CONST_METHOD0(GetAppsSubscribedForWayPoints, const std::set<int32_t>());
+ MOCK_CONST_METHOD1(
+ WaitingApplicationByID,
+ application_manager::ApplicationConstSharedPtr(const uint32_t));
+ MOCK_CONST_METHOD0(
+ AppsWaitingForRegistration,
+ DataAccessor<application_manager::AppsWaitRegistrationSet>());
+
+ MOCK_METHOD1(ReplaceMobileWithHMIAppId,
+ void(smart_objects::SmartObject& message));
+ MOCK_METHOD1(ReplaceHMIWithMobileAppId,
+ void(smart_objects::SmartObject& message));
+ MOCK_METHOD1(GetAvailableSpaceForApp,
+ uint32_t(const std::string& folder_name));
+ MOCK_METHOD0(OnTimerSendTTSGlobalProperties, void());
+ MOCK_METHOD0(OnLowVoltage, void());
+ MOCK_METHOD0(OnWakeUp, void());
+ MOCK_METHOD4(OnStreamingConfigured,
+ void(uint32_t app_id,
+ protocol_handler::ServiceType service_type,
+ bool result,
+ std::vector<std::string>& rejected_params));
+ MOCK_METHOD1(ValidateMessageBySchema,
+ application_manager::MessageValidationResult(
+ const application_manager::Message& message));
+ MOCK_METHOD2(ProcessReconnection,
+ void(application_manager::ApplicationSharedPtr application,
+ const uint32_t connection_key));
+ MOCK_CONST_METHOD1(IsAppInReconnectMode,
+ bool(const std::string& policy_app_id));
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_APPLICATION_MANAGER_H_
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 eee121149e..25cf994566 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
@@ -57,6 +57,7 @@ class MockApplicationManagerSettings
const std::pair<uint32_t, int32_t>&());
MOCK_CONST_METHOD0(hash_string_size, uint32_t());
MOCK_CONST_METHOD0(app_storage_folder, const std::string&());
+ MOCK_CONST_METHOD0(app_info_storage, const std::string&());
MOCK_CONST_METHOD0(app_dir_quota, const uint32_t&());
MOCK_CONST_METHOD0(stop_streaming_timeout, uint32_t());
MOCK_CONST_METHOD0(application_list_update_timeout, uint32_t());
@@ -94,13 +95,14 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(app_resuming_timeout, const uint32_t&());
MOCK_CONST_METHOD0(attempts_to_open_resumption_db, uint16_t());
MOCK_CONST_METHOD0(open_attempt_timeout_ms_resumption_db, uint16_t());
- MOCK_METHOD1(config_file_name, void(const std::string& fileName));
+ MOCK_METHOD1(set_config_file_name, void(const std::string& fileName));
// The following line won't really compile, as the return
// type has multiple template arguments. To fix it, use a
// typedef for the return type.
MOCK_CONST_METHOD0(start_stream_retry_amount,
const std::pair<uint32_t, int32_t>&());
MOCK_CONST_METHOD0(app_icons_folder, const std::string&());
+ MOCK_CONST_METHOD0(plugins_folder, const std::string&());
MOCK_CONST_METHOD0(app_icons_folder_max_size, const uint32_t&());
MOCK_CONST_METHOD0(app_icons_amount_to_remove, const uint32_t&());
MOCK_CONST_METHOD0(list_files_response_size, const uint32_t&());
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 a4498f5934..931fd6cfb4 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
@@ -30,18 +30,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_POLICY_HANDLER_INTERFACE_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_POLICY_HANDLER_INTERFACE_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_POLICIES_MOCK_POLICY_HANDLER_INTERFACE_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_POLICIES_MOCK_POLICY_HANDLER_INTERFACE_H_
#include "application_manager/policies/policy_handler_interface.h"
+#include "application_manager/application_manager.h"
#include "gmock/gmock.h"
#include "policy/policy_types.h"
+#include "smart_objects/smart_object.h"
namespace test {
namespace components {
namespace policy_test {
-namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
public:
MOCK_METHOD0(LoadPolicyLibrary, bool());
@@ -63,18 +64,23 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_METHOD2(OnPermissionsUpdated,
void(const std::string& policy_app_id,
const policy::Permissions& permissions));
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
MOCK_METHOD3(OnSnapshotCreated,
void(const policy::BinaryMessage& pt_string,
const std::vector<int>& retry_delay_seconds,
- int timeout_exchange));
+ uint32_t timeout_exchange));
+#else // EXTERNAL_PROPRIETARY_MODE
+ MOCK_METHOD1(OnSnapshotCreated, void(const policy::BinaryMessage& pt_string));
+#endif // EXTERNAL_PROPRIETARY_MODE
+
MOCK_CONST_METHOD2(GetPriority,
bool(const std::string& policy_app_id,
std::string* priority));
- MOCK_METHOD5(CheckPermissions,
- void(const policy::PTString& app_id,
- const policy::PTString& hmi_level,
+ MOCK_METHOD4(CheckPermissions,
+ void(const application_manager::ApplicationSharedPtr app,
const policy::PTString& rpc,
- const policy::RPCParams& rpc_params,
+ const application_manager::RPCParams& rpc_params,
policy::CheckPermissionResult& result));
MOCK_CONST_METHOD1(GetNotificationsNumber,
uint32_t(const std::string& priority));
@@ -93,11 +99,13 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
policy::StringArray* nicknames));
MOCK_METHOD1(GetInitialAppData, bool(const std::string& application_id));
MOCK_METHOD2(GetUpdateUrls,
- void(int service_type, policy::EndpointUrls& end_points));
+ void(const uint32_t service_type,
+ policy::EndpointUrls& end_points));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
MOCK_METHOD0(ResetRetrySequence, void());
MOCK_METHOD0(NextRetryTimeout, uint32_t());
- MOCK_METHOD0(TimeoutExchange, int());
+ MOCK_CONST_METHOD0(TimeoutExchangeSec, uint32_t());
+ MOCK_CONST_METHOD0(TimeoutExchangeMSec, uint32_t());
MOCK_METHOD0(OnExceededTimeout, void());
MOCK_METHOD0(OnSystemReady, void());
MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
@@ -123,9 +131,17 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_METHOD2(SetDeviceInfo,
void(const std::string& device_id,
const policy::DeviceInfo& device_info));
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ MOCK_METHOD3(
+ OnAppPermissionConsent,
+ void(const uint32_t connection_key,
+ const policy::PermissionConsent& permissions,
+ const policy::ExternalConsentStatus& external_consent_status));
+#else
MOCK_METHOD2(OnAppPermissionConsent,
void(const uint32_t connection_key,
const policy::PermissionConsent& permissions));
+#endif
MOCK_METHOD3(OnGetUserFriendlyMessage,
void(const std::vector<std::string>& message_codes,
const std::string& language,
@@ -156,6 +172,7 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_METHOD1(OnUpdateHMIAppType,
void(std::map<std::string, policy::StringArray> app_hmi_types));
MOCK_METHOD1(OnCertificateUpdated, void(const std::string& certificate_data));
+ MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
MOCK_METHOD1(OnCertificateDecrypted, void(bool is_succeeded));
MOCK_METHOD0(CanUpdate, bool());
MOCK_METHOD2(OnDeviceConsentChanged,
@@ -165,12 +182,16 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
const std::string& policy_app_id));
MOCK_METHOD0(OnPTExchangeNeeded, void());
MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>& apps));
- MOCK_METHOD1(AddApplication, void(const std::string& application_id));
+ MOCK_METHOD2(
+ AddApplication,
+ policy::StatusNotifier(
+ const std::string& application_id,
+ const rpc::policy_table_interface_base::AppHmiTypes& hmi_types));
MOCK_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
MOCK_METHOD0(OnUpdateRequestSentToMobile, void());
MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
MOCK_METHOD0(OnAppsSearchStarted, void());
- MOCK_METHOD0(OnAppsSearchCompleted, void());
+ MOCK_METHOD1(OnAppsSearchCompleted, void(const bool trigger_ptu));
MOCK_METHOD1(OnAppRegisteredOnMobile,
void(const std::string& application_id));
MOCK_CONST_METHOD2(IsRequestTypeAllowed,
@@ -180,6 +201,11 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
GetAppRequestTypes,
const std::vector<std::string>(const std::string& policy_app_id));
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
+#endif // EXTERNAL_PROPRIETARY_MODE
+
MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
MOCK_METHOD2(Increment,
void(const std::string& app_id,
@@ -192,21 +218,62 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
void(const std::string& app_id,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds));
+#ifdef ENABLE_SECURITY
MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
+#endif // ENABLE_SECURITY
MOCK_CONST_METHOD0(get_settings, const policy::PolicySettings&());
MOCK_CONST_METHOD0(RemoteAppsUrl, const std::string());
- MOCK_METHOD2(GetServiceUrls,
+ MOCK_METHOD2(GetUpdateUrls,
void(const std::string& service_type,
policy::EndpointUrls& end_points));
+#ifdef SDL_REMOTE_CONTROL
+ MOCK_METHOD3(OnUpdateHMILevel,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level));
+ MOCK_METHOD3(CheckHMIType,
+ bool(const std::string& application_id,
+ mobile_apis::AppHMIType::eType hmi,
+ const smart_objects::SmartObject* app_types));
+
+ MOCK_METHOD2(CheckModule,
+ bool(const policy::PTString& app_id,
+ const policy::PTString& module));
+
+ MOCK_METHOD2(OnRemoteAppPermissionsChanged,
+ void(const std::string& device_id,
+ const std::string& application_id));
+
+ MOCK_METHOD3(OnUpdateHMIStatus,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level));
+ MOCK_CONST_METHOD2(GetModuleTypes,
+ bool(const std::string& policy_app_id,
+ std::vector<std::string>* modules));
+ MOCK_METHOD2(SetDefaultHmiTypes,
+ void(const std::string& application_id,
+ const smart_objects::SmartObject* app_types));
+ MOCK_METHOD2(OnDeviceSwitching,
+ void(const std::string& device_id_from,
+ const std::string& device_id_to));
+#endif // SDL_REMOTE_CONTROL
+
private:
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ MOCK_METHOD3(OnAppPermissionConsentInternal,
+ void(const uint32_t,
+ const policy::ExternalConsentStatus&,
+ policy::PermissionConsent&));
+#else
MOCK_METHOD2(OnAppPermissionConsentInternal,
- void(const uint32_t connection_key,
- policy::PermissionConsent& permissions));
+ void(const uint32_t, policy::PermissionConsent&));
+#endif
};
} // namespace policy_test
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_POLICY_HANDLER_INTERFACE_H_
+#endif // SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_POLICIES_MOCK_POLICY_HANDLER_INTERFACE_H_
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h b/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
index cc0f73126b..e8ed0e90e2 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_observer.h
@@ -49,6 +49,7 @@ class MockPolicyHandlerObserver : public ::policy::PolicyHandlerObserver {
MOCK_METHOD1(OnUpdateHMIAppType,
void(std::map<std::string, std::vector<std::string> >));
MOCK_METHOD1(OnCertificateUpdated, bool(const std::string&));
+ MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
};
} // namespace application_manager_test
} // namespace components
diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h
index e17224b097..f1416c999e 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -84,11 +84,18 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
void(uint32_t connection_key, uint8_t session_id));
MOCK_METHOD2(BindProtocolVersionWithSession,
void(uint32_t connection_key, uint8_t protocol_version));
+
+ // DEPRECATED
MOCK_CONST_METHOD4(GetDataOnSessionKey,
int32_t(uint32_t key,
uint32_t* app_id,
std::list<int32_t>* sessions_list,
uint32_t* device_id));
+ MOCK_CONST_METHOD4(GetDataOnSessionKey,
+ int32_t(uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ connection_handler::DeviceHandle* device_id));
MOCK_CONST_METHOD0(get_settings,
const connection_handler::ConnectionHandlerSettings&());
MOCK_METHOD0(get_session_observer,
@@ -96,6 +103,10 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
MOCK_METHOD0(get_device_discovery_starter, DevicesDiscoveryStarter&());
MOCK_CONST_METHOD1(GetConnectedDevicesMAC,
void(std::vector<std::string>& macs));
+ MOCK_METHOD3(NotifyServiceStartedResult,
+ void(uint32_t session_key,
+ bool result,
+ std::vector<std::string>& rejected_params));
};
} // namespace connection_handler_test
diff --git a/src/components/include/test/connection_handler/mock_connection_handler_observer.h b/src/components/include/test/connection_handler/mock_connection_handler_observer.h
new file mode 100644
index 0000000000..f1c605eaca
--- /dev/null
+++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_OBSERVER_H_
+
+#include "gmock/gmock.h"
+#include "connection_handler/connection_handler_observer.h"
+
+namespace test {
+namespace components {
+namespace connection_handler_test {
+
+class MockConnectionHandlerObserver
+ : public ::connection_handler::ConnectionHandlerObserver {
+ public:
+ MOCK_METHOD1(OnDeviceListUpdated,
+ void(const connection_handler::DeviceMap& device_list));
+ MOCK_METHOD0(OnFindNewApplicationsRequest, void());
+ MOCK_METHOD1(RemoveDevice,
+ void(const connection_handler::DeviceHandle& device_handle));
+ DEPRECATED MOCK_METHOD3(
+ OnServiceStartedCallback,
+ bool(const connection_handler::DeviceHandle& device_handle,
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type));
+ MOCK_METHOD4(OnServiceStartedCallback,
+ void(const connection_handler::DeviceHandle& device_handle,
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type,
+ const BsonObject* params));
+ MOCK_METHOD3(
+ OnServiceEndedCallback,
+ void(const int32_t& session_key,
+ const protocol_handler::ServiceType& type,
+ const connection_handler::CloseSessionReason& close_reason));
+ MOCK_CONST_METHOD1(
+ GetHandshakeContext,
+ security_manager::SSLContext::HandshakeContext(uint32_t key));
+
+ MOCK_METHOD2(OnDeviceSwitchingStart,
+ void(const connection_handler::Device& device_from,
+ const connection_handler::Device& device_to));
+ MOCK_METHOD1(OnDeviceSwitchingFinish, void(const std::string& device_uid));
+ MOCK_CONST_METHOD1(CheckAppIsNavi, bool(const uint32_t app_id));
+};
+
+} // namespace connection_handler_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_OBSERVER_H_
diff --git a/src/components/include/test/telemetry_monitor/mock_telemetry_observer.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_adapter.h
index e638048126..4f6559314d 100644
--- a/src/components/include/test/telemetry_monitor/mock_telemetry_observer.h
+++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_adapter.h
@@ -30,25 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
-#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_ADAPTER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_ADAPTER_H_
-#include <string>
#include "gmock/gmock.h"
-#include "transport_manager/telemetry_observer.h"
-#include "protocol/raw_message.h"
+#include "hmi_message_handler/hmi_message_adapter.h"
+
namespace test {
namespace components {
-namespace transport_manager_test {
+namespace hmi_message_handler_test {
+
+using hmi_message_handler::HMIMessageAdapter;
-class TMTelemetryObserverMock
- : public ::transport_manager::TMTelemetryObserver {
+class MockHMIMessageAdapter : public HMIMessageAdapter {
public:
- MOCK_METHOD1(StartRawMsg, void(const protocol_handler::RawMessage* ptr));
- MOCK_METHOD1(StopRawMsg, void(const protocol_handler::RawMessage* ptr));
+ MOCK_METHOD0(SubscribeTo, void());
};
-} // namespace transport_manager_test
+
+} // namespace hmi_message_handler_test
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
+#endif // SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_ADAPTER_H_
diff --git a/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h
index a3f73ac965..a7e93ec25c 100644
--- a/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h
+++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
-#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
#include <stdint.h>
#include "gmock/gmock.h"
@@ -44,9 +44,9 @@ namespace hmi_message_handler_test {
class MockHMIMessageHandlerSettings
: public ::hmi_message_handler::HMIMessageHandlerSettings {
public:
- MOCK_CONST_METHOD0(thread_min_stack_size, const uint64_t&());
+ MOCK_CONST_METHOD0(thread_min_stack_size, const uint64_t());
};
} // namespace hmi_message_handler_test
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
+#endif // SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
diff --git a/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h
new file mode 100644
index 0000000000..859d164231
--- /dev/null
+++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_OBSERVER_H_
+
+#include "gmock/gmock.h"
+#include "utils/singleton.h"
+#include "hmi_message_handler/hmi_message_observer.h"
+
+namespace test {
+namespace components {
+namespace hmi_message_handler_test {
+
+class MockHMIMessageObserver : public hmi_message_handler::HMIMessageObserver,
+ public utils::Singleton<MockHMIMessageObserver> {
+ public:
+ MOCK_METHOD1(OnMessageReceived,
+ void(utils::SharedPtr<application_manager::Message> message));
+ MOCK_METHOD1(OnErrorSending,
+ void(utils::SharedPtr<application_manager::Message> message));
+ virtual ~MockHMIMessageObserver() {}
+};
+
+} // namespace hmi_message_handler_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_OBSERVER_H_
diff --git a/src/components/include/test/hmi_message_handler/mock_hmi_message_handler.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_sender.h
index 19aa92f932..82b0fec738 100644
--- a/src/components/include/test/hmi_message_handler/mock_hmi_message_handler.h
+++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_sender.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_H_
-#define SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_SENDER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_SENDER_H_
#include "gmock/gmock.h"
#include "hmi_message_handler/hmi_message_handler.h"
@@ -40,15 +40,13 @@ namespace test {
namespace components {
namespace hmi_message_handler_test {
-using hmi_message_handler::HMIMessageAdapter;
-
-class MockHMIMessageHandler : public ::hmi_message_handler::HMIMessageHandler {
+class MockHMIMessageSender : public hmi_message_handler::HMIMessageSender {
public:
- MOCK_METHOD1(AddHMIMessageAdapter, void(HMIMessageAdapter* adapter));
- MOCK_METHOD1(RemoveHMIMessageAdapter, void(HMIMessageAdapter* adapter));
+ MOCK_METHOD1(SendMessageToHMI, void(MessageSharedPointer message));
};
+
} // namespace hmi_message_handler_test
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_H_
+#endif // SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_SENDER_H_
diff --git a/src/components/include/test/media_manager/mock_media_manager.h b/src/components/include/test/media_manager/mock_media_manager.h
new file mode 100644
index 0000000000..9cd2a05fc0
--- /dev/null
+++ b/src/components/include/test/media_manager/mock_media_manager.h
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_H_
+
+#include "gmock/gmock.h"
+#include "media_manager/media_manager.h"
+
+namespace test {
+namespace components {
+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_METHOD1(StopMicrophoneRecording, void(int32_t application_key));
+ MOCK_METHOD2(StartStreaming,
+ void(int32_t application_key,
+ protocol_handler::ServiceType service_type));
+ MOCK_METHOD2(StopStreaming,
+ void(int32_t application_key,
+ protocol_handler::ServiceType service_type));
+ MOCK_METHOD2(FramesProcessed,
+ void(int32_t application_key, int32_t frame_number));
+ MOCK_CONST_METHOD0(settings, const MediaManagerSettings&());
+};
+
+} // namespace media_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_H_
diff --git a/src/components/include/test/media_manager/mock_media_manager_settings.h b/src/components/include/test/media_manager/mock_media_manager_settings.h
index 5ef9e276b2..83e2252787 100644
--- a/src/components/include/test/media_manager/mock_media_manager_settings.h
+++ b/src/components/include/test/media_manager/mock_media_manager_settings.h
@@ -29,8 +29,8 @@
* 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_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_SETTINGS_H_
-#define SRC_COMPONENTS_INCLUDE__TEST_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_SETTINGS_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_SETTINGS_H_
#include <gmock/gmock.h>
#include <string>
@@ -60,4 +60,4 @@ class MockMediaManagerSettings : public ::media_manager::MediaManagerSettings {
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_INCLUDE__TEST_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_SETTINGS_H_
+#endif // SRC_COMPONENTS_INCLUDE_TEST_MEDIA_MANAGER_MOCK_MEDIA_MANAGER_SETTINGS_H_
diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
new file mode 100644
index 0000000000..5aa92446b6
--- /dev/null
+++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h
@@ -0,0 +1,259 @@
+/*
+ * 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.
+ */
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_CACHE_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_CACHE_MANAGER_H_
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+
+#include "policy/cache_manager_interface.h"
+
+namespace policy_table = rpc::policy_table_interface_base;
+
+using namespace ::policy;
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+class MockCacheManagerInterface : public ::policy::CacheManagerInterface {
+ public:
+ MOCK_CONST_METHOD2(GetConsentsPriority,
+ ConsentPriorityType(const std::string& device_id,
+ const std::string& application_id));
+ MOCK_METHOD4(CheckPermissions,
+ void(const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ CheckPermissionResult& result));
+ MOCK_METHOD0(IsPTPreloaded, bool());
+ MOCK_METHOD0(IgnitionCyclesBeforeExchange, int());
+ MOCK_METHOD1(KilometersBeforeExchange, int(int current));
+ MOCK_CONST_METHOD1(GetPermissionsList, bool(StringArray& perm_list));
+ MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate,
+ bool(Counters counter, int value));
+ MOCK_METHOD1(DaysBeforeExchange, int(uint16_t current));
+ MOCK_METHOD0(IncrementIgnitionCycles, void());
+
+ MOCK_METHOD2(SaveDeviceConsentToCache,
+ void(const std::string& device_id, const bool is_allowed));
+
+ MOCK_METHOD1(ResetCalculatedPermissionsForDevice,
+ void(const std::string& device_id));
+ MOCK_METHOD0(ResetIgnitionCycles, void());
+ MOCK_METHOD0(TimeoutResponse, int());
+ MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
+ MOCK_CONST_METHOD1(IsDeviceConsentCached, bool(const std::string& device_id));
+ MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
+ MOCK_CONST_METHOD1(GetDeviceConsent,
+ DeviceConsent(const std::string& device_id));
+ MOCK_METHOD2(SetDeviceConsent,
+ void(const std::string& device_id, bool is_allowed));
+
+ MOCK_CONST_METHOD2(HasDeviceSpecifiedConsent,
+ bool(const std::string& device_id, const bool is_allowed));
+ MOCK_CONST_METHOD1(GetCachedDeviceConsent,
+ DeviceConsent(const std::string& device_id));
+ MOCK_METHOD1(SetVINValue, bool(const std::string& value));
+ MOCK_METHOD3(GetUserFriendlyMsg,
+ std::vector<UserFriendlyMessage>(
+ const std::vector<std::string>& msg_codes,
+ const std::string& language,
+ const std::string& active_hmi_language));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type, EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_METHOD1(
+ GetNotificationsNumber,
+ policy_table::NumberOfNotificationsType(const std::string& priority));
+ MOCK_CONST_METHOD2(GetPriority,
+ bool(const std::string& policy_app_id,
+ std::string& priority));
+ MOCK_METHOD2(Init,
+ bool(const std::string& file_name,
+ const PolicySettings* settings));
+ MOCK_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>());
+ MOCK_METHOD1(ApplyUpdate, bool(const policy_table::Table& update_pt));
+ MOCK_METHOD1(Save, bool(const policy_table::Table& table));
+ MOCK_CONST_METHOD0(UpdateRequired, bool());
+ MOCK_METHOD1(SaveUpdateRequired, void(bool status));
+ MOCK_METHOD3(GetInitialAppData,
+ bool(const std::string& app_id,
+ StringArray& nicknames,
+ StringArray& app_hmi_types));
+ MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
+ MOCK_METHOD1(GetFunctionalGroupings,
+ bool(policy_table::FunctionalGroupings& groups));
+ MOCK_CONST_METHOD1(IsApplicationRepresented, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(IsDefaultPolicy, bool(const std::string& app_id));
+ MOCK_METHOD1(SetIsDefault, bool(const std::string& app_id));
+ MOCK_METHOD1(SetIsPredata, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(IsPredataPolicy, bool(const std::string& app_id));
+ MOCK_METHOD1(SetDefaultPolicy, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
+ MOCK_CONST_METHOD2(GetDefaultHMI,
+ bool(const std::string& app_id, std::string& default_hmi));
+ MOCK_METHOD0(ResetUserConsent, bool());
+ MOCK_CONST_METHOD3(GetUserPermissionsForDevice,
+ bool(const std::string& device_id,
+ StringArray& consented_groups,
+ StringArray& disallowed_groups));
+ MOCK_METHOD3(GetPermissionsForApp,
+ bool(const std::string& device_id,
+ const std::string& app_id,
+ FunctionalIdType& group_types));
+ MOCK_CONST_METHOD2(
+ GetDeviceGroupsFromPolicies,
+ bool(rpc::policy_table_interface_base::Strings& groups,
+ rpc::policy_table_interface_base::Strings& preconsented_groups));
+ MOCK_METHOD2(AddDevice,
+ bool(const std::string& device_id,
+ const std::string& connection_type));
+ MOCK_METHOD8(SetDeviceData,
+ bool(const std::string& device_id,
+ const std::string& hardware,
+ const std::string& firmware,
+ const std::string& os,
+ const std::string& os_version,
+ const std::string& carrier,
+ const uint32_t number_of_ports,
+ const std::string& connection_type));
+ MOCK_METHOD3(SetUserPermissionsForDevice,
+ bool(const std::string& device_id,
+ const StringArray& consented_groups,
+ const StringArray& disallowed_groups));
+ MOCK_METHOD2(ReactOnUserDevConsentForApp,
+ bool(const std::string& app_id, bool is_device_allowed));
+ MOCK_METHOD2(SetUserPermissionsForApp,
+ bool(const PermissionConsent& permissions,
+ bool* out_app_permissions_changed));
+ MOCK_METHOD3(SetMetaInfo,
+ bool(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language));
+ MOCK_CONST_METHOD0(IsMetaInfoPresent, bool());
+ MOCK_METHOD1(SetSystemLanguage, bool(const std::string& language));
+ MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
+ MOCK_METHOD2(Increment,
+ void(const std::string& app_id,
+ usage_statistics::AppCounterId type));
+ MOCK_METHOD3(Set,
+ void(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value));
+ MOCK_METHOD3(Add,
+ void(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int seconds));
+ MOCK_METHOD2(CountUnconsentedGroups,
+ int(const std::string& policy_app_id,
+ const std::string& device_id));
+ MOCK_METHOD1(GetFunctionalGroupNames, bool(FunctionalGroupNames& names));
+ MOCK_METHOD2(GetAllAppGroups,
+ void(const std::string& app_id,
+ FunctionalGroupIDs& all_group_ids));
+ MOCK_METHOD2(GetPreConsentedGroups,
+ void(const std::string& app_id,
+ FunctionalGroupIDs& preconsented_groups));
+ MOCK_METHOD4(GetConsentedGroups,
+ void(const std::string& device_id,
+ const std::string& app_id,
+ FunctionalGroupIDs& allowed_groups,
+ FunctionalGroupIDs& disallowed_groups));
+ MOCK_METHOD3(GetUnconsentedGroups,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ FunctionalGroupIDs& unconsented_groups));
+ MOCK_METHOD2(RemoveAppConsentForGroup,
+ void(const std::string& app_id, const std::string& group_name));
+ MOCK_METHOD1(SetPredataPolicy, bool(const std::string& app_id));
+ MOCK_METHOD0(CleanupUnpairedDevices, bool());
+ MOCK_METHOD2(SetUnpairedDevice,
+ bool(const std::string& device_id, bool unpaired));
+ MOCK_METHOD1(UnpairedDevicesList, bool(DeviceIds& device_ids));
+ MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
+ MOCK_METHOD0(LoadFromBackup, bool());
+ MOCK_METHOD2(LoadFromFile,
+ bool(const std::string& file_name, policy_table::Table&));
+ MOCK_METHOD0(Backup, void());
+ MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
+ MOCK_CONST_METHOD2(GetAppRequestTypes,
+ void(const std::string& policy_app_id,
+ std::vector<std::string>& request_types));
+ MOCK_METHOD1(GetHMIAppTypeAfterUpdate,
+ void(std::map<std::string, StringArray>& app_hmi_types));
+
+ MOCK_CONST_METHOD2(AppHasHMIType,
+ bool(const std::string& application_id,
+ policy_table::AppHMIType hmi_type));
+
+ MOCK_METHOD0(ResetCalculatedPermissions, void());
+ MOCK_METHOD3(AddCalculatedPermissions,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const policy::Permissions& permissions));
+ MOCK_METHOD3(IsPermissionsCalculated,
+ bool(const std::string& device_id,
+ const std::string& policy_app_id,
+ policy::Permissions& permission));
+ MOCK_CONST_METHOD0(GetPT, utils::SharedPtr<policy_table::Table>());
+ MOCK_CONST_METHOD0(GetMetaInfo, const MetaInfo());
+ MOCK_CONST_METHOD0(GetCertificate, std::string());
+ MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&));
+ MOCK_METHOD1(set_settings, void(const PolicySettings* settings));
+ MOCK_METHOD1(GetHMITypes,
+ const policy_table::AppHMITypes*(const std::string& app_id));
+ MOCK_METHOD1(GetGroups, const policy_table::Strings&(const PTString& app_id));
+
+ MOCK_METHOD1(SetExternalConsentStatus, bool(const ExternalConsentStatus&));
+ MOCK_METHOD0(GetExternalConsentStatus, ExternalConsentStatus());
+ MOCK_METHOD0(GetExternalConsentEntities, ExternalConsentStatus());
+ MOCK_METHOD1(GetGroupsWithSameEntities,
+ GroupsByExternalConsentStatus(const ExternalConsentStatus&));
+ MOCK_METHOD0(GetKnownLinksFromPT, std::map<std::string, std::string>());
+ MOCK_METHOD1(SetExternalConsentForApp, void(const PermissionConsent&));
+ MOCK_METHOD2(OnDeviceSwitching,
+ void(const std::string& device_id_from,
+ const std::string& device_id_to));
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_CACHE_MANAGER_H_
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
new file mode 100644
index 0000000000..ad2f1fd56c
--- /dev/null
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_listener.h
@@ -0,0 +1,111 @@
+/* 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_LISTENER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_LISTENER_H_
+
+#include <string>
+#include <map>
+#include <queue>
+#include <vector>
+
+#include "gmock/gmock.h"
+
+#include "policy/policy_listener.h"
+#include "rpc_base/rpc_base.h"
+#include "policy/policy_table/types.h"
+#include "utils/custom_string.h"
+
+namespace policy_table = ::rpc::policy_table_interface_base;
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+namespace custom_str = utils::custom_string;
+
+class MockPolicyListener : public ::policy::PolicyListener {
+ public:
+ MOCK_METHOD3(OnPermissionsUpdated,
+ void(const std::string& policy_app_id,
+ const policy::Permissions& permissions,
+ const policy::HMILevel& default_hmi));
+ MOCK_METHOD2(OnPermissionsUpdated,
+ void(const std::string& policy_app_id,
+ const policy::Permissions& permissions));
+ MOCK_METHOD1(OnPendingPermissionChange,
+ void(const std::string& policy_app_id));
+ MOCK_METHOD1(OnUpdateStatusChanged, void(const std::string& status));
+ MOCK_METHOD1(OnCurrentDeviceIdUpdateRequired,
+ std::string(const std::string& policy_app_id));
+ MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
+ MOCK_METHOD1(GetAppName,
+ custom_str::CustomString(const std::string& policy_app_id));
+ MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, void());
+ MOCK_METHOD2(OnDeviceConsentChanged,
+ void(const std::string& device_id, bool is_allowed));
+ MOCK_METHOD1(OnUpdateHMIAppType,
+ void(std::map<std::string, policy::StringArray>));
+ MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>&));
+ MOCK_METHOD3(OnSnapshotCreated,
+ void(const policy::BinaryMessage& pt_string,
+ const std::vector<int>& retry_seconds,
+ uint32_t timeout_exceed));
+ MOCK_METHOD0(CanUpdate, bool());
+ MOCK_METHOD1(OnCertificateUpdated, void(const std::string&));
+ MOCK_METHOD1(OnPTUFinished, void(const bool ptu_result));
+ MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
+ void(const policy::AppPermissions&, const std::string&));
+ MOCK_METHOD1(GetDevicesIds,
+ std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_METHOD3(OnUpdateHMILevel,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level));
+ MOCK_CONST_METHOD1(GetRegisteredLinks,
+ void(std::map<std::string, std::string>&));
+#ifdef SDL_REMOTE_CONTROL
+ MOCK_METHOD1(OnRemoteAllowedChanged, void(bool new_consent));
+ MOCK_METHOD2(OnRemoteAppPermissionsChanged,
+ void(const std::string& device_id,
+ const std::string& application_id));
+ MOCK_METHOD3(OnUpdateHMIStatus,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level));
+#endif // SDL_REMOTE_CONTROL
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_LISTENER_H_
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
new file mode 100644
index 0000000000..9e487da4ba
--- /dev/null
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h
@@ -0,0 +1,226 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_MANAGER_H_
+
+#include <string>
+#include <vector>
+#include "gmock/gmock.h"
+#include "policy/policy_listener.h"
+#include "policy/policy_types.h"
+#include "policy/usage_statistics/statistics_manager.h"
+
+#include "rpc_base/rpc_base.h"
+#include "policy/policy_table/types.h"
+#include "policy/policy_manager.h"
+
+namespace policy_table = ::rpc::policy_table_interface_base;
+
+using namespace policy;
+
+namespace test {
+namespace components {
+namespace policy_manager_test {
+
+class MockPolicyManager : public PolicyManager {
+ public:
+ MOCK_METHOD1(set_listener, void(PolicyListener* listener));
+ MOCK_METHOD2(InitPT,
+ bool(const std::string& file_name,
+ const PolicySettings* settings));
+ MOCK_METHOD2(LoadPT,
+ bool(const std::string& file, const BinaryMessage& pt_content));
+ MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
+ MOCK_METHOD1(GetUpdateUrl, std::string(int service_type));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type, EndpointUrls& out_end_points));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_METHOD0(RequestPTUpdate, void());
+ MOCK_METHOD5(CheckPermissions,
+ void(const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ const RPCParams& rpc_params,
+ CheckPermissionResult& result));
+ MOCK_METHOD0(ResetUserConsent, bool());
+ MOCK_CONST_METHOD0(GetPolicyTableStatus, std::string());
+ MOCK_METHOD1(KmsChanged, void(int kilometers));
+ MOCK_METHOD0(IncrementIgnitionCycles, void());
+ MOCK_METHOD0(ForcePTExchange, std::string());
+ MOCK_METHOD0(ForcePTExchangeAtUserRequest, std::string());
+ MOCK_METHOD0(ResetRetrySequence, void());
+ MOCK_METHOD0(NextRetryTimeout, int());
+ MOCK_METHOD0(TimeoutExchangeMSec, uint32_t());
+ MOCK_METHOD0(RetrySequenceDelaysSeconds, const std::vector<int>());
+ MOCK_METHOD0(OnExceededTimeout, void());
+ MOCK_METHOD0(OnUpdateStarted, void());
+ MOCK_CONST_METHOD1(GetUserConsentForDevice,
+ DeviceConsent(const std::string& device_id));
+ MOCK_METHOD3(
+ GetUserConsentForApp,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ std::vector<policy::FunctionalGroupPermission>& permissions));
+ MOCK_METHOD2(SetUserConsentForDevice,
+ void(const std::string& device_id, const bool is_allowed));
+ MOCK_METHOD2(ReactOnUserDevConsentForApp,
+ bool(const std::string& app_id, bool is_device_allowed));
+ MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
+
+ MOCK_METHOD3(GetInitialAppData,
+ bool(const std::string&,
+ policy::StringArray*,
+ policy::StringArray*));
+
+ MOCK_METHOD2(AddDevice,
+ void(const std::string& device_id,
+ const std::string& connection_type));
+ MOCK_METHOD2(SetDeviceInfo,
+ void(const std::string& device_id,
+ const policy::DeviceInfo& device_info));
+ MOCK_METHOD2(SetUserConsentForApp,
+ void(const policy::PermissionConsent& permissions,
+ const NotificationMode mode));
+ MOCK_CONST_METHOD2(GetDefaultHmi,
+ bool(const std::string& policy_app_id,
+ std::string* default_hmi));
+ MOCK_CONST_METHOD2(GetPriority,
+ bool(const std::string& policy_app_id,
+ std::string* priority));
+ MOCK_METHOD3(GetUserFriendlyMessages,
+ std::vector<policy::UserFriendlyMessage>(
+ const std::vector<std::string>& message_code,
+ const std::string& language,
+ const std::string& active_hmi_language));
+ MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
+ MOCK_METHOD3(
+ GetPermissionsForApp,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ std::vector<policy::FunctionalGroupPermission>& permissions));
+ MOCK_METHOD1(GetAppPermissionsChanges,
+ policy::AppPermissions(const std::string& policy_app_id));
+ MOCK_METHOD1(RemovePendingPermissionChanges, void(const std::string& app_id));
+ MOCK_CONST_METHOD1(GetCurrentDeviceId,
+ std::string&(const std::string& policy_app_id));
+ MOCK_METHOD1(SetSystemLanguage, void(const std::string& language));
+ MOCK_METHOD3(SetSystemInfo,
+ void(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language));
+ MOCK_METHOD1(SendNotificationOnPermissionsUpdated,
+ void(const std::string& application_id));
+ MOCK_METHOD1(MarkUnpairedDevice, void(const std::string& device_id));
+ MOCK_METHOD2(
+ AddApplication,
+ StatusNotifier(
+ const std::string& application_id,
+ const rpc::policy_table_interface_base::AppHmiTypes& hmi_types));
+#ifdef SDL_REMOTE_CONTROL
+ MOCK_METHOD2(SetDefaultHmiTypes,
+ void(const std::string& application_id,
+ const std::vector<int>& hmi_types));
+ MOCK_METHOD2(GetHMITypes,
+ bool(const std::string& application_id,
+ std::vector<int>* app_types));
+ MOCK_METHOD2(CheckModule,
+ bool(const PTString& app_id, const PTString& module));
+ MOCK_METHOD2(SendAppPermissionsChanged,
+ void(const std::string& device_id,
+ const std::string& application_id));
+ MOCK_CONST_METHOD2(GetModuleTypes,
+ bool(const std::string& policy_app_id,
+ std::vector<std::string>* modules));
+ MOCK_METHOD1(set_access_remote,
+ void(utils::SharedPtr<AccessRemote> access_remote));
+#endif // SDL_REMOTE_CONTROL
+
+ MOCK_METHOD0(CleanupUnpairedDevices, bool());
+ MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
+ MOCK_METHOD0(OnSystemReady, void());
+ MOCK_CONST_METHOD1(GetNotificationsNumber,
+ uint32_t(const std::string& priority));
+ MOCK_METHOD1(SetVINValue, void(const std::string& value));
+ MOCK_CONST_METHOD1(IsPredataPolicy, bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
+ MOCK_METHOD1(SaveUpdateStatusRequired, void(bool is_update_needed));
+ MOCK_METHOD0(OnAppsSearchStarted, void());
+ MOCK_METHOD1(OnAppsSearchCompleted, void(const bool trigger_ptu));
+ MOCK_METHOD1(OnAppRegisteredOnMobile,
+ void(const std::string& application_id));
+ MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_CONST_METHOD1(
+ GetAppRequestTypes,
+ const std::vector<std::string>(const std::string policy_app_id));
+ MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
+ MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
+ MOCK_CONST_METHOD0(HasCertificate, bool());
+ MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&));
+ MOCK_METHOD0(ExceededIgnitionCycles, bool());
+ MOCK_METHOD0(ExceededDays, bool());
+ MOCK_METHOD0(StartPTExchange, void());
+ MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
+ MOCK_METHOD2(Increment,
+ void(const std::string& app_id,
+ usage_statistics::AppCounterId type));
+ MOCK_METHOD3(Set,
+ void(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value));
+ MOCK_METHOD3(Add,
+ void(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int32_t timespan_seconds));
+ MOCK_CONST_METHOD0(get_settings, const PolicySettings&());
+ MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings));
+ MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls));
+ MOCK_CONST_METHOD2(RetrySequenceUrl,
+ AppIdURL(const struct RetrySequenceURL&,
+ const EndpointUrls& urls));
+ MOCK_METHOD1(SetExternalConsentStatus, bool(const ExternalConsentStatus&));
+ MOCK_METHOD0(GetExternalConsentStatus, ExternalConsentStatus());
+ MOCK_CONST_METHOD1(IsNeedToUpdateExternalConsentStatus,
+ bool(const ExternalConsentStatus&));
+ MOCK_METHOD2(OnDeviceSwitching,
+ void(const std::string& device_id_from,
+ const std::string& device_id_to));
+};
+} // namespace policy_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_EXTERNAL_POLICY_MOCK_POLICY_MANAGER_H_
diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h b/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h
new file mode 100644
index 0000000000..eafc1df4fe
--- /dev/null
+++ b/src/components/include/test/policy/policy_external/policy/mock_policy_settings.h
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_SETTINGS_H_
+
+#include "gmock/gmock.h"
+#include <string>
+#include "policy/policy_settings.h"
+
+namespace test {
+namespace components {
+namespace policy_handler_test {
+
+class MockPolicySettings : public ::policy::PolicySettings {
+ public:
+ MOCK_CONST_METHOD0(enable_policy, bool());
+ MOCK_CONST_METHOD0(preloaded_pt_file, const std::string&());
+ MOCK_CONST_METHOD0(app_storage_folder, const std::string&());
+ MOCK_CONST_METHOD0(attempts_to_open_policy_db, uint16_t());
+ MOCK_CONST_METHOD0(open_attempt_timeout_ms, uint16_t());
+ MOCK_CONST_METHOD0(policies_snapshot_file_name, const std::string&());
+ MOCK_CONST_METHOD0(system_files_path, const std::string&());
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_SETTINGS_H_
diff --git a/src/components/include/test/policy/policy_external/policy/usage_statistics/mock_app_stopwatch.h b/src/components/include/test/policy/policy_external/policy/usage_statistics/mock_app_stopwatch.h
new file mode 100644
index 0000000000..3cbb878655
--- /dev/null
+++ b/src/components/include/test/policy/policy_external/policy/usage_statistics/mock_app_stopwatch.h
@@ -0,0 +1,54 @@
+/* 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.
+ */
+
+#ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_APP_STOPWATCH_H_
+#define SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_APP_STOPWATCH_H_
+
+#include "gmock/gmock.h"
+#include "policy/usage_statistics/app_stopwatch.h"
+#include "policy/usage_statistics/statistics_manager.h"
+
+namespace test {
+namespace components {
+namespace usage_statistics_test {
+
+class MockAppStopwatch : public usage_statistics::AppStopwatch {
+ public:
+ MOCK_METHOD1(Start, void(usage_statistics::AppStopwatchId stopwatch_type));
+ MOCK_METHOD1(Switch, void(usage_statistics::AppStopwatchId stopwatch_type));
+ MOCK_METHOD0(WriteTime, void());
+};
+
+} // namespace usage_statistics_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_POLICY_POLICY_REGULAR_TEST_INCLUDE_MOCK_APP_STOPWATCH_H_
diff --git a/src/components/include/test/policy/mock_statistics_manager.h b/src/components/include/test/policy/policy_external/policy/usage_statistics/mock_statistics_manager.h
index e58adea124..e58adea124 100644
--- a/src/components/include/test/policy/mock_statistics_manager.h
+++ b/src/components/include/test/policy/policy_external/policy/usage_statistics/mock_statistics_manager.h
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
new file mode 100644
index 0000000000..ed3a5088c1
--- /dev/null
+++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h
@@ -0,0 +1,223 @@
+/*
+ * 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_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_CACHE_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_CACHE_MANAGER_H_
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+
+#include "policy/cache_manager_interface.h"
+
+namespace test {
+namespace components {
+namespace policy_test {
+namespace policy_table = rpc::policy_table_interface_base;
+using namespace ::policy;
+
+class MockCacheManagerInterface : public CacheManagerInterface {
+ public:
+ MOCK_METHOD4(CheckPermissions,
+ void(const policy_table::Strings& groups,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ CheckPermissionResult& result));
+ MOCK_METHOD0(IsPTPreloaded, bool());
+ MOCK_METHOD0(IgnitionCyclesBeforeExchange, int());
+ MOCK_METHOD1(KilometersBeforeExchange, int(int current));
+ MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate,
+ bool(Counters counter, int value));
+ MOCK_METHOD1(DaysBeforeExchange, int(int current));
+ MOCK_METHOD0(IncrementIgnitionCycles, void());
+ MOCK_METHOD0(ResetIgnitionCycles, void());
+ MOCK_METHOD0(TimeoutResponse, int());
+ MOCK_METHOD1(SecondsBetweenRetries, bool(std::vector<int>& seconds));
+ MOCK_CONST_METHOD0(GetVehicleInfo, const VehicleInfo());
+ MOCK_METHOD1(SetVINValue, bool(const std::string& value));
+ MOCK_METHOD2(GetUserFriendlyMsg,
+ std::vector<UserFriendlyMessage>(
+ const std::vector<std::string>& msg_codes,
+ const std::string& language));
+
+ MOCK_METHOD1(
+ GetNotificationsNumber,
+ policy_table::NumberOfNotificationsType(const std::string& priority));
+ MOCK_CONST_METHOD2(GetPriority,
+ bool(const std::string& policy_app_id,
+ std::string& priority));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type, EndpointUrls& out_end_points));
+ MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
+ MOCK_METHOD2(Init,
+ bool(const std::string& file_name,
+ const PolicySettings* settings));
+ MOCK_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>());
+ MOCK_METHOD1(ApplyUpdate, bool(const policy_table::Table& update_pt));
+ MOCK_METHOD1(Save, bool(const policy_table::Table& table));
+ MOCK_CONST_METHOD0(UpdateRequired, bool());
+ MOCK_METHOD1(SaveUpdateRequired, void(bool status));
+ MOCK_METHOD3(GetInitialAppData,
+ bool(const std::string& app_id,
+ StringArray& nicknames,
+ StringArray& app_hmi_types));
+ MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
+ MOCK_METHOD1(GetFunctionalGroupings,
+ bool(policy_table::FunctionalGroupings& groups));
+ MOCK_CONST_METHOD1(IsApplicationRepresented, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(IsDefaultPolicy, bool(const std::string& app_id));
+ MOCK_METHOD1(SetIsDefault, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(IsPredataPolicy, bool(const std::string& app_id));
+ MOCK_METHOD1(SetDefaultPolicy, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
+ MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
+ MOCK_CONST_METHOD2(GetDefaultHMI,
+ bool(const std::string& app_id, std::string& default_hmi));
+ MOCK_METHOD0(ResetUserConsent, bool());
+ MOCK_CONST_METHOD3(GetUserPermissionsForDevice,
+ bool(const std::string& device_id,
+ StringArray& consented_groups,
+ StringArray& disallowed_groups));
+ MOCK_METHOD3(GetPermissionsForApp,
+ bool(const std::string& device_id,
+ const std::string& app_id,
+ FunctionalIdType& group_types));
+ MOCK_CONST_METHOD2(
+ GetDeviceGroupsFromPolicies,
+ bool(rpc::policy_table_interface_base::Strings& groups,
+ rpc::policy_table_interface_base::Strings& preconsented_groups));
+ MOCK_METHOD2(AddDevice,
+ bool(const std::string& device_id,
+ const std::string& connection_type));
+ MOCK_METHOD8(SetDeviceData,
+ bool(const std::string& device_id,
+ const std::string& hardware,
+ const std::string& firmware,
+ const std::string& os,
+ const std::string& os_version,
+ const std::string& carrier,
+ const uint32_t number_of_ports,
+ const std::string& connection_type));
+ MOCK_METHOD3(SetUserPermissionsForDevice,
+ bool(const std::string& device_id,
+ const StringArray& consented_groups,
+ const StringArray& disallowed_groups));
+ MOCK_METHOD2(ReactOnUserDevConsentForApp,
+ bool(const std::string& app_id, bool is_device_allowed));
+ MOCK_METHOD1(SetUserPermissionsForApp,
+ bool(const PermissionConsent& permissions));
+ MOCK_METHOD3(SetMetaInfo,
+ bool(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language));
+ MOCK_CONST_METHOD0(IsMetaInfoPresent, bool());
+ MOCK_METHOD1(SetSystemLanguage, bool(const std::string& language));
+ MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
+ MOCK_METHOD2(Increment,
+ void(const std::string& app_id,
+ usage_statistics::AppCounterId type));
+ MOCK_METHOD3(Set,
+ void(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value));
+ MOCK_METHOD3(Add,
+ void(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int seconds));
+ MOCK_METHOD2(CountUnconsentedGroups,
+ int(const std::string& policy_app_id,
+ const std::string& device_id));
+ MOCK_METHOD1(GetFunctionalGroupNames, bool(FunctionalGroupNames& names));
+ MOCK_METHOD2(GetAllAppGroups,
+ void(const std::string& app_id,
+ FunctionalGroupIDs& all_group_ids));
+ MOCK_METHOD2(GetPreConsentedGroups,
+ void(const std::string& app_id,
+ FunctionalGroupIDs& preconsented_groups));
+ MOCK_METHOD4(GetConsentedGroups,
+ void(const std::string& device_id,
+ const std::string& app_id,
+ FunctionalGroupIDs& allowed_groups,
+ FunctionalGroupIDs& disallowed_groups));
+ MOCK_METHOD3(GetUnconsentedGroups,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ FunctionalGroupIDs& unconsented_groups));
+ MOCK_METHOD2(RemoveAppConsentForGroup,
+ void(const std::string& app_id, const std::string& group_name));
+ MOCK_METHOD1(SetPredataPolicy, bool(const std::string& app_id));
+ MOCK_METHOD0(CleanupUnpairedDevices, bool());
+ MOCK_METHOD2(SetUnpairedDevice,
+ bool(const std::string& device_id, bool unpaired));
+ MOCK_METHOD1(UnpairedDevicesList, bool(DeviceIds& device_ids));
+ MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
+ MOCK_METHOD0(LoadFromBackup, bool());
+ MOCK_METHOD2(LoadFromFile,
+ bool(const std::string& file_name, policy_table::Table&));
+ MOCK_METHOD0(Backup, void());
+ MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
+ MOCK_CONST_METHOD2(GetAppRequestTypes,
+ void(const std::string& policy_app_id,
+ std::vector<std::string>& request_types));
+ MOCK_METHOD1(GetHMIAppTypeAfterUpdate,
+ void(std::map<std::string, StringArray>& app_hmi_types));
+ MOCK_METHOD0(ResetCalculatedPermissions, void());
+ MOCK_METHOD3(AddCalculatedPermissions,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const policy::Permissions& permissions));
+ MOCK_METHOD3(IsPermissionsCalculated,
+ bool(const std::string& device_id,
+ const std::string& policy_app_id,
+ policy::Permissions& permission));
+ MOCK_CONST_METHOD0(pt, utils::SharedPtr<policy_table::Table>());
+ MOCK_METHOD1(GetHMITypes,
+ const policy_table::AppHMITypes*(const std::string& app_id));
+ MOCK_CONST_METHOD0(GetCertificate, std::string());
+ MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&));
+ MOCK_METHOD1(GetGroups, const policy_table::Strings&(const PTString& app_id));
+ MOCK_CONST_METHOD2(AppHasHMIType,
+ bool(const std::string& application_id,
+ policy_table::AppHMIType hmi_type));
+ MOCK_METHOD2(OnDeviceSwitching,
+ void(const std::string& device_id_from,
+ const std::string& device_id_to));
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_CACHE_MANAGER_H_
diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
new file mode 100644
index 0000000000..d98a0279d7
--- /dev/null
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_listener.h
@@ -0,0 +1,104 @@
+/* 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_LISTENER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_LISTENER_H_
+
+#include <string>
+
+#include "gmock/gmock.h"
+
+#include "policy/policy_listener.h"
+#include "rpc_base/rpc_base.h"
+#include "policy/policy_table/types.h"
+#include "utils/custom_string.h"
+
+namespace policy_table = ::rpc::policy_table_interface_base;
+
+namespace test {
+namespace components {
+namespace policy_test {
+
+namespace custom_str = utils::custom_string;
+
+class MockPolicyListener : public ::policy::PolicyListener {
+ public:
+ MOCK_METHOD3(OnPermissionsUpdated,
+ void(const std::string& policy_app_id,
+ const policy::Permissions& permissions,
+ const policy::HMILevel& default_hmi));
+ MOCK_METHOD2(OnPermissionsUpdated,
+ void(const std::string& policy_app_id,
+ const policy::Permissions& permissions));
+ MOCK_METHOD1(OnPendingPermissionChange,
+ void(const std::string& policy_app_id));
+ MOCK_METHOD1(OnUpdateStatusChanged, void(const std::string& status));
+ MOCK_METHOD1(OnCurrentDeviceIdUpdateRequired,
+ std::string(const std::string& policy_app_id));
+ MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
+ MOCK_METHOD1(GetAppName,
+ custom_str::CustomString(const std::string& policy_app_id));
+ MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, void());
+ MOCK_METHOD2(OnDeviceConsentChanged,
+ void(const std::string& device_id, bool is_allowed));
+ MOCK_METHOD1(OnUpdateHMIAppType,
+ void(std::map<std::string, policy::StringArray>));
+ MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>&));
+ MOCK_METHOD1(OnSnapshotCreated, void(const policy::BinaryMessage& pt_string));
+ MOCK_METHOD0(CanUpdate, bool());
+ MOCK_METHOD1(OnCertificateUpdated, void(const std::string&));
+ MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
+ void(const policy::AppPermissions&, const std::string&));
+ MOCK_METHOD3(OnUpdateHMILevel,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level));
+ MOCK_METHOD1(GetDevicesIds,
+ std::vector<std::string>(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(GetRegisteredLinks,
+ void(std::map<std::string, std::string>&));
+#ifdef SDL_REMOTE_CONTROL
+ MOCK_METHOD1(OnRemoteAllowedChanged, void(bool new_consent));
+ MOCK_METHOD2(OnRemoteAppPermissionsChanged,
+ void(const std::string& device_id,
+ const std::string& application_id));
+ MOCK_METHOD3(OnUpdateHMIStatus,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ const std::string& hmi_level));
+#endif // SDL_REMOTE_CONTROL
+};
+
+} // namespace policy_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_LISTENER_H_
diff --git a/src/components/include/test/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
index a6169cdebc..82012b83c7 100644
--- a/src/components/include/test/policy/mock_policy_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_
-#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_MANAGER_H_
#include <string>
#include <vector>
@@ -45,12 +45,14 @@
namespace policy_table = ::rpc::policy_table_interface_base;
-using namespace policy;
-
namespace test {
namespace components {
namespace policy_manager_test {
+namespace {
+using namespace policy;
+}
+
class MockPolicyManager : public PolicyManager {
public:
MOCK_METHOD1(set_listener, void(PolicyListener* listener));
@@ -60,8 +62,12 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD2(LoadPT,
bool(const std::string& file, const BinaryMessage& pt_content));
MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
- MOCK_CONST_METHOD1(GetUpdateUrl, std::string(int service_type));
- MOCK_METHOD2(GetUpdateUrls, void(int service_type, EndpointUrls& end_points));
+
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const uint32_t service_type, EndpointUrls& out_end_points));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(const std::string& service_type,
+ EndpointUrls& out_end_points));
MOCK_METHOD0(RequestPTUpdate, bool());
MOCK_METHOD5(CheckPermissions,
void(const PTString& app_id,
@@ -74,9 +80,10 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD1(KmsChanged, void(int kilometers));
MOCK_METHOD0(IncrementIgnitionCycles, void());
MOCK_METHOD0(ForcePTExchange, std::string());
+ MOCK_METHOD0(ForcePTExchangeAtUserRequest, std::string());
MOCK_METHOD0(ResetRetrySequence, void());
MOCK_METHOD0(NextRetryTimeout, uint32_t());
- MOCK_METHOD0(TimeoutExchange, int());
+ MOCK_METHOD0(TimeoutExchangeMSec, uint32_t());
MOCK_METHOD0(RetrySequenceDelaysSeconds, const std::vector<int>());
MOCK_METHOD0(OnExceededTimeout, void());
MOCK_METHOD0(OnUpdateStarted, void());
@@ -135,7 +142,29 @@ class MockPolicyManager : public PolicyManager {
MOCK_METHOD1(SendNotificationOnPermissionsUpdated,
void(const std::string& application_id));
MOCK_METHOD1(MarkUnpairedDevice, void(const std::string& device_id));
- MOCK_METHOD1(AddApplication, void(const std::string& application_id));
+ MOCK_METHOD2(
+ AddApplication,
+ StatusNotifier(
+ const std::string& application_id,
+ const rpc::policy_table_interface_base::AppHmiTypes& hmi_types));
+#ifdef SDL_REMOTE_CONTROL
+ MOCK_METHOD2(SetDefaultHmiTypes,
+ void(const std::string& application_id,
+ const std::vector<int>& hmi_types));
+ MOCK_METHOD2(GetHMITypes,
+ bool(const std::string& application_id,
+ std::vector<int>* app_types));
+ MOCK_METHOD2(CheckModule,
+ bool(const PTString& app_id, const PTString& module));
+ MOCK_METHOD2(SendAppPermissionsChanged,
+ void(const std::string& device_id,
+ const std::string& application_id));
+ MOCK_CONST_METHOD2(GetModuleTypes,
+ bool(const std::string& policy_app_id,
+ std::vector<std::string>* modules));
+ MOCK_METHOD1(set_access_remote,
+ void(utils::SharedPtr<AccessRemote> access_remote));
+#endif // SDL_REMOTE_CONTROL
MOCK_METHOD0(CleanupUnpairedDevices, bool());
MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
@@ -143,11 +172,11 @@ class MockPolicyManager : public PolicyManager {
MOCK_CONST_METHOD1(GetNotificationsNumber,
uint32_t(const std::string& priority));
MOCK_METHOD1(SetVINValue, void(const std::string& value));
- MOCK_METHOD1(IsPredataPolicy, bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(IsPredataPolicy, bool(const std::string& policy_app_id));
MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
MOCK_METHOD1(SaveUpdateStatusRequired, void(bool is_update_needed));
MOCK_METHOD0(OnAppsSearchStarted, void());
- MOCK_METHOD0(OnAppsSearchCompleted, void());
+ MOCK_METHOD1(OnAppsSearchCompleted, void(const bool trigger_ptu));
MOCK_METHOD1(OnAppRegisteredOnMobile,
void(const std::string& application_id));
MOCK_CONST_METHOD1(
@@ -156,10 +185,13 @@ class MockPolicyManager : public PolicyManager {
MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
MOCK_CONST_METHOD0(GetMetaInfo, const policy::MetaInfo());
MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
+ MOCK_CONST_METHOD0(HasCertificate, bool());
MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&));
MOCK_METHOD0(ExceededIgnitionCycles, bool());
MOCK_METHOD0(ExceededDays, bool());
MOCK_METHOD0(StartPTExchange, void());
+
+ // --- Statistics Manager section
MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
MOCK_METHOD2(Increment,
void(const std::string& app_id,
@@ -175,11 +207,29 @@ class MockPolicyManager : public PolicyManager {
MOCK_CONST_METHOD0(get_settings, const PolicySettings&());
MOCK_METHOD1(set_settings, void(const PolicySettings* get_settings));
MOCK_CONST_METHOD0(GetLockScreenIconUrl, std::string());
- MOCK_METHOD2(GetServiceUrls,
- void(const std::string& service_type, EndpointUrls& end_points));
+ MOCK_METHOD1(GetNextUpdateUrl, AppIdURL(const EndpointUrls& urls));
+ MOCK_CONST_METHOD2(RetrySequenceUrl,
+ AppIdURL(const struct RetrySequenceURL&,
+ const EndpointUrls& urls));
+ MOCK_METHOD6(CheckPermissions,
+ void(const PTString& device_id,
+ const PTString& app_id,
+ const PTString& hmi_level,
+ const PTString& rpc,
+ const RPCParams& rpc_params,
+ CheckPermissionResult& result));
+ MOCK_METHOD2(
+ CheckPendingPermissionsChanges,
+ void(const std::string& policy_app_id,
+ const std::vector<FunctionalGroupPermission>& current_permissions));
+
+ MOCK_METHOD2(OnDeviceSwitching,
+ void(const std::string& device_id_from,
+ const std::string& device_id_to));
};
+
} // namespace policy_manager_test
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_MOCK_POLICY_MANAGER_H_
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_POLICY_REGULAR_POLICY_MOCK_POLICY_MANAGER_H_
diff --git a/src/components/include/test/policy/mock_policy_settings.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h
index 438e697c51..438e697c51 100644
--- a/src/components/include/test/policy/mock_policy_settings.h
+++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_settings.h
diff --git a/src/components/include/test/policy/policy_regular/policy/usage_statistics/mock_app_stopwatch.h b/src/components/include/test/policy/policy_regular/policy/usage_statistics/mock_app_stopwatch.h
new file mode 100644
index 0000000000..481d887cb2
--- /dev/null
+++ b/src/components/include/test/policy/policy_regular/policy/usage_statistics/mock_app_stopwatch.h
@@ -0,0 +1,54 @@
+/* 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_
+
+#include "gmock/gmock.h"
+#include "policy/usage_statistics/app_stopwatch.h"
+#include "policy/usage_statistics/statistics_manager.h"
+
+namespace test {
+namespace components {
+namespace usage_statistics_test {
+
+class MockAppStopwatch : public usage_statistics::AppStopwatch {
+ public:
+ MOCK_METHOD1(Start, void(usage_statistics::AppStopwatchId stopwatch_type));
+ MOCK_METHOD1(Switch, void(usage_statistics::AppStopwatchId stopwatch_type));
+ MOCK_METHOD0(WriteTime, void());
+};
+
+} // namespace usage_statistics_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_
diff --git a/src/components/include/test/policy/usage_statistics/mock_statistics_manager.h b/src/components/include/test/policy/policy_regular/policy/usage_statistics/mock_statistics_manager.h
index e58adea124..e58adea124 100644
--- a/src/components/include/test/policy/usage_statistics/mock_statistics_manager.h
+++ b/src/components/include/test/policy/policy_regular/policy/usage_statistics/mock_statistics_manager.h
diff --git a/src/components/include/test/policy/usage_statistics/mock_app_stopwatch.h b/src/components/include/test/policy/usage_statistics/mock_app_stopwatch.h
index 481d887cb2..aa29d2c78b 100644
--- a/src/components/include/test/policy/usage_statistics/mock_app_stopwatch.h
+++ b/src/components/include/test/policy/usage_statistics/mock_app_stopwatch.h
@@ -34,7 +34,6 @@
#include "gmock/gmock.h"
#include "policy/usage_statistics/app_stopwatch.h"
-#include "policy/usage_statistics/statistics_manager.h"
namespace test {
namespace components {
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h
index 44287edd4d..79c2188cdf 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h
@@ -62,6 +62,16 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler {
MOCK_CONST_METHOD0(get_settings,
const ::protocol_handler::ProtocolHandlerSettings&());
MOCK_METHOD0(get_session_observer, protocol_handler::SessionObserver&());
+ DEPRECATED MOCK_METHOD6(NotifySessionStartedResult,
+ void(int32_t connection_id,
+ uint8_t session_id,
+ uint8_t generated_session_id,
+ uint32_t hash_id,
+ bool protection,
+ std::vector<std::string>& rejected_params));
+ MOCK_METHOD2(NotifySessionStarted,
+ void(const ::protocol_handler::SessionContext& context,
+ std::vector<std::string>& rejected_params));
};
} // namespace protocol_handler_test
} // namespace components
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
index d12e7899e0..8ddeded889 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
@@ -43,6 +43,10 @@ class MockProtocolHandlerSettings
: public protocol_handler::ProtocolHandlerSettings {
public:
MOCK_CONST_METHOD0(maximum_payload_size, size_t());
+ MOCK_CONST_METHOD0(maximum_control_payload_size, size_t());
+ MOCK_CONST_METHOD0(maximum_rpc_payload_size, size_t());
+ MOCK_CONST_METHOD0(maximum_audio_payload_size, size_t());
+ MOCK_CONST_METHOD0(maximum_video_payload_size, size_t());
MOCK_CONST_METHOD0(message_frequency_count, size_t());
MOCK_CONST_METHOD0(message_frequency_time, size_t());
MOCK_CONST_METHOD0(malformed_message_filtering, bool());
diff --git a/src/components/include/test/protocol_handler/mock_protocol_observer.h b/src/components/include/test/protocol_handler/mock_protocol_observer.h
new file mode 100644
index 0000000000..257ea5ad9f
--- /dev/null
+++ b/src/components/include/test/protocol_handler/mock_protocol_observer.h
@@ -0,0 +1,57 @@
+/*
+ * 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_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_OBSERVER_H_
+
+#include "gmock/gmock.h"
+#include <string>
+#include "protocol_handler/protocol_observer.h"
+
+namespace test {
+namespace components {
+namespace protocol_handler_test {
+
+/*
+ * MOCK implementation of ::protocol_handler::ProtocolObserver interface
+ */
+class MockProtocolObserver : public ::protocol_handler::ProtocolObserver {
+ public:
+ MOCK_METHOD1(OnMessageReceived,
+ void(const ::protocol_handler::RawMessagePtr));
+ MOCK_METHOD1(OnMobileMessageSent,
+ void(const ::protocol_handler::RawMessagePtr));
+};
+} // namespace protocol_handler_test
+} // namespace components
+} // namespace test
+#endif // SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_OBSERVER_H_
diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h
index 994c78b961..3d54b97fad 100644
--- a/src/components/include/test/protocol_handler/mock_session_observer.h
+++ b/src/components/include/test/protocol_handler/mock_session_observer.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
-#define TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_SESSION_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_SESSION_OBSERVER_H_
#include <gmock/gmock.h>
#include <string>
@@ -46,19 +46,31 @@ namespace protocol_handler_test {
*/
class MockSessionObserver : public ::protocol_handler::SessionObserver {
public:
- MOCK_METHOD5(
+ DEPRECATED MOCK_METHOD5(
OnSessionStartedCallback,
uint32_t(const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
const protocol_handler::ServiceType& service_type,
const bool is_protected,
uint32_t* hash_id));
+ MOCK_METHOD5(OnSessionStartedCallback,
+ void(const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ const protocol_handler::ServiceType& service_type,
+ const bool is_protected,
+ const BsonObject* params));
MOCK_METHOD4(
OnSessionEndedCallback,
uint32_t(const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
const uint32_t& hashCode,
const protocol_handler::ServiceType& service_type));
+ MOCK_METHOD4(
+ OnSessionEndedCallback,
+ uint32_t(const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ uint32_t* hashCode,
+ const protocol_handler::ServiceType& service_type));
MOCK_METHOD1(OnApplicationFloodCallBack,
void(const uint32_t& connection_key));
MOCK_METHOD1(OnMalformedMessageCallback,
@@ -75,13 +87,27 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver {
int32_t(uint32_t key,
uint32_t* app_id,
std::list<int32_t>* sessions_list,
- uint32_t* device_id));
+ transport_manager::DeviceHandle* device_id));
+ DEPRECATED MOCK_CONST_METHOD4(GetDataOnSessionKey,
+ int32_t(uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ uint32_t* device_id));
+
MOCK_CONST_METHOD5(GetDataOnDeviceID,
- int32_t(uint32_t device_handle,
+ int32_t(transport_manager::DeviceHandle device_handle,
std::string* device_name,
std::list<uint32_t>* applications_list,
std::string* mac_address,
std::string* connection_type));
+
+ DEPRECATED MOCK_CONST_METHOD5(GetDataOnDeviceID,
+ int32_t(uint32_t device_handle,
+ std::string* device_name,
+ std::list<uint32_t>* applications_list,
+ std::string* mac_address,
+ std::string* connection_type));
+
MOCK_CONST_METHOD2(IsHeartBeatSupported,
bool(transport_manager::ConnectionUID connection_handle,
uint8_t session_id));
@@ -100,6 +126,9 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver {
MOCK_METHOD2(SetProtectionFlag,
void(const uint32_t& key,
const protocol_handler::ServiceType& service_type));
+ MOCK_CONST_METHOD2(SessionServiceExists,
+ bool(const uint32_t connection_key,
+ const protocol_handler::ServiceType& service_type));
MOCK_CONST_METHOD1(
GetHandshakeContext,
security_manager::SSLContext::HandshakeContext(uint32_t key));
@@ -108,4 +137,4 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver {
} // namespace protocol_handler_test
} // namespace components
} // namespace test
-#endif // TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
+#endif // SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_SESSION_OBSERVER_H_
diff --git a/src/components/include/test/protocol_handler/mock_telemetry_observer.h b/src/components/include/test/protocol_handler/mock_telemetry_observer.h
new file mode 100644
index 0000000000..1c87de4d5a
--- /dev/null
+++ b/src/components/include/test/protocol_handler/mock_telemetry_observer.h
@@ -0,0 +1,54 @@
+/*
+ * 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_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TELEMETRY_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TELEMETRY_OBSERVER_H_
+
+#include "gmock/gmock.h"
+
+#include "protocol_handler/telemetry_observer.h"
+
+namespace test {
+namespace components {
+namespace protocol_handler_test {
+
+class MockPHTelemetryObserver : public PHTelemetryObserver {
+ public:
+ MOCK_METHOD2(StartMessageProcess,
+ void(uint32_t message_id, const TimevalStruct& start_time));
+ MOCK_METHOD1(EndMessageProcess, void(utils::SharedPtr<MessageMetric> m));
+};
+
+} // namespace protocol_handler_test
+} // namespace components
+} // namespace test
+#endif // SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TELEMETRY_OBSERVER_H_
diff --git a/src/components/include/test/resumption/mock_last_state.h b/src/components/include/test/resumption/mock_last_state.h
new file mode 100644
index 0000000000..9f4b11cbbf
--- /dev/null
+++ b/src/components/include/test/resumption/mock_last_state.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, 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_RESUMPTION_MOCK_LAST_STATE_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_RESUMPTION_MOCK_LAST_STATE_H_
+
+#include "gmock/gmock.h"
+#include "resumption/last_state.h"
+
+namespace test {
+namespace components {
+namespace resumption_test {
+
+class MockLastState : public resumption::LastState {
+ public:
+ MOCK_METHOD0(SaveStateToFileSystem, void());
+ MOCK_METHOD0(get_dictionary, Json::Value&());
+};
+
+} // namespace resumption_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_RESUMPTION_MOCK_LAST_STATE_H_
diff --git a/src/components/include/test/security_manager/mock_security_manager.h b/src/components/include/test/security_manager/mock_security_manager.h
index e3d95cd94f..11890cb071 100644
--- a/src/components/include/test/security_manager/mock_security_manager.h
+++ b/src/components/include/test/security_manager/mock_security_manager.h
@@ -65,6 +65,9 @@ class MockSecurityManager : public ::security_manager::SecurityManager {
void(const ::protocol_handler::RawMessagePtr));
MOCK_METHOD1(OnMobileMessageSent,
void(const ::protocol_handler::RawMessagePtr));
+ MOCK_METHOD0(IsCertificateUpdateRequired, bool());
+ MOCK_METHOD0(NotifyOnCertificateUpdateRequired, void());
+ MOCK_METHOD0(IsPolicyCertificateDataEmpty, bool());
};
/*
diff --git a/src/components/include/test/security_manager/mock_security_manager_listener.h b/src/components/include/test/security_manager/mock_security_manager_listener.h
index 9e5dd03698..a06762a09d 100644
--- a/src/components/include/test/security_manager/mock_security_manager_listener.h
+++ b/src/components/include/test/security_manager/mock_security_manager_listener.h
@@ -48,6 +48,7 @@ class MockSecurityManagerListener
bool(uint32_t connection_key,
::security_manager::SSLContext::HandshakeResult result));
MOCK_METHOD0(OnCertificateUpdateRequired, void());
+ MOCK_CONST_METHOD1(GetPolicyCertificateData, bool(std::string& data));
};
} // namespace security_manager_test
} // namespace components
diff --git a/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h b/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h
index 9ba4528ecf..dd07f1d3c8 100644
--- a/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h
+++ b/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TEST_MOCK_TELEMETRY_OBSERVEABLE_H
-#define SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TEST_MOCK_TELEMETRY_OBSERVEABLE_H
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_TELEMETRY_MONITOR_MOCK_TELEMETRY_OBSERVABLE_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_TELEMETRY_MONITOR_MOCK_TELEMETRY_OBSERVABLE_H_
#include "gmock/gmock.h"
#include "telemetry_monitor/telemetry_observable.h"
@@ -52,4 +52,4 @@ class MockTelemetryObservable : public telemetry_monitor::TelemetryObservable<
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TEST_MOCK_TELEMETRY_OBSERVEABLE_H
+#endif // SRC_COMPONENTS_INCLUDE_TEST_TELEMETRY_MONITOR_MOCK_TELEMETRY_OBSERVABLE_H_
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_listener.h b/src/components/include/test/transport_manager/mock_transport_manager_listener.h
new file mode 100644
index 0000000000..f4c4fdcf68
--- /dev/null
+++ b/src/components/include/test/transport_manager/mock_transport_manager_listener.h
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_LISTENER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_LISTENER_H_
+
+#include "gmock/gmock.h"
+
+#include "transport_manager/transport_manager_listener.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+using namespace transport_manager;
+using ::protocol_handler::RawMessage;
+using ::protocol_handler::RawMessagePtr;
+
+class MockTransportManagerListener : public TransportManagerListener {
+ public:
+ MOCK_METHOD1(OnDeviceListUpdated,
+ void(const std::vector<DeviceInfo>& device_info));
+ MOCK_METHOD0(OnFindNewApplicationsRequest, void());
+ MOCK_METHOD1(OnDeviceFound, void(const DeviceInfo& device_info));
+ MOCK_METHOD1(OnDeviceAdded, void(const DeviceInfo& device_info));
+ MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo& device_info));
+ MOCK_METHOD0(OnScanDevicesFinished, void());
+ MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error));
+ MOCK_METHOD2(OnConnectionEstablished,
+ void(const DeviceInfo& device_info,
+ const ConnectionUID connection_id));
+ MOCK_METHOD2(OnConnectionFailed,
+ void(const DeviceInfo& device_info, const ConnectError& error));
+ MOCK_METHOD1(OnConnectionClosed, void(const ConnectionUID connection_id));
+ MOCK_METHOD2(OnUnexpectedDisconnect,
+ void(const ConnectionUID connection_id,
+ const CommunicationError& error));
+ MOCK_METHOD2(OnConnectionClosedFailure,
+ void(const ConnectionUID connection_id,
+ const DisconnectError& error));
+ MOCK_METHOD2(OnDeviceConnectionLost,
+ void(const DeviceHandle& device,
+ const DisconnectDeviceError& error));
+ MOCK_METHOD2(OnDisconnectFailed,
+ void(const DeviceHandle& device,
+ const DisconnectDeviceError& error));
+ MOCK_METHOD1(OnTMMessageReceived,
+ void(const ::protocol_handler::RawMessagePtr message));
+ MOCK_METHOD1(OnTMMessageReceiveFailed, void(const DataReceiveError& error));
+ MOCK_METHOD1(OnTMMessageSend,
+ void(const ::protocol_handler::RawMessagePtr message));
+ MOCK_METHOD2(OnTMMessageSendFailed,
+ void(const DataSendError& error,
+ const ::protocol_handler::RawMessagePtr message));
+ MOCK_METHOD2(OnDeviceSwitchingStart,
+ void(const DeviceUID& device_uid_from,
+ const DeviceUID& device_uid_to));
+ MOCK_METHOD1(OnDeviceSwitchingFinish, void(const DeviceUID& device_uid));
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_LISTENER_H_
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_mme_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_mme_settings.h
index 9e868977d3..24e9c701a7 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager_mme_settings.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager_mme_settings.h
@@ -29,8 +29,8 @@
* 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_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_MME_SETTINGS_H
-#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_MME_SETTINGS_H
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_MME_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_MME_SETTINGS_H_
#include "gmock/gmock.h"
#include "protocol_handler/protocol_handler.h"
@@ -59,4 +59,4 @@ class MockTransportManagerMMESettings
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_MME_SETTINGS_H
+#endif // SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_MME_SETTINGS_H_
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_settings.h
index a879723475..88112df003 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager_settings.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager_settings.h
@@ -29,8 +29,8 @@
* 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_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_SETTINGS_H
-#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_SETTINGS_H
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_SETTINGS_H_
#include "gmock/gmock.h"
#include "protocol_handler/protocol_handler.h"
@@ -59,10 +59,12 @@ class MockTransportManagerSettings
MOCK_CONST_METHOD0(iap_system_config, const std::string&());
MOCK_CONST_METHOD0(iap2_system_config, const std::string&());
MOCK_CONST_METHOD0(iap_hub_connection_wait_timeout, uint32_t());
+ MOCK_CONST_METHOD0(app_transport_change_timer, uint32_t());
+ MOCK_CONST_METHOD0(app_transport_change_timer_addition, uint32_t());
};
} // namespace transport_manager_test
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_SETTINGS_H
+#endif // SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_SETTINGS_H_
diff --git a/src/components/include/test/transport_manager/transport_adapter/mock_device.h b/src/components/include/test/transport_manager/transport_adapter/mock_device.h
new file mode 100644
index 0000000000..6829e98d1d
--- /dev/null
+++ b/src/components/include/test/transport_manager/transport_adapter/mock_device.h
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_DEVICE_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_DEVICE_H_
+
+#include "gmock/gmock.h"
+#include "transport_manager/transport_adapter/device.h"
+#include "transport_manager/common.h"
+#include "transport_manager/tcp/tcp_device.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+class MockDevice : public ::transport_manager::transport_adapter::Device {
+ public:
+ MockDevice(const std::string& name, const std::string& unique_device_id)
+ : Device(name, unique_device_id) {}
+ MOCK_CONST_METHOD1(IsSameAs, bool(const Device* other_device));
+ MOCK_CONST_METHOD0(GetApplicationList, std::vector<int>());
+ MOCK_CONST_METHOD1(LaunchApp, void(const std::string& bundle_id));
+ MOCK_METHOD0(Stop, void());
+};
+
+class MockTCPDevice : public ::transport_manager::transport_adapter::TcpDevice {
+ public:
+ MockTCPDevice(const uint32_t& in_addr_t, const std::string& name)
+ : TcpDevice(in_addr_t, name) {}
+ MOCK_CONST_METHOD1(IsSameAs, bool(const Device* other_device));
+ MOCK_CONST_METHOD0(GetApplicationList, std::vector<int>());
+ MOCK_METHOD0(Stop, void());
+ MOCK_CONST_METHOD1(
+ GetApplicationPort,
+ int(const ::transport_manager::ApplicationHandle app_handle));
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_DEVICE_H_
diff --git a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
new file mode 100644
index 0000000000..c37c41d4f8
--- /dev/null
+++ b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
@@ -0,0 +1,116 @@
+/*
+ * 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.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_MOCK_TRANSPORT_ADAPTER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_MOCK_TRANSPORT_ADAPTER_H_
+
+#include "gmock/gmock.h"
+#include "transport_manager/transport_adapter/transport_adapter.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+class MockTransportAdapter
+ : public ::transport_manager::transport_adapter::TransportAdapter {
+ public:
+ MOCK_CONST_METHOD0(GetDeviceType,
+ ::transport_manager::transport_adapter::DeviceType());
+ MOCK_CONST_METHOD0(GetConnectionType, ::transport_manager::ConnectionType());
+ MOCK_CONST_METHOD0(IsInitialised, bool());
+ MOCK_METHOD0(
+ Init, ::transport_manager::transport_adapter::TransportAdapter::Error());
+ MOCK_METHOD0(Terminate, void());
+ MOCK_METHOD1(
+ AddListener,
+ void(::transport_manager::transport_adapter::TransportAdapterListener*
+ listener));
+ MOCK_CONST_METHOD0(IsSearchDevicesSupported, bool());
+ MOCK_METHOD0(
+ SearchDevices,
+ ::transport_manager::transport_adapter::TransportAdapter::Error());
+ MOCK_CONST_METHOD0(IsServerOriginatedConnectSupported, bool());
+ MOCK_METHOD2(Connect,
+ ::transport_manager::transport_adapter::TransportAdapter::Error(
+ const ::transport_manager::DeviceUID& device_handle,
+ const ::transport_manager::ApplicationHandle& app_handle));
+ MOCK_METHOD1(ConnectDevice,
+ ::transport_manager::transport_adapter::TransportAdapter::Error(
+ const ::transport_manager::DeviceUID& device_handle));
+ MOCK_METHOD2(RunAppOnDevice, void(const std::string&, const std::string&));
+ MOCK_CONST_METHOD0(IsClientOriginatedConnectSupported, bool());
+ MOCK_METHOD0(
+ StartClientListening,
+ ::transport_manager::transport_adapter::TransportAdapter::Error());
+ MOCK_METHOD0(
+ StopClientListening,
+ ::transport_manager::transport_adapter::TransportAdapter::Error());
+ MOCK_METHOD2(RemoveFinalizedConnection,
+ void(const ::transport_manager::DeviceUID& device_handle,
+ const ::transport_manager::ApplicationHandle& app_handle));
+ MOCK_METHOD2(Disconnect,
+ ::transport_manager::transport_adapter::TransportAdapter::Error(
+ const ::transport_manager::DeviceUID& device_handle,
+ const ::transport_manager::ApplicationHandle& app_handle));
+ MOCK_METHOD1(DisconnectDevice,
+ Error(const ::transport_manager::DeviceUID& device_handle));
+ MOCK_METHOD3(SendData,
+ ::transport_manager::transport_adapter::TransportAdapter::Error(
+ const ::transport_manager::DeviceUID& device_handle,
+ const ::transport_manager::ApplicationHandle& app_handle,
+ const protocol_handler::RawMessagePtr data));
+ MOCK_CONST_METHOD0(GetDeviceList, ::transport_manager::DeviceList());
+ MOCK_CONST_METHOD1(GetApplicationList,
+ ::transport_manager::ApplicationList(
+ const ::transport_manager::DeviceUID& device_handle));
+ MOCK_CONST_METHOD1(
+ DeviceName,
+ std::string(const ::transport_manager::DeviceUID& device_handle));
+
+ MOCK_CONST_METHOD1(StopDevice,
+ void(const ::transport_manager::DeviceUID& device_id));
+ MOCK_CONST_METHOD0(DoTransportSwitch, void());
+ MOCK_METHOD1(DeviceSwitched,
+ void(const ::transport_manager::DeviceUID& device_handle));
+ MOCK_CONST_METHOD0(GetSwitchableDevices,
+ transport_manager::SwitchableDevices());
+#ifdef TELEMETRY_MONITOR
+ MOCK_METHOD0(GetTelemetryObserver,
+ ::transport_manager::TMTelemetryObserver*());
+#endif // TELEMETRY_MONITOR
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_MOCK_TRANSPORT_ADAPTER_H_
diff --git a/src/components/include/test/utils/test_async_waiter.h b/src/components/include/test/utils/test_async_waiter.h
new file mode 100644
index 0000000000..fee7672e93
--- /dev/null
+++ b/src/components/include/test/utils/test_async_waiter.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2017, 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_UTILS_TEST_ASYNC_WAITER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_UTILS_TEST_ASYNC_WAITER_H_
+
+#include <stdint.h>
+
+#include "utils/lock.h"
+#include "utils/conditional_variable.h"
+
+namespace test {
+
+/**
+ * @brief The TestAsyncWaiter class
+ * Tool with condition variable style interface
+ * to be used in unit tests for asynchronous calls waiting.
+ * Could wait specified number of calls, waiting for timeout is also supported
+ *
+ * Usage example:
+ * TEST() {
+ * TestAsyncWaiter waiter;
+ * EXPECT_CALL(mock, InterestingCall())
+ * .Times(n)
+ * .WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
+ * EXPECT_TRUE(waiter.WaitFor(n, 1000));
+ * }
+ */
+class TestAsyncWaiter {
+ public:
+ TestAsyncWaiter() : notified_(false), count_(0), lock_(), cond_var_() {}
+
+ /**
+ * @brief WaitFor
+ * Waits for specified number of notifications but not longer
+ * than given timeout for each notification
+ * @param wait_count Number of notifications to wait for
+ * @param milliseconds Timeout in milliseconds
+ * @return True if specified number of notifications have been received,
+ * false otherwise (return by timeout)
+ */
+ bool WaitFor(const uint32_t wait_count, const uint32_t milliseconds) {
+ sync_primitives::AutoLock auto_lock(lock_);
+ while (count_ < wait_count) {
+ notified_ = false;
+ if (sync_primitives::ConditionalVariable::kTimeout ==
+ cond_var_.WaitFor(auto_lock, milliseconds)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @brief Notify
+ * Notifies async waiter
+ */
+ void Notify() {
+ sync_primitives::AutoLock auto_lock(lock_);
+ notified_ = true;
+ ++count_;
+ cond_var_.Broadcast();
+ }
+
+ private:
+ bool notified_;
+ uint32_t count_;
+ sync_primitives::Lock lock_;
+ sync_primitives::ConditionalVariable cond_var_;
+};
+
+ACTION_P(NotifyTestAsyncWaiter, test_async_waiter) {
+ test_async_waiter->Notify();
+}
+
+} // namespace test
+#endif // SRC_COMPONENTS_INCLUDE_TEST_UTILS_TEST_ASYNC_WAITER_H_
diff --git a/src/components/include/transport_manager/common.h b/src/components/include/transport_manager/common.h
index c1fc51dc8a..58bcf6bb17 100644
--- a/src/components/include/transport_manager/common.h
+++ b/src/components/include/transport_manager/common.h
@@ -35,6 +35,7 @@
#include <vector>
#include <string>
+#include <map>
/**
* @brief - transport_manager namespace
@@ -58,7 +59,7 @@ enum {
/**
* @brief Type definition for variable that hold handle of device.
*/
-typedef unsigned int DeviceHandle;
+typedef size_t DeviceHandle;
/**
* @brief Type definition for variable that hold connection unique identifier.
@@ -90,5 +91,12 @@ typedef int ApplicationHandle;
* @brief Type definition for vector that contain ApplicationHandle variables.
*/
typedef std::vector<ApplicationHandle> ApplicationList;
+
+/**
+ * @brief SwitchableDevices defines list of devices having transport switch id
+ * i.e. able to switch their transport. Maps unique device id (MAC, serial etc.)
+ * to transport switch id (e.g. connection UUID for iAP2 transport)
+ */
+typedef std::map<DeviceUID, std::string> SwitchableDevices;
} // namespace transport_manager
#endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_COMMON_H_
diff --git a/src/components/include/transport_manager/transport_adapter/device.h b/src/components/include/transport_manager/transport_adapter/device.h
index 3adb6cd2e6..148e715050 100644
--- a/src/components/include/transport_manager/transport_adapter/device.h
+++ b/src/components/include/transport_manager/transport_adapter/device.h
@@ -58,6 +58,22 @@ class Device {
: name_(name)
, unique_device_id_(unique_device_id)
, keep_on_disconnect_(false) {}
+
+ /**
+ * Constructor for creating device supporting transport switch
+ * @brief Device constructor
+ * @param name Device name
+ * @param unique_device_id Unique device id
+ * @param transport_switch_id Id used for transport switching flow
+ */
+ Device(const std::string& name,
+ const DeviceUID& unique_device_id,
+ std::string transport_switch_id)
+ : name_(name)
+ , unique_device_id_(unique_device_id)
+ , transport_switch_id_(transport_switch_id)
+ , keep_on_disconnect_(false) {}
+
/**
* @brief Destructor.
**/
@@ -114,6 +130,14 @@ class Device {
keep_on_disconnect_ = keep_on_disconnect;
}
+ /**
+ * @brief transport_switch_id Returns id used for transport switching
+ * flow of device. Filled if applicable, otherwise - empty.
+ */
+ inline std::string transport_switch_id() const {
+ return transport_switch_id_;
+ }
+
private:
/**
* @brief Device user-friendly name.
@@ -124,6 +148,11 @@ class Device {
* @brief Unique device identifier across all devices.
**/
DeviceUID unique_device_id_;
+ /**
+ * @brief transport_switch_id_ ID used to switch device from one to another
+ * transport. Filled if applicable, otherwise - empty
+ */
+ std::string transport_switch_id_;
/**
* @brief If true, device will remain in list even if all its connections
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
index ee726ff1d3..7f6d347535 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
@@ -56,10 +56,22 @@ namespace transport_adapter {
class TransportAdapterListener;
-// TODO(EZamakhov): cahnge to DeviceUID
-// typedef std::string DeviceType;
-
-enum DeviceType { AOA, PASA_AOA, BLUETOOTH, PASA_BLUETOOTH, MME, TCP, UNKNOWN };
+/**
+ * @brief The DeviceType enum defines types based on available transport
+ * adapters
+ * @deprecated PASA_AOA, PASA_BLUETOOTH, MME
+ */
+enum DeviceType {
+ AOA,
+ PASA_AOA,
+ BLUETOOTH,
+ PASA_BLUETOOTH,
+ MME,
+ IOS_BT,
+ IOS_USB,
+ TCP,
+ UNKNOWN
+};
typedef std::map<DeviceType, std::string> DeviceTypes;
@@ -278,6 +290,28 @@ class TransportAdapter {
*/
virtual std::string DeviceName(const DeviceUID& device_id) const = 0;
+ /**
+ * @brief StopDevice Stop all activity on device without removing it from
+ * devices list
+ * @param device_id unique device identifier that has to be stopped.
+ */
+ virtual void StopDevice(const DeviceUID& device_id) const = 0;
+
+ /**
+ * @brief DoTransportSwitch notifies listeners of transport adapter events
+ * that transport switching is requested by system
+ */
+ virtual void DoTransportSwitch() const = 0;
+
+ /**
+ * @brief DeviceSwitched is triggered for adapter to proceed with possible
+ * further switching steps required on device side. E.g. to notify device
+ * on end of switching so it can disconnect transport being switched from.
+ * @param device_handle Device id to notify on event
+ */
+ virtual void DeviceSwitched(const DeviceUID& device_handle) = 0;
+
+ virtual SwitchableDevices GetSwitchableDevices() const = 0;
#ifdef TELEMETRY_MONITOR
/**
* @brief Return Time metric observer
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
index 7879a136b2..18f4ccb2d1 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
@@ -39,6 +39,27 @@
namespace transport_manager {
+/**
+ * @enum Available types of events.
+ */
+enum class EventTypeEnum {
+ ON_SEARCH_DONE = 0,
+ ON_SEARCH_FAIL,
+ ON_DEVICE_LIST_UPDATED,
+ ON_FIND_NEW_APPLICATIONS_REQUEST,
+ ON_CONNECT_DONE,
+ ON_CONNECT_FAIL,
+ ON_DISCONNECT_DONE,
+ ON_DISCONNECT_FAIL,
+ ON_SEND_DONE,
+ ON_SEND_FAIL,
+ ON_RECEIVED_DONE,
+ ON_RECEIVED_FAIL,
+ ON_COMMUNICATION_ERROR,
+ ON_UNEXPECTED_DISCONNECT,
+ ON_TRANSPORT_SWITCH_REQUESTED
+};
+
class TransportAdapterEvent {
public:
TransportAdapterEvent() {}
@@ -52,7 +73,7 @@ class TransportAdapterEvent {
* @param data Smart pointer to the raw message.
* @param error Error class that contains details of this error situation.
*/
- TransportAdapterEvent(int type,
+ TransportAdapterEvent(EventTypeEnum type,
transport_adapter::TransportAdapter* adapter,
const DeviceUID& device_handle,
const ApplicationHandle& application_id,
@@ -64,10 +85,35 @@ class TransportAdapterEvent {
, transport_adapter(adapter)
, event_data(data)
, event_error(error) {}
+
+ /**
+ * DEPRECATED
+ * @brief Constructor.
+ *
+ * @param type Event type.
+ * @param transport_adapter Transport adapter
+ * @param device_handle Handle of device.
+ * @param application_id Handle of application.
+ * @param data Smart pointer to the raw message.
+ * @param error Error class that contains details of this error situation.
+ */
+ TransportAdapterEvent(int type,
+ transport_adapter::TransportAdapter* adapter,
+ const DeviceUID& device_handle,
+ const ApplicationHandle& application_id,
+ ::protocol_handler::RawMessagePtr data,
+ BaseErrorPtr error)
+ : event_type(static_cast<EventTypeEnum>(type))
+ , application_id(application_id)
+ , device_uid(device_handle)
+ , transport_adapter(adapter)
+ , event_data(data)
+ , event_error(error) {}
+
/**
* @brief Value that describe event type.
*/
- int event_type;
+ EventTypeEnum event_type;
/**
* @brief Handle of application
*/
diff --git a/src/components/include/transport_manager/transport_manager_listener.h b/src/components/include/transport_manager/transport_manager_listener.h
index e9f49e3152..d336eade45 100644
--- a/src/components/include/transport_manager/transport_manager_listener.h
+++ b/src/components/include/transport_manager/transport_manager_listener.h
@@ -70,6 +70,23 @@ class TransportManagerListener {
virtual void OnDeviceRemoved(const DeviceInfo& device_info) = 0;
/**
+ * @brief OnDeviceSwitchingStart allows to notify listener that device is
+ * going to switch its connection.
+ * @param device_uid_from the id of the device which has to switch its
+ * transport
+ * @param device_uid_to the id of the device on new transport
+ */
+ virtual void OnDeviceSwitchingStart(const DeviceUID& device_uid_from,
+ const DeviceUID& device_uid_to) = 0;
+
+ /**
+ * @brief OnDeviceSwitchingFinish notifies listener that device reconnection
+ * fails due to some reason.
+ * @param device_uid the id for the device which is fails to reconnect.
+ */
+ virtual void OnDeviceSwitchingFinish(const DeviceUID& device_uid) = 0;
+
+ /**
* @brief Reaction to the event, when scanning of devices is finished.
*/
virtual void OnScanDevicesFinished() = 0;
diff --git a/src/components/include/transport_manager/transport_manager_listener_empty.h b/src/components/include/transport_manager/transport_manager_listener_empty.h
index c5eb0be37c..ca6c573a06 100644
--- a/src/components/include/transport_manager/transport_manager_listener_empty.h
+++ b/src/components/include/transport_manager/transport_manager_listener_empty.h
@@ -69,6 +69,23 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
void OnDeviceRemoved(const DeviceInfo& device_info) OVERRIDE {}
/**
+ * @brief OnDeviceSwitchingStart allows to notify listener that device is
+ * going to switch its connection. This default implementation does nothing.
+ * @param device_uid_from the id of the device which has to switch its
+ * transport
+ * @param device_uid_to the id of the device on new transport
+ */
+ void OnDeviceSwitchingStart(const DeviceUID& device_uid_from,
+ const DeviceUID& device_uid_to) OVERRIDE {}
+
+ /**
+ * @brief OnDeviceSwitchingFinish notifies listener that device reconnection
+ * fails due to some reason. This default implementation does nothing.
+ * @param device_uid the id for the device which is fails to reconnect.
+ */
+ void OnDeviceSwitchingFinish(const DeviceUID& device_uid) OVERRIDE {}
+
+ /**
* @brief Reaction to the event, when scanning of devices is finished.
*/
void OnScanDevicesFinished() OVERRIDE {}
diff --git a/src/components/include/transport_manager/transport_manager_settings.h b/src/components/include/transport_manager/transport_manager_settings.h
index f33c5344e0..feb3fa2c02 100644
--- a/src/components/include/transport_manager/transport_manager_settings.h
+++ b/src/components/include/transport_manager/transport_manager_settings.h
@@ -51,6 +51,18 @@ class TransportManagerSettings : public TransportManagerMMESettings {
* @brief Returns port for TCP transport adapter
*/
virtual uint16_t transport_manager_tcp_adapter_port() const = 0;
+
+ /**
+ * @brief Returns the millisecond count before timeout
+ * for transport change feature occures.
+ */
+ virtual uint32_t app_transport_change_timer() const = 0;
+
+ /**
+ * @brief Returns the millisecond count as addition to
+ * the transport change timeout value.
+ */
+ virtual uint32_t app_transport_change_timer_addition() const = 0;
};
} // namespace transport_manager
#endif // SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_SETTINGS_H_
diff --git a/src/components/include/utils/callable.h b/src/components/include/utils/callable.h
new file mode 100644
index 0000000000..aff91814bf
--- /dev/null
+++ b/src/components/include/utils/callable.h
@@ -0,0 +1,26 @@
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_CALLABLE_H
+#define SRC_COMPONENTS_INCLUDE_UTILS_CALLABLE_H
+
+#include "utils/macro.h"
+
+namespace utils {
+/**
+ * @brief The Callable class allows
+ * to create functor to call in other context
+ */
+class Callable {
+ public:
+ virtual void operator()() const = 0;
+ virtual ~Callable() {}
+};
+
+/**
+ * @brief The CallNothing class functior that to nothing
+ */
+class CallNothing : public Callable {
+ // Callable interface
+ public:
+ void operator()() const OVERRIDE {}
+};
+} // namespace utils
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_CALLABLE_H
diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h
index 0e029e4b06..e6f3b6b3ca 100644
--- a/src/components/include/utils/macro.h
+++ b/src/components/include/utils/macro.h
@@ -113,6 +113,13 @@
return; \
}
+#define EXPORT_FUNCTION(TypeName) extern "C" TypeName* Create();
+
+#define EXPORT_FUNCTION_IMPL(TypeName) \
+ extern "C" TypeName* Create() { \
+ return new TypeName(); \
+ }
+
#define NOTREACHED() DCHECK(!"Unreachable code")
// Allows to perform static check that virtual function from base class is
@@ -134,6 +141,26 @@
#ifdef BUILD_TESTS
#define FRIEND_TEST(test_case_name, test_name) \
friend class test_case_name##_##test_name##_Test
+#else // BUILD_TESTS
+#define FRIEND_TEST(test_case_name, test_name)
+#endif // BUILD_TESTS
+
+/*
+* @brief deprecate a method declaration, a warning will be thrown by your
+* compiler if a method with this macro is used
+*/
+#if __cplusplus > 201103L
+#define DEPRECATED [[deprecated]]
+#else
+#ifdef __GNUC__
+#define DEPRECATED __attribute__((deprecated))
+#define DEPRECATED_CLASS __attribute__((deprecated))
+#elif defined(_MSC_VER)
+#define DEPRECATED __declspec(deprecated)
+#else
+#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
+#define DEPRECATED
+#endif
#endif
#endif // SRC_COMPONENTS_INCLUDE_UTILS_MACRO_H_
diff --git a/src/components/include/utils/memory_barrier.h b/src/components/include/utils/memory_barrier.h
index 43c7c9df14..f9452d76ad 100644
--- a/src/components/include/utils/memory_barrier.h
+++ b/src/components/include/utils/memory_barrier.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_MEMORY_BARRIER_H_
-#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_MEMORY_BARRIER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_MEMORY_BARRIER_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_MEMORY_BARRIER_H_
#ifdef __QNXNTO__
#include <sys/cpuinline.h>
@@ -51,4 +51,4 @@ inline void memory_barrier() {
} // namespace utils
-#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_MEMORY_BARRIER_H_
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_MEMORY_BARRIER_H_
diff --git a/src/components/include/utils/scope_guard.h b/src/components/include/utils/scope_guard.h
index bc60a7d288..a425356c0e 100644
--- a/src/components/include/utils/scope_guard.h
+++ b/src/components/include/utils/scope_guard.h
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H
-#define SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H_
namespace utils {
@@ -323,4 +323,4 @@ ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj,
return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
}
}
-#endif // SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H_
diff --git a/src/components/include/utils/threads/CMakeLists.txt b/src/components/include/utils/threads/CMakeLists.txt
deleted file mode 100644
index f97039c21b..0000000000
--- a/src/components/include/utils/threads/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-set(UtilsIncludeDir ${COMPONENTS_DIR/utils/include)
-
-include_directories (
- ${UtilsIncludeDir}
-) \ No newline at end of file
diff --git a/src/components/include/utils/threads/async_runner.h b/src/components/include/utils/threads/async_runner.h
index c6da0638f4..64c9d09939 100644
--- a/src/components/include/utils/threads/async_runner.h
+++ b/src/components/include/utils/threads/async_runner.h
@@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_INCLUDE_UTILS_ASYNC_RUNNER_H_
-#define SRC_COMPONENTS_INCLUDE_UTILS_ASYNC_RUNNER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_THREADS_ASYNC_RUNNER_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_THREADS_ASYNC_RUNNER_H_
#include <string>
#include <queue>
@@ -123,4 +123,4 @@ class AsyncRunner {
} // namespace threads
-#endif // SRC_COMPONENTS_INCLUDE_UTILS_ASYNC_RUNNER_H_
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_THREADS_ASYNC_RUNNER_H_
diff --git a/src/components/include/utils/threads/thread.h b/src/components/include/utils/threads/thread.h
index c81b912e9a..cba79b20bd 100644
--- a/src/components/include/utils/threads/thread.h
+++ b/src/components/include/utils/threads/thread.h
@@ -100,6 +100,7 @@ class Thread {
sync_primitives::ConditionalVariable run_cond_;
public:
+ static int count;
/**
* @brief Starts the thread.
* @return true if the thread was successfully started.