diff options
1052 files changed, 10071 insertions, 51109 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index bc049a5a28..450a9192f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,6 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/platform.cmake) #Jenkins integration section #dont modify this section if you dont know details about integration with Jenkins!!! set (HMI "web" CACHE STRING "HMI type") -option(HMI2 "Use Qt HMI" OFF) option(EXTENDED_MEDIA_MODE "Turn on and off extended Madia Manager features relates to PulseAudio A2DP and GStreamer" OFF) option(BUILD_SHARED_LIBS "Build all libraries as shared (if ON) or static (if OFF)" OFF) option(BUILD_BT_SUPPORT "Bluetooth support" ON) @@ -90,15 +89,12 @@ else () endif() if (HMI_TYPE_OPTION) - if (${HMI_TYPE_OPTION} STREQUAL "HTML5") - message(STATUS "Jenkins integration: select HTML5 HMI") - set (HMI "web") - elseif (${HMI_TYPE_OPTION} STREQUAL "NONE") + if (${HMI_TYPE_OPTION} STREQUAL "NONE") message(STATUS "Jenkins integration: select HMI none") set (HMI "no") else () - message(STATUS "Jenkins integration: select QML HMI none") - set (HMI "qt") + message(STATUS "Jenkins integration: select HTML5 HMI") + set (HMI "web") endif() endif() @@ -324,38 +320,10 @@ if (EXTENDED_MEDIA_MODE) add_definitions(${GLIB2_CFLAGS}) endif() -if(HMI STREQUAL "qt") - if(CMAKE_SYSTEM_NAME STREQUAL "QNX") - set(qt_version "4.8.5") - else() - set(qt_version "5.1.0") - endif() - - execute_process( - COMMAND ${CMAKE_SOURCE_DIR}/FindQt.sh -v ${qt_version} - OUTPUT_VARIABLE qt_bin_dir - ) - message(STATUS "Binary directory Qt ${qt_version} is ${qt_bin_dir}") - set(ENV{PATH} ${qt_bin_dir}:$ENV{PATH}) - - if(CMAKE_SYSTEM_NAME STREQUAL "QNX") - find_package(Qt4 ${qt_version} REQUIRED QtCore QtGui QtDBus QtDeclarative) - else () - find_package(Qt5Core REQUIRED) - find_package(Qt5DBus REQUIRED) - find_package(Qt5Qml REQUIRED) - find_package(Qt5Quick REQUIRED) - set(qmlplugindump_binary ${qt_bin_dir}/qmlplugindump) - endif() -endif() - # Building application # --- Type HMI -if (HMI STREQUAL "qt") - set(QT_HMI ON) - add_definitions(-DQT_HMI) -elseif (HMI STREQUAL "web") +if (HMI STREQUAL "web") set(WEB_HMI ON) add_definitions(-DWEB_HMI) else () @@ -363,9 +331,6 @@ else () add_definitions(-DNO_HMI) endif () -if (HMI STREQUAL "qt" AND NOT DEFINED HMIADAPTER) - set(HMIADAPTER "dbus") -endif() if (HMI STREQUAL "web" AND NOT DEFINED HMIADAPTER) set(HMIADAPTER "messagebroker") endif() diff --git a/FindQt.sh b/FindQt.sh deleted file mode 100755 index 71a7b10a12..0000000000 --- a/FindQt.sh +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env bash - -# 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. - -usage() { - echo "Usage: $0 [-v <version>] [-b] [<file name>]" - echo - echo " Look for file in Qt directory." - echo " If file name isn't set then look for bin directory." - echo - echo " -v <version> look for Qt specific version x.x.x" - echo " -b look for binary file" - echo -} - -version2int() { - IFS="." - local ver=0 - for i in $1; do - ver=$(( $ver * 32 + $i )) - done - echo $ver -} - -version_match() { - v1=$(version2int $1) - v2=$(version2int $2) - # It's bash way to say "if ((version1 < version2) and (major1 == major2)) - if [[ ( $v1 -le $v2 ) && ( $(( ($v1 / 1024) - ($v2 / 1024) )) == 0 ) ]]; then - return 0; - else - return 1; - fi -} - -qmake_data() { - $1 --version 2>/dev/null | grep "Using Qt version" | sed "s/.*Qt version \\([0-9\\.]*\\) in \\(.*\\)$/\\$2/" -} - -find_binary() { - local qt_binary="$1/$2" # check specified binary - if [[ -x $qt_binary && ! -d $qt_binary ]]; then # to be executable and not to be directory - echo -n $qt_binary # output without newline - return 0 - fi - return 1 -} - -find_file() { - local qt_file=$(find $1 -name "$2" -type f -print0 -quit 2>/dev/null) # check specified binary - if [[ -n $qt_file && ! -d $qt_file ]]; then # if found - echo -n $qt_file #output without newline - return 0 - fi - return 1 -} - -type=file -version="0.0.0" -while getopts :v:b option; do - case "$option" in - v) version=$OPTARG ;; - b) type=binary ;; - *) usage; exit 1; ;; - esac -done - -shift $(( OPTIND - 1 )) -if [[ -z $1 ]]; then - type=bindir -else - file_name=$1 -fi - -## First attempt - using locate -if command -v locate > /dev/null; then - for searchloc in $CUSTOM_QT_DIR ~ /opt /usr/local; do - qmake_list=$(locate $searchloc/*/bin/qmake) - for qmake in $qmake_list; do - if [[ ! -x $qmake || -d $qmake ]]; then - continue - fi - # called with "qmake 1" return qmake version - qt_version=$(qmake_data $qmake 1) - if ! version_match $version $qt_version; then - continue - fi - - case $type in - binary) - qt_dir=$(dirname $qmake 2> /dev/null) - if find_binary $qt_dir $file_name; then - exit 0 - fi - ;; - file) - # called with "qmake 2" return Qt installation dir - qt_installdir=$(qmake_data $qmake 2) - if find_file $qt_installdir $file_name; then - exit 0 - fi - ;; - bindir) - echo -n $(dirname $qmake 2>/dev/null) - exit 0 - ;; - esac - done - done -fi - -## Second attempt - using find -export -f find_file -export -f qmake_data -export -f version_match -export -f version2int - -qmake=$(find -L $CUSTOM_QT_DIR ~ /opt /usr/local -name '.*' -prune \ - -o -name qmake -type f \ - -executable \ - -exec /bin/bash -c "version_qt=\$(qmake_data {} 1);version_match $version \$version_qt" {} \; -print -quit > /dev/null) -if ! [ $? ]; then - exit 1; -fi - -case $type in - binary) - qt_dir=$(dirname $qmake 2>/dev/null) - if find_binary $qt_dir $file_name; then - exit 0 - fi - ;; - file) - # called with "qmake 2" return Qt installation dir - qt_installdir=$(qmake_data $qmake 2) - if find_file $qt_installdir $file_name; then - exit 0 - fi - ;; - bindir) - echo -n $(dirname $qmake 2>/dev/null) - exit 0 - ;; -esac - -exit 1 @@ -65,7 +65,6 @@ The dependencies for SDL Core vary based on the configuration. You can change SD | Flag | Description | Dependencies | |------|-------------|--------------| |Web HMI|Use HTML5 HMI|chromium-browser| -|HMI2|Build with QT HMI|QT5, dbus-*dev| |EXTENDED_MEDIA_MODE|Support Video and Audio Streaming|Opengl es2, gstreamer1.0*| |Bluetooth|Enable bluetooth transport adapter|libbluetooth3, libbluetooth-dev, bluez-tools| |Testing framework|Needed to support running unit tests|libgtest-dev| diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc index 7487052129..d2fd1e8972 100644 --- a/src/appMain/life_cycle.cc +++ b/src/appMain/life_cycle.cc @@ -153,6 +153,7 @@ bool LifeCycle::StartComponents() { security_manager_->AddListener(app_manager_); app_manager_->AddPolicyObserver(crypto_manager_); + app_manager_->AddPolicyObserver(protocol_handler_); if (!crypto_manager_->Init()) { LOG4CXX_ERROR(logger_, "CryptoManager initialization fail."); return false; diff --git a/src/appMain/main.cc b/src/appMain/main.cc index f32f03f74b..5832163066 100644 --- a/src/appMain/main.cc +++ b/src/appMain/main.cc @@ -90,23 +90,6 @@ bool InitHmi(std::string hmi_link) { .Execute(); } #endif // WEB_HMI - -#ifdef QT_HMI -/** - * Initialize HTML based HMI. - * @return true if success otherwise false. - */ -bool InitHmi() { - std::string kStartHmi = "./start_hmi.sh"; - struct stat sb; - if (stat(kStartHmi.c_str(), &sb) == -1) { - LOG4CXX_FATAL(logger_, "HMI start script doesn't exist!"); - return false; - } - - return utils::System(kStartHmi).Execute(); -} -#endif // QT_HMI } /** @@ -178,16 +161,13 @@ int32_t main(int32_t argc, char** argv) { if (profile_instance.server_address() == kLocalHostAddress) { LOG4CXX_INFO(logger_, "Start HMI on localhost"); -#ifndef NO_HMI #ifdef WEB_HMI - if (!InitHmi(profile_instance.link_to_web_hmi())) { LOG4CXX_INFO(logger_, "InitHmi successful"); } else { LOG4CXX_WARN(logger_, "Failed to init HMI"); } #endif -#endif // #ifndef NO_HMI } } // -------------------------------------------------------------------------- diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json index 58abfb6f80..12ebafcb89 100644 --- a/src/appMain/sdl_preloaded_pt.json +++ b/src/appMain/sdl_preloaded_pt.json @@ -13,10 +13,10 @@ 625],
"endpoints": {
"0x07": {
- "default": ["http://policies.telematics.ford.com/api/policies"]
+ "default": ["http://localhost:3000/api/1/policies/proprietary"]
},
"0x04": {
- "default": ["http://ivsu.software.ford.com/api/getsoftwareupdates"]
+ "default": ["http://localhost:3000/api/1/softwareUpdate"]
},
"queryAppsUrl": {
"default": ["http://sdl.shaid.server"]
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini index accaf4f888..7a7b901979 100644 --- a/src/appMain/smartDeviceLink.ini +++ b/src/appMain/smartDeviceLink.ini @@ -89,6 +89,12 @@ ReadDIDRequest = 5, 1 GetVehicleDataRequest = 5, 1 PluginFolder = plugins +; The time used during switch transport procedure +AppTransportChangeTimer = 500 + +; The time used as addition for AppTransportChangeTimer +AppTransportChangeTimerAddition = 0 + [MEDIA MANAGER] ; where 3 is a number of retries and 1000 is a timeout in milliseconds for request frequency StartStreamRetry = 3, 1000 diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt index 6c3a355cfc..e9f2f8ec7b 100644 --- a/src/components/application_manager/CMakeLists.txt +++ b/src/components/application_manager/CMakeLists.txt @@ -324,6 +324,7 @@ set (HMI_COMMANDS_SOURCES ${COMMANDS_SOURCE_DIR}/hmi/on_system_error_notification.cc ${COMMANDS_SOURCE_DIR}/hmi/basic_communication_system_request.cc ${COMMANDS_SOURCE_DIR}/hmi/basic_communication_system_response.cc + ${COMMANDS_SOURCE_DIR}/hmi/basic_communication_on_awake_sdl.cc ${COMMANDS_SOURCE_DIR}/hmi/sdl_policy_update.cc ${COMMANDS_SOURCE_DIR}/hmi/sdl_policy_update_response.cc ${COMMANDS_SOURCE_DIR}/hmi/on_received_policy_update.cc diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index 3a03cb5343..eca22afa63 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -48,6 +48,7 @@ #include "application_manager/application_state.h" #include "protocol_handler/protocol_handler.h" #include "smart_objects/smart_object.h" +#include "utils/macro.h" namespace application_manager { @@ -161,7 +162,7 @@ typedef std::set<uint32_t> SoftButtonID; /** * @brief Defines set of vehicle info types */ -typedef std::set<uint32_t> VehicleInfoSubscriptions; +typedef std::set<mobile_apis::VehicleDataType::eType> VehicleInfoSubscriptions; /** * @brief Defines set of buttons subscription @@ -409,6 +410,20 @@ class Application : public virtual InitialApplicationData, virtual void UpdateHash() = 0; /** + * @brief checks is hashID was changed during suspended state + * @return Returns TRUE if hashID was changed during suspended state + * otherwise returns FALSE. + */ + virtual bool IsHashChangedDuringSuspend() const = 0; + + /** + * @brief changes state of the flag which tracks is hashID was changed during + * suspended state or not + * @param state new state of the flag + */ + virtual void SetHashChangedDuringSuspend(const bool state) = 0; + + /** * @brief method is called when SDL is saving application data for resumption * @return TRUE if data of application need to save for resumption, otherwise * return FALSE @@ -547,7 +562,8 @@ class Application : public virtual InitialApplicationData, virtual void increment_list_files_in_none_count() = 0; virtual bool set_app_icon_path(const std::string& file_name) = 0; virtual void set_app_allowed(const bool allowed) = 0; - virtual void set_device(connection_handler::DeviceHandle device) = 0; + DEPRECATED virtual void set_device( + connection_handler::DeviceHandle device) = 0; virtual uint32_t get_grammar_id() const = 0; virtual void set_grammar_id(uint32_t value) = 0; @@ -604,6 +620,13 @@ class Application : public virtual InitialApplicationData, virtual UsageStatistics& usage_report() = 0; /** + * @brief SetInitialState sets initial HMI state for application on + * registration + * @param state Hmi state value + */ + virtual void SetInitialState(HmiStatePtr state) = 0; + + /** * @brief SetRegularState set permanent state of application * * @param state state to setup @@ -693,6 +716,16 @@ class Application : public virtual InitialApplicationData, virtual bool IsAudioApplication() const = 0; /** + * DEPRECATED + * @brief GetDeviceId allows to obtain device id which posseses + * by this application. + * @return device the device id. + */ + std::string GetDeviceId() const { + return device_id_; + } + + /** * @brief IsRegistered allows to distinguish if this * application has been registered. * @@ -750,16 +783,6 @@ class Application : public virtual InitialApplicationData, } /** - * @brief GetDeviceId allows to obtain device id which posseses - * by this application. - * - * @return device the device id. - */ - std::string GetDeviceId() const { - return device_id_; - } - - /** * @brief Returns is application should be greyed out on HMI */ bool is_greyed_out() const { @@ -837,7 +860,7 @@ class Application : public virtual InitialApplicationData, * @brief Get list of subscriptions to vehicle info notifications * @return list of subscriptions to vehicle info notifications */ - virtual const std::set<uint32_t>& SubscribesIVI() const = 0; + virtual const VehicleInfoSubscriptions& SubscribesIVI() const = 0; #endif // SDL_REMOTE_CONTROL protected: diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index dc2d8ce528..fd6dd13e39 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -52,6 +52,7 @@ #include "utils/atomic_object.h" #include "utils/custom_string.h" #include "utils/timer.h" +#include "utils/macro.h" namespace usage_statistics { @@ -65,6 +66,19 @@ using namespace timer; namespace mobile_api = mobile_apis; namespace custom_str = custom_string; +/** + * @brief SwitchApplicationParameters updates application internal parameters + * on transport switch. Must be used only for switching flow. + * @param app Pointer to switched application + * @param app_id New application id (connection key) + * @param device_id New device id + * @param mac_address New device MAC address + */ +void SwitchApplicationParameters(ApplicationSharedPtr app, + const uint32_t app_id, + const size_t device_id, + const std::string& mac_address); + class ApplicationImpl : public virtual Application, public virtual InitialApplicationDataImpl, public virtual DynamicApplicationDataImpl { @@ -73,6 +87,15 @@ class ApplicationImpl : public virtual Application, uint32_t application_id, const std::string& policy_app_id, const std::string& mac_address, + const connection_handler::DeviceHandle device_id, + const custom_str::CustomString& app_name, + utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + ApplicationManager& application_manager); + + DEPRECATED ApplicationImpl( + uint32_t application_id, + const std::string& policy_app_id, + const std::string& mac_address, const custom_str::CustomString& app_name, utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, ApplicationManager& application_manager); @@ -198,17 +221,28 @@ class ApplicationImpl : public virtual Application, virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const OVERRIDE; virtual const std::string& curHash() const; -#ifdef CUSTOMER_PASA - virtual bool flag_sending_hash_change_after_awake() const; - virtual void set_flag_sending_hash_change_after_awake(bool flag); -#endif // CUSTOMER_PASA - /** - * @brief Change Hash for current application - * and send notification to mobile - * @return updated_hash - */ + + /** + * @brief Change Hash for current application + * and send notification to mobile + * @return updated_hash + */ virtual void UpdateHash(); + /** + * @brief checks is hashID was changed during suspended state + * @return Returns TRUE if hashID was changed during suspended state + * otherwise returns FALSE. + */ + bool IsHashChangedDuringSuspend() const OVERRIDE; + + /** + * @brief changes state of the flag which tracks is hashID was changed during + * suspended state or not + * @param state new state of the flag + */ + void SetHashChangedDuringSuspend(const bool state) OVERRIDE; + UsageStatistics& usage_report(); bool AreCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id, @@ -232,6 +266,13 @@ class ApplicationImpl : public virtual Application, virtual bool IsAudioApplication() const; /** + * @brief SetInitialState sets initial HMI state for application on + * registration + * @param state Hmi state value + */ + void SetInitialState(HmiStatePtr state) FINAL; + + /** * @brief SetRegularState set permanent state of application * * @param state state to setup @@ -331,7 +372,7 @@ class ApplicationImpl : public virtual Application, * @brief Get list of subscriptions to vehicle info notifications * @return list of subscriptions to vehicle info notifications */ - const std::set<uint32_t>& SubscribesIVI() const OVERRIDE; + const VehicleInfoSubscriptions& SubscribesIVI() const OVERRIDE; /** * @brief Return pointer to extension by uid @@ -422,8 +463,8 @@ class ApplicationImpl : public virtual Application, uint32_t delete_file_in_none_count_; uint32_t list_files_in_none_count_; std::string app_icon_path_; - connection_handler::DeviceHandle device_; - const std::string mac_address_; + std::string mac_address_; + connection_handler::DeviceHandle device_id_; std::string bundle_id_; AppFilesMap app_files_; std::set<mobile_apis::ButtonName::eType> subscribed_buttons_; @@ -432,6 +473,7 @@ class ApplicationImpl : public virtual Application, protocol_handler::MajorProtocolVersion protocol_version_; bool is_voice_communication_application_; sync_primitives::atomic_bool is_resuming_; + bool is_hash_changed_during_suspend_; uint32_t video_stream_retry_number_; uint32_t audio_stream_retry_number_; @@ -467,6 +509,12 @@ class ApplicationImpl : public virtual Application, sync_primitives::Lock button_lock_; std::string folder_name_; ApplicationManager& application_manager_; + + friend void SwitchApplicationParameters(ApplicationSharedPtr app, + const uint32_t app_id, + const size_t device_id, + const std::string& mac_address); + DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); }; diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 7a26501afc..22ae032a00 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -48,12 +48,12 @@ #include "application_manager/message_helper.h" #include "application_manager/request_controller.h" #include "application_manager/resumption/resume_ctrl.h" -#include "application_manager/vehicle_info_data.h" #include "application_manager/state_controller_impl.h" #include "application_manager/app_launch/app_launch_data.h" #include "application_manager/application_manager_settings.h" #include "application_manager/event_engine/event_dispatcher_impl.h" #include "application_manager/hmi_interfaces_impl.h" +#include "application_manager/command_holder.h" #include "protocol_handler/protocol_observer.h" #include "protocol_handler/protocol_handler.h" @@ -311,6 +311,7 @@ class ApplicationManagerImpl bool IsAppTypeExistsInFullOrLimited(ApplicationConstSharedPtr app) const; /** + * DEPRECATED * @brief Checks if Application is subscribed for way points * @param Application AppID * @return true if Application is subscribed for way points @@ -319,18 +320,40 @@ class ApplicationManagerImpl bool IsAppSubscribedForWayPoints(const uint32_t app_id) const OVERRIDE; /** + * DEPRECATED * @brief Subscribe Application for way points * @param Application AppID */ void SubscribeAppForWayPoints(const uint32_t app_id) OVERRIDE; /** + * DEPRECATED * @brief Unsubscribe Application for way points * @param Application AppID */ void UnsubscribeAppFromWayPoints(const uint32_t app_id) OVERRIDE; /** + * @brief Checks if Application is subscribed for way points + * @param Application pointer + * @return true if Application is subscribed for way points + * otherwise false + */ + bool IsAppSubscribedForWayPoints(ApplicationSharedPtr app) const OVERRIDE; + + /** + * @brief Subscribe Application for way points + * @param Application pointer + */ + void SubscribeAppForWayPoints(ApplicationSharedPtr app) OVERRIDE; + + /** + * @brief Unsubscribe Application for way points + * @param Application pointer + */ + void UnsubscribeAppFromWayPoints(ApplicationSharedPtr app) OVERRIDE; + + /** * @brief Is Any Application is subscribed for way points * @return true if some app is subscribed otherwise false */ @@ -349,11 +372,18 @@ class ApplicationManagerImpl * @param vehicle_info Enum value of type of vehicle data * @param new value (for integer values currently) of vehicle data */ - std::vector<ApplicationSharedPtr> IviInfoUpdated(VehicleDataType vehicle_info, - int value) OVERRIDE; + std::vector<ApplicationSharedPtr> IviInfoUpdated( + mobile_apis::VehicleDataType::eType vehicle_info, int value) OVERRIDE; void OnApplicationRegistered(ApplicationSharedPtr app) OVERRIDE; + /** + * @brief OnApplicationSwitched starts processing of commands collected + * during device switching process + * @param app Application + */ + void OnApplicationSwitched(ApplicationSharedPtr app) OVERRIDE; + HMICapabilities& hmi_capabilities() OVERRIDE; const HMICapabilities& hmi_capabilities() const OVERRIDE; @@ -423,8 +453,9 @@ class ApplicationManagerImpl */ void UnregisterAllApplications(); - bool RemoveAppDataFromHMI(ApplicationSharedPtr app); - bool LoadAppDataToHMI(ApplicationSharedPtr app); + DEPRECATED bool RemoveAppDataFromHMI(ApplicationSharedPtr app); + + DEPRECATED bool LoadAppDataToHMI(ApplicationSharedPtr app); bool ActivateApplication(ApplicationSharedPtr app) OVERRIDE; /** @@ -474,6 +505,7 @@ class ApplicationManagerImpl void set_driver_distraction(const bool is_distracting) OVERRIDE; /* + * DEPRECATED * @brief Retrieves if VR session has started * * @return Current VR session state (started, stopped) @@ -481,6 +513,7 @@ class ApplicationManagerImpl inline bool vr_session_started() const; /* + * DEPRECATED * @brief Sets VR session state * * @param state Current HMI VR session state @@ -503,13 +536,28 @@ class ApplicationManagerImpl /** * @brief CreateRegularState create regular HMI state for application - * @param app_id + * @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 */ 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 OVERRIDE; + + /** + * 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 + */ + DEPRECATED HmiStatePtr CreateRegularState( uint32_t app_id, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, @@ -838,8 +886,27 @@ class ApplicationManagerImpl void OnFindNewApplicationsRequest() OVERRIDE; void RemoveDevice( const connection_handler::DeviceHandle& device_handle) OVERRIDE; - // DEPRECATED - bool OnServiceStartedCallback( + + /** + * @brief OnDeviceSwitchingStart is invoked on device transport switching + * start (e.g. from Bluetooth to USB) and creates waiting list of applications + * expected to be re-registered after switching is complete + * @param device_from device params being switched to the new transport + * @param device_to device params on the new transport + */ + void OnDeviceSwitchingStart( + const connection_handler::Device& device_from, + const connection_handler::Device& device_to) FINAL; + + /** + * @brief OnDeviceSwitchingFinish is invoked on device trasport switching end + * i.e. timeout for switching is expired, unregisters applications from + * waiting list which haven't been re-registered and clears the waiting list + * @param device_uid UID of device being switched + */ + void OnDeviceSwitchingFinish(const std::string& device_uid) FINAL; + + DEPRECATED bool OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, const protocol_handler::ServiceType& type) OVERRIDE; @@ -854,15 +921,43 @@ class ApplicationManagerImpl const connection_handler::CloseSessionReason& close_reason) OVERRIDE; #ifdef ENABLE_SECURITY - // Overriden SecurityManagerListener method + /** + * @brief Notification about protection result + * @param connection_key Unique key of session which triggers handshake + * @param result result of connection protection + * @return true on success notification handling or false otherwise + */ bool OnHandshakeDone( uint32_t connection_key, security_manager::SSLContext::HandshakeResult result) OVERRIDE; + /** + * @brief Notification that certificate update is required. + */ void OnCertificateUpdateRequired() OVERRIDE; + /** + * @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 + */ + bool GetPolicyCertificateData(std::string& data) const OVERRIDE; + + /** + * @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 + */ security_manager::SSLContext::HandshakeContext GetHandshakeContext( uint32_t key) const OVERRIDE; + + /** + * @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 + */ + bool CheckAppIsNavi(const uint32_t app_id) const OVERRIDE; #endif // ENABLE_SECURITY /** @@ -991,15 +1086,15 @@ class ApplicationManagerImpl uint32_t GenerateNewHMIAppID() OVERRIDE; /** + * DERPECATED * @brief Parse smartObject and replace mobile app Id by HMI app ID - * * @param message Smartobject to be parsed */ void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); /** + * DEPRECATED * @brief Parse smartObject and replace HMI app ID by mobile app Id - * * @param message Smartobject to be parsed */ void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); @@ -1056,6 +1151,7 @@ class ApplicationManagerImpl void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id) OVERRIDE; /** + * DEPRECATED * @brief method adds application in FULL and LIMITED state * to on_phone_call_app_list_. * Also OnHMIStateNotification with BACKGROUND state sent for these apps @@ -1063,6 +1159,7 @@ class ApplicationManagerImpl void CreatePhoneCallAppList(); /** + * DEPRECATED * @brief method removes application from on_phone_call_app_list_. * * Also OnHMIStateNotification with previous HMI state sent for these apps @@ -1169,15 +1266,6 @@ class ApplicationManagerImpl } }; - struct SubscribedToIVIPredicate { - int32_t vehicle_info_; - SubscribedToIVIPredicate(int32_t vehicle_info) - : vehicle_info_(vehicle_info) {} - bool operator()(const ApplicationSharedPtr app) const { - return app ? app->IsSubscribedToIVI(vehicle_info_) : false; - } - }; - struct GrammarIdPredicate { uint32_t grammar_id_; GrammarIdPredicate(uint32_t grammar_id) : grammar_id_(grammar_id) {} @@ -1214,11 +1302,32 @@ class ApplicationManagerImpl bool IsAppsQueriedFrom( const connection_handler::DeviceHandle handle) const OVERRIDE; + /** + * @brief IsAppInReconnectMode check if application belongs to session + * affected by transport switching at the moment by checking internal + * waiting list prepared on switching start + * @param policy_app_id Application id + * @return True if application is in the waiting list, otherwise - false + */ + bool IsAppInReconnectMode(const std::string& policy_app_id) const FINAL; + bool IsStopping() const OVERRIDE { return is_stopping_; } /** + * @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 + */ + void ProcessReconnection(ApplicationSharedPtr application, + const uint32_t connection_key) FINAL; + + /** * @brief Clears all applications' persistent data */ void ClearAppsPersistentData(); @@ -1402,9 +1511,8 @@ class ApplicationManagerImpl * @param service_type Type of service to start * @return True on success, false on fail */ - // DEPRECATED - bool StartNaviService(uint32_t app_id, - protocol_handler::ServiceType service_type); + DEPRECATED bool StartNaviService(uint32_t app_id, + protocol_handler::ServiceType service_type); /** * @brief Starts specified navi service for application @@ -1488,6 +1596,28 @@ class ApplicationManagerImpl void ClearTTSGlobalPropertiesList(); /** + * @brief EraseAppFromReconnectionList drops application from reconnection + * list on transport switch success + * @param app Pointer to application + */ + void EraseAppFromReconnectionList(const ApplicationSharedPtr& app); + + /** + * @brief SwitchApplication updates parameters of switched application and + * internal applications list + * @param app Pointer to switched application, must be validated before + * passing in + * @param connection_key Connection key of switched application from its + * registration request + * @param device_id Device id of switched application + * @param mac_address New device mac address + */ + void SwitchApplication(ApplicationSharedPtr app, + const uint32_t connection_key, + const size_t device_id, + const std::string& mac_address); + + /** * @brief Converts BSON object containing video parameters to * smart object's map object * @param output the smart object to add video parameters @@ -1620,6 +1750,15 @@ class ApplicationManagerImpl std::auto_ptr<app_launch::AppLaunchData> app_launch_dto_; std::auto_ptr<app_launch::AppLaunchCtrl> app_launch_ctrl_; + /** + * @brief ReregisterWaitList is list of applications expected to be + * re-registered after transport switching is complete + */ + typedef std::vector<ApplicationSharedPtr> ReregisterWaitList; + ReregisterWaitList reregister_wait_list_; + + mutable sync_primitives::Lock reregister_wait_list_lock_; + #ifdef TELEMETRY_MONITOR AMTelemetryObserver* metric_observer_; #endif // TELEMETRY_MONITOR @@ -1634,6 +1773,8 @@ class ApplicationManagerImpl volatile bool is_stopping_; + std::unique_ptr<CommandHolder> commands_holder_; + #ifdef BUILD_TESTS public: /** @@ -1649,7 +1790,7 @@ class ApplicationManagerImpl DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl); }; -bool ApplicationManagerImpl::vr_session_started() const { +DEPRECATED bool ApplicationManagerImpl::vr_session_started() const { return is_vr_session_strated_; } diff --git a/src/components/application_manager/include/application_manager/command_holder.h b/src/components/application_manager/include/application_manager/command_holder.h new file mode 100644 index 0000000000..d3171aedbb --- /dev/null +++ b/src/components/application_manager/include/application_manager/command_holder.h @@ -0,0 +1,85 @@ +/* + * 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_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_HOLDER_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_HOLDER_H_ + +#include <string> +#include "application_manager/application.h" +#include "smart_objects/smart_object.h" +#include "utils/shared_ptr.h" + +namespace application_manager { +/** + * @brief The CommandHolder class should hold commands for particular + * application until certain event happens + */ +class CommandHolder { + public: + /** + * @brief The CommandType enum defines type of command to suspend or resume + */ + enum class CommandType { kHmiCommand, kMobileCommand }; + + /** + * @brief ~CommandsHolder destructor + */ + virtual ~CommandHolder() {} + + /** + * @brief Suspend collects command for specific application policy id + * internally + * @param application Application pointer + * @param type Command type + * @param command Command + */ + virtual void Suspend(ApplicationSharedPtr application, + CommandType type, + smart_objects::SmartObjectSPtr command) = 0; + + /** + * @brief Resume send all collected commands for further processing and + * removes them afterward + * @param application Application pointer + * @param type Command type + */ + virtual void Resume(ApplicationSharedPtr application, CommandType type) = 0; + + /** + * @brief Clear removes all collected commands w/o processing + * @param application Application pointer + */ + virtual void Clear(ApplicationSharedPtr application) = 0; +}; +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_HOLDER_H_ diff --git a/src/components/application_manager/include/application_manager/command_holder_impl.h b/src/components/application_manager/include/application_manager/command_holder_impl.h new file mode 100644 index 0000000000..ed5f6baa62 --- /dev/null +++ b/src/components/application_manager/include/application_manager/command_holder_impl.h @@ -0,0 +1,110 @@ +/* + * 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_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_HOLDER_IMPL_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_HOLDER_IMPL_H_ + +#include "application_manager/command_holder.h" + +#include <string> +#include <vector> +#include <map> +#include "application_manager/application.h" +#include "smart_objects/smart_object.h" +#include "utils/lock.h" +#include "utils/shared_ptr.h" +#include "utils/macro.h" + +namespace application_manager { +class ApplicationManager; +/** + * @brief The CommandHolderImpl class should hold commands for particular + * application during application transport switching process and sends for + * processing after switching is completed successfully or drops otherwise + */ +class CommandHolderImpl : public CommandHolder { + public: + /** + * @brief CommandHolderImpl constructor + */ + + explicit CommandHolderImpl(ApplicationManager& app_manager); + + /** + * @brief Suspend collects command for specific application id internally + * @param application Application pointer + * @param type Command type + * @param command Command + */ + void Suspend(ApplicationSharedPtr application, + CommandType type, + smart_objects::SmartObjectSPtr command) FINAL; + + /** + * @brief Resume sends all collected HMI commands to ApplicationManager + * for further processing + * @param application Application pointer + * @param type Command type + */ + void Resume(ApplicationSharedPtr application, CommandType type) FINAL; + + /** + * @brief Clear removes all commands collected for specific application id + * @param application Application pointer + */ + void Clear(ApplicationSharedPtr application) FINAL; + + private: + /** + * @brief ResumeHmiCommand sends suspended HMI commands for processing + * @param application Application which commands to process + */ + void ResumeHmiCommand(ApplicationSharedPtr app); + + /** + * @brief ResumeMobileCommand sends suspended mobile commands for processing + * @param application Application which commands to process + */ + void ResumeMobileCommand(ApplicationSharedPtr application); + + using AppCommands = + std::map<ApplicationSharedPtr, + std::vector<utils::SharedPtr<smart_objects::SmartObject> > >; + + ApplicationManager& app_manager_; + sync_primitives::Lock commands_lock_; + AppCommands app_mobile_commands_; + AppCommands app_hmi_commands_; +}; +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMAND_HOLDER_IMPL_H_ diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h index 66456dfdb1..5fee7500ce 100644 --- a/src/components/application_manager/include/application_manager/commands/command_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_impl.h @@ -142,16 +142,30 @@ class CommandImpl : public Command { protected: /** - * @brief Parse smartObject and replace mobile app Id by HMI app ID - * - * @param message Smartobject to be parsed + * @brief Parses mobile message and replaces mobile app id with HMI app id + * @param message Message to replace its ids + * @return True if replacement succeeded, otherwise - false + */ + bool ReplaceMobileWithHMIAppId(smart_objects::SmartObject& message); + + /** + * DEPRECATED + * @brief Parses mobile message and replaces mobile app id with HMI app id + * @param message Message to replace its ids */ void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message); /** - * @brief Parse smartObject and replace HMI app ID by mobile app Id - * - * @param message Smartobject to be parsed + * @brief Parses message from HMI and replaces HMI app id with mobile app id + * @param message Message to replace its ids + * @return True if replacement succeeded, otherwise - false + */ + bool ReplaceHMIWithMobileAppId(smart_objects::SmartObject& message); + + /** + * DEPRECATED + * @brief Parses message from HMI and replaces HMI app id with mobile app id + * @param message Message to replace its ids */ void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message); diff --git a/src/components/application_manager/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/include/application_manager/commands/command_request_impl.h index aa3c216d4d..74a884a223 100644 --- a/src/components/application_manager/include/application_manager/commands/command_request_impl.h +++ b/src/components/application_manager/include/application_manager/commands/command_request_impl.h @@ -43,27 +43,18 @@ namespace application_manager { namespace commands { struct ResponseInfo { - ResponseInfo() - : result_code(hmi_apis::Common_Result::INVALID_ENUM) - , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM) - , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) - , is_ok(false) - , is_unsupported_resource(false) - , is_invalid_enum(false) {} - ResponseInfo(hmi_apis::Common_Result::eType result, - HmiInterfaces::InterfaceID interface) - : result_code(result) - , interface(interface) - , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) - , is_ok(false) - , is_unsupported_resource(false) - , is_invalid_enum(false) {} + DEPRECATED ResponseInfo(hmi_apis::Common_Result::eType result, + HmiInterfaces::InterfaceID interface); + ResponseInfo(); + ResponseInfo(const hmi_apis::Common_Result::eType result, + const HmiInterfaces::InterfaceID hmi_interface, + ApplicationManager& application_manager); hmi_apis::Common_Result::eType result_code; HmiInterfaces::InterfaceID interface; HmiInterfaces::InterfaceState interface_state; bool is_ok; bool is_unsupported_resource; - bool is_invalid_enum; + bool is_not_used; }; namespace NsSmart = NsSmartDeviceLink::NsSmartObjects; @@ -290,6 +281,19 @@ class CommandRequestImpl : public CommandImpl, mobile_apis::Result::eType PrepareResultCodeForResponse( const ResponseInfo& first, const ResponseInfo& second); + /** + * @brief Resolves if the return code must be + * UNSUPPORTED_RESOURCE + * @param first contains result_code from HMI response and + * interface that returns response + * @param second contains result_code from HMI response and + * interface that returns response. + * @return True, if the communication return code must be + * UNSUPPORTED_RESOURCE, otherwise false. + */ + bool IsResultCodeUnsupported(const ResponseInfo& first, + const ResponseInfo& second) const; + protected: /** * @brief Returns policy parameters permissions @@ -297,6 +301,35 @@ class CommandRequestImpl : public CommandImpl, */ const CommandParametersPermissions& parameters_permissions() const; + /** + * @brief Adds interface to be awaited for by sdl request command + @param interface_id interface which SDL expects to response in given time + */ + void StartAwaitForInterface(const HmiInterfaces::InterfaceID interface_id); + + /** + * @brief Gets interface await state. + * @param interface_id interface which SDL awaits for response in given time + * @return true if SDL awaits for response from given interface in + * interface_id + */ + bool IsInterfaceAwaited(const HmiInterfaces::InterfaceID& interface_id) const; + + /** + * @brief Sets given HMI interface await status to false + * @param interface_id interface which SDL no longer awaits for response in + * given time + */ + void EndAwaitForInterface(const HmiInterfaces::InterfaceID& interface_id); + + /** + * @brief This set stores all the interfaces which are awaited by SDL to + * return a response on some request + */ + std::set<HmiInterfaces::InterfaceID> awaiting_response_interfaces_; + + mutable sync_primitives::Lock awaiting_response_interfaces_lock_; + RequestState current_state_; sync_primitives::Lock state_lock_; CommandParametersPermissions parameters_permissions_; @@ -331,10 +364,10 @@ class CommandRequestImpl : public CommandImpl, const hmi_apis::FunctionID::eType& function_id); /** - * @brief UpdateHash updates hash field for application and sends - * OnHashChanged notification to mobile side in case of approriate hash mode - * is set - */ + * @brief UpdateHash updates hash field for application and sends + * OnHashChanged notification to mobile side in case of approriate hash mode + * is set + */ void UpdateHash(); /** @@ -342,6 +375,13 @@ class CommandRequestImpl : public CommandImpl, * it is value of 'success' field of appropriate response sent to mobile */ bool is_success_result_; + + /** + * @brief Add information for the component of response in case of timeout + * @param response Response message, which info should be extended + */ + void AddTimeOutComponentInfoToMessage( + smart_objects::SmartObject& response) const; }; } // namespace commands diff --git a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h index f789a14780..daa71e68b5 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,3 +29,45 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_ + +#include "application_manager/commands/hmi/notification_from_hmi.h" + +namespace application_manager { + +namespace commands { + +/** + * @brief OnAwakeSDLNotification command class + **/ +class OnAwakeSDLNotification : public NotificationFromHMI { + public: + /** + * @brief OnAwakeSDLNotification class constructor + * @param message Incoming SmartObject message + * @param application_manager reference to ApplicationManager instance + **/ + OnAwakeSDLNotification(const MessageSharedPtr& message, + ApplicationManager& application_manager); + + /** + * @brief OnAwakeSDLNotification class destructor + **/ + virtual ~OnAwakeSDLNotification(); + + /** + * @brief Execute command + **/ + void Run() FINAL; + + private: + DISALLOW_COPY_AND_ASSIGN(OnAwakeSDLNotification); +}; + +} // namespace commands + +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_ diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h index 980e558d6f..f49dac071f 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_app_unregistered_notification.h @@ -55,12 +55,22 @@ class OnAppUnregisteredNotification : public NotificationToHMI { /** * @brief OnAppUnregisteredNotification class destructor **/ - virtual ~OnAppUnregisteredNotification(); + ~OnAppUnregisteredNotification() FINAL; + + /** + * @brief Init overrides and skips replacement of app id with hmi id since + * 1) at the moment this notification is being sent there is no application + * registered in application manager + * 2) hmi id is already used whenever this message is being constructed, so + * its already there + * @return True in any case + */ + bool Init() FINAL; /** * @brief Execute command **/ - virtual void Run(); + virtual void Run() FINAL; private: DISALLOW_COPY_AND_ASSIGN(OnAppUnregisteredNotification); diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h index a752e00801..92ef97a4aa 100644 --- a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h +++ b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h @@ -60,7 +60,7 @@ class OnExitAllApplicationsNotification : public NotificationFromHMI { /** * @brief Execute command **/ - virtual void Run(); + void Run() FINAL; private: /** diff --git a/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h b/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h index 77f1813e46..01b9782662 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/alert_request.h @@ -72,13 +72,6 @@ class AlertRequest : public CommandRequestImpl { **/ virtual void Run(); - /* - * @brief Will caled by request controller, when default will be expired. - * If Alert request has soft buttons, timeout response should not be sent to - * mobile - */ - virtual void onTimeOut(); - /** * @brief Interface method that is called whenever new event received * diff --git a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h index f783af12b3..2cd8e386e0 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h @@ -167,6 +167,16 @@ class ChangeRegistrationRequest : public CommandRequestImpl { std::string vr_response_info_; std::string tts_response_info_; + void SendVRRequest(ApplicationSharedPtr app, + smart_objects::SmartObject& msg_params); + + void SendTTSRequest(ApplicationSharedPtr app, + smart_objects::SmartObject& msg_params); + + void SendUIRequest(ApplicationSharedPtr app, + smart_objects::SmartObject& msg_params, + const int32_t hmi_language); + DISALLOW_COPY_AND_ASSIGN(ChangeRegistrationRequest); }; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h index 99f86ea1d5..6e0e634459 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h @@ -87,12 +87,38 @@ class PerformAudioPassThruRequest : public CommandRequestImpl { private: /** * @brief Prepare result code, result and info for sending to mobile + * @brief Response params + * success for sending to mobile application + * result code for sending to mobile application + * info for sending to mobile application + */ + struct ResponseParams { + bool success; + mobile_apis::Result::eType result_code; + std::string info; + ResponseParams() + : success(false), result_code(mobile_apis::Result::INVALID_ENUM) {} + }; + + ResponseParams response_params_; + + /** + * @brief Prepare result code, result and info for sending to mobile * application * @param result_code contains result code for sending to mobile application * @return result for sending to mobile application. + * @deprecated */ - bool PrepareResponseParameters(mobile_apis::Result::eType& result_code, - std::string& info); + DEPRECATED bool PrepareResponseParameters( + mobile_apis::Result::eType& result_code, std::string& info); + /** + * @brief Prepare result code, 'success' result and info for sending + * to mobile application + * @param result_code contains result code for sending to mobile application + * @return result for sending to mobile application. + */ + const ResponseParams& PrepareResponseParameters(); + /** * @brief Sends TTS Speak request */ @@ -137,6 +163,23 @@ class PerformAudioPassThruRequest : public CommandRequestImpl { during perform audio pass thru*/ bool awaiting_tts_speak_response_; bool awaiting_ui_response_; + /** + * @brief Pair of result_code and success for mobile app + */ + typedef std::pair<mobile_apis::Result::eType, bool> AudioPassThruResults; + + /** + * @brief Checks result code from HMI for splitted RPC + * and returns parameter for sending to mobile app in + * audioPassThru communication. + * @param ui_response contains result_code from UI + * @param tts_response contains result_code from TTS + * @return pair of result code (UI error code has precedence than TTS's, + * error_code from TTS is turned to WARNINGS) and + * result for mobile app + */ + AudioPassThruResults PrepareAudioPassThruResultCodeForResponse( + const ResponseInfo& ui_response, const ResponseInfo& tts_response); hmi_apis::Common_Result::eType result_tts_speak_; hmi_apis::Common_Result::eType result_ui_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h index cc3d5b685c..5713e2e814 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h @@ -78,14 +78,29 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { virtual void Run(); /** - * @brief Sends RegisterAppInterface response to mobile - * - *@param application_impl application - * + * @brief Prepares and sends RegisterAppInterface response to mobile + * considering application type **/ void SendRegisterAppInterfaceResponseToMobile(); private: + /** + * @brief The AppicationType enum defines whether application is newly + * registered or existing and being switched over another transport + */ + enum class ApplicationType { + kNewApplication, + kSwitchedApplicationHashOk, + kSwitchedApplicationWrongHashId + }; + + /** + * @brief Prepares and sends RegisterAppInterface response to mobile + * considering application type + * @param app_type Type of application + **/ + void SendRegisterAppInterfaceResponseToMobile(ApplicationType app_type); + smart_objects::SmartObjectSPtr GetLockScreenIconUrlNotification( const uint32_t connection_key, ApplicationSharedPtr app); @@ -184,6 +199,15 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl { */ void SendSubscribeCustomButtonNotification(); + /** + * @brief IsApplicationSwitched checks whether application is switched from + * another transport. If application id is found, but not in reconnection + * list, returns 'already registered' code. Otherwise - proceed with + * switching. + * @return True if application is detected as switched, otherwise false. + */ + bool IsApplicationSwitched(); + private: std::string response_info_; mobile_apis::Result::eType result_checking_app_hmi_type_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h index eb955df197..c16a014c9f 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/reset_global_properties_request.h @@ -131,12 +131,6 @@ class ResetGlobalPropertiesRequest : public CommandRequestImpl { DISALLOW_COPY_AND_ASSIGN(ResetGlobalPropertiesRequest); - bool is_ui_send_; - bool is_tts_send_; - - bool is_ui_received_; - bool is_tts_received_; - hmi_apis::Common_Result::eType ui_result_; hmi_apis::Common_Result::eType tts_result_; std::string ui_response_info_; diff --git a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h index eb360b50d8..f556f81764 100644 --- a/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h +++ b/src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h @@ -148,6 +148,11 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl { */ VehicleInfoSubscriptions vi_already_subscribed_by_this_app_; + /** + * @brief VI parameters which wait for subscribe after HMI respond + */ + VehicleInfoSubscriptions vi_waiting_for_subscribe_; + DISALLOW_COPY_AND_ASSIGN(SubscribeVehicleDataRequest); }; diff --git a/src/components/application_manager/include/application_manager/helpers/application_helper.h b/src/components/application_manager/include/application_manager/helpers/application_helper.h new file mode 100644 index 0000000000..cecda0cd6f --- /dev/null +++ b/src/components/application_manager/include/application_manager/helpers/application_helper.h @@ -0,0 +1,97 @@ +/* + * 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_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELPERS_APPLICATION_HELPER_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELPERS_APPLICATION_HELPER_H_ + +#include "application_manager/application.h" +#include "application_manager/application_manager.h" + +/* + * This file is for code w/o direct usage of ApplicationManagerImpl internals + */ +namespace application_manager { + +/** + * Helper function for lookup through applications list and returning first + * application satisfying predicate logic + */ +template <class UnaryPredicate> +ApplicationSharedPtr FindApp(DataAccessor<ApplicationSet> accessor, + UnaryPredicate finder) { + ApplicationSet::iterator it = std::find_if( + accessor.GetData().begin(), accessor.GetData().end(), finder); + if (accessor.GetData().end() == it) { + return ApplicationSharedPtr(); + } + ApplicationSharedPtr app = *it; + return app; +} + +/** + * Helper function for lookup through applications list and returning all + * applications satisfying predicate logic + */ +template <class UnaryPredicate> +std::vector<ApplicationSharedPtr> FindAllApps( + DataAccessor<ApplicationSet> accessor, UnaryPredicate finder) { + std::vector<ApplicationSharedPtr> result; + ApplicationSetConstIt it = std::find_if( + accessor.GetData().begin(), accessor.GetData().end(), finder); + while (it != accessor.GetData().end()) { + result.push_back(*it); + it = std::find_if(++it, accessor.GetData().end(), finder); + } + return result; +} + +/** + * @brief The SubscribedToIVIPredicate is predicate for lookup within + * applications list for apps subscribed for specific vehicle data + */ +struct SubscribedToIVIPredicate { + uint32_t vehicle_info_; + explicit SubscribedToIVIPredicate(uint32_t vehicle_info); + bool operator()(const ApplicationSharedPtr app) const; +}; + +/** + * @brief RecallApplicationData cleans up data within application instance to + * its initial state and notifies HMI to delete same data on its side + * @param app Application to clean its data + * @param app_manager Application manager + */ +void DeleteApplicationData(ApplicationSharedPtr app, + ApplicationManager& app_manager); +} // namespace application_manager + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HELPERS_APPLICATION_HELPER_H_ diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index 939b8b86d0..f2d665d998 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -36,11 +36,13 @@ #include <list> #include "interfaces/MOBILE_API.h" #include "utils/shared_ptr.h" +#include "utils/macro.h" namespace application_manager { class HmiState; class ApplicationManager; +class Application; typedef utils::SharedPtr<HmiState> HmiStatePtr; @@ -70,7 +72,39 @@ class HmiState { STATE_ID_EMBEDDED_NAVI }; + /** + * @brief HmiState constructor + * @param app Application pointer + * @param app_mngr Application manager + */ + HmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + /** + * @brief HmiState constructor + * @param app Application pointer + * @param app_mngr Application manager + * @param state_id HMI state to assign + */ + HmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr, + StateID state_id); + + /** + * DEPRECATED + * @brief HmiState constructor + * @param app_id Application id + * @param app_mngr Application manager + */ HmiState(uint32_t app_id, const ApplicationManager& app_mngr); + + /** + * DEPRECATED + * @brief HmiState constructor + * @param app_id Application id + * @param app_mngr Application manager + * @param state_id HMI state to assign + */ HmiState(uint32_t app_id, const ApplicationManager& app_mngr, StateID state_id); @@ -166,7 +200,7 @@ class HmiState { } protected: - uint32_t app_id_; + utils::SharedPtr<Application> app_; StateID state_id_; const ApplicationManager& app_mngr_; HmiStatePtr parent_; @@ -177,26 +211,28 @@ class HmiState { protected: /** * @brief is_navi_app check if app is navi - * @param app_id application id * @return true if app is navi, otherwise return false */ - bool is_navi_app(const uint32_t app_id) const; + bool is_navi_app() const; /** * @brief is_media_app check if app is media - * @param app_id application id * @return true if media_app, otherwise return false */ - bool is_media_app(const uint32_t app_id) const; + bool is_media_app() const; /** * @brief is_voice_communicationn_app check if app is voice comunication - * @param app_id application id * @return true if voice_communicationn_app, otherwise return false */ - bool is_voice_communication_app(const uint32_t app_id) const; + bool is_voice_communication_app() const; - bool is_mobile_projection_app(const uint32_t app_id) const; + /** + * @brief is_mobile_projection_app checks if application of 'projection' + * HMI type + * @return True if application is of 'projection' HMI type, otherwise - false + */ + bool is_mobile_projection_app() const; private: void operator=(const HmiState&); @@ -209,7 +245,10 @@ class VRHmiState : public HmiState { public: virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE; - VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + VRHmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + DEPRECATED VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr); }; /** @@ -217,7 +256,11 @@ class VRHmiState : public HmiState { */ class TTSHmiState : public HmiState { public: - TTSHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + TTSHmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + DEPRECATED TTSHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE; }; @@ -228,7 +271,12 @@ class TTSHmiState : public HmiState { */ class NaviStreamingHmiState : public HmiState { public: - NaviStreamingHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + NaviStreamingHmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + DEPRECATED NaviStreamingHmiState(uint32_t app_id, + const ApplicationManager& app_mngr); + mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE; }; @@ -239,7 +287,12 @@ class NaviStreamingHmiState : public HmiState { */ class PhoneCallHmiState : public HmiState { public: - PhoneCallHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + PhoneCallHmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + DEPRECATED PhoneCallHmiState(uint32_t app_id, + const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { @@ -253,7 +306,12 @@ class PhoneCallHmiState : public HmiState { */ class SafetyModeHmiState : public HmiState { public: - SafetyModeHmiState(uint32_t app_id, const ApplicationManager& app_mngr); + SafetyModeHmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + DEPRECATED SafetyModeHmiState(uint32_t app_id, + const ApplicationManager& app_mngr); + mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { return mobile_apis::AudioStreamingState::NOT_AUDIBLE; @@ -266,7 +324,11 @@ class SafetyModeHmiState : public HmiState { */ class DeactivateHMI : public HmiState { public: - DeactivateHMI(uint32_t app_id, const ApplicationManager& app_mngr); + DeactivateHMI(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + DEPRECATED DeactivateHMI(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { @@ -280,7 +342,11 @@ class DeactivateHMI : public HmiState { */ class AudioSource : public HmiState { public: - AudioSource(uint32_t app_id, const ApplicationManager& app_mngr); + AudioSource(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + DEPRECATED AudioSource(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { @@ -295,7 +361,11 @@ class AudioSource : public HmiState { */ class EmbeddedNavi : public HmiState { public: - EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr); + EmbeddedNavi(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr); + + DEPRECATED EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr); + mobile_apis::HMILevel::eType hmi_level() const OVERRIDE; mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE { diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h index 77ef5479ee..f399da6870 100644 --- a/src/components/application_manager/include/application_manager/message.h +++ b/src/components/application_manager/include/application_manager/message.h @@ -93,7 +93,8 @@ class Message { void set_correlation_id(int32_t id); void set_connection_key(int32_t key); void set_message_type(MessageType type); - void set_binary_data(BinaryData* data); + DEPRECATED void set_binary_data(BinaryData* data); + void set_binary_data(const BinaryData* data); void set_json_message(const std::string& json_message); void set_protocol_version(protocol_handler::MajorProtocolVersion version); void set_smart_object(const smart_objects::SmartObject& object); diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h index c0a3f37c34..dc16e14023 100644 --- a/src/components/application_manager/include/application_manager/message_helper.h +++ b/src/components/application_manager/include/application_manager/message_helper.h @@ -42,7 +42,6 @@ #include "utils/macro.h" #include "connection_handler/device.h" #include "application_manager/application.h" -#include "application_manager/vehicle_info_data.h" #include "policy/policy_types.h" #include "protocol_handler/session_observer.h" #include "application_manager/policies/policy_handler_interface.h" @@ -61,7 +60,7 @@ namespace mobile_api = mobile_apis; * @param const char* Name of the parameter in mobile request * @param VehicleDataType Enum for vehicle data */ -typedef std::map<std::string, VehicleDataType> VehicleData; +typedef std::map<std::string, mobile_apis::VehicleDataType::eType> VehicleData; /** * @brief MessageHelper class @@ -702,6 +701,71 @@ class MessageHelper { int32_t connection_key, mobile_api::AppInterfaceUnregisteredReason::eType reason); + /** + * @brief SendDeleteCommandRequest sends requests to HMI to remove UI/VR + * command data depending on command parameters + * @param cmd Command data + * @param application Application owning the command data + * @param app_mngr Application manager + */ + static void SendDeleteCommandRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr); + + /** + * @brief SendDeleteSubmenuRequest sends UI/VR requests to HMI to remove + * submenues-related data depending on command parameters + * @param cmd Command data + * @param application Application owning the commmand data + * @param app_mngr Application manager + */ + static void SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr); + + /** + * @brief SendDeleteChoiceSetRequest sends requests to HMI to remove + * choice sets - related data depending on command parameters + * @param cmd Command data + * @param application Application owning command data + * @param app_mngr Application manager + */ + static void SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr); + + /** + * @brief SendResetPropertiesRequest sends requests to HMI to remove/reset + * global properties for application + * @param application Application to remove/reset global properties for + * @param app_mngr Application manager + */ + static void SendResetPropertiesRequest(ApplicationSharedPtr application, + ApplicationManager& app_mngr); + + /** + * @brief SendUnsubscribeButtonNotification sends notification to HMI to + * remove button subscription for application + * @param button Button type + * @param application Application to unsubscribe + * @param app_mngr Application manager + */ + static void SendUnsubscribeButtonNotification( + mobile_apis::ButtonName::eType button, + ApplicationSharedPtr application, + ApplicationManager& app_mngr); + + /** + * @brief SendUnsubscribeIVIRequest sends request to HMI to remove vehicle + * data subscription for application + * @param ivi_id Vehicle data item id + * @param application Application to unsubscribe + * @param app_mngr Application manager + */ + static void SendUnsubscribeIVIRequest(int32_t ivi_id, + ApplicationSharedPtr application, + ApplicationManager& app_mngr); + #ifdef SDL_REMOTE_CONTROL /** * @brief Sends HMI status notification to mobile @@ -729,11 +793,14 @@ class MessageHelper { private: /** - * @brief Creates new request object and fill its header - * @return New request object + * @brief CreateMessageForHMI Creates HMI message with prepared header + * acccoring to message type + * @param message_type Message type + * @param correlation_id Correlation id + * @return HMI message object with filled header */ - static smart_objects::SmartObjectSPtr CreateRequestObject( - const uint32_t correlation_id); + static smart_objects::SmartObjectSPtr CreateMessageForHMI( + hmi_apis::messageType::eType message_type, const uint32_t correlation_id); /** * @brief Allows to fill SO according to the current permissions. diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 9de2d6af68..ce5c0818f1 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -533,6 +533,15 @@ class PolicyHandler : public PolicyHandlerInterface, virtual void OnPTUFinished(const bool ptu_result) OVERRIDE; + /** + * @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 + */ + void OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) FINAL; + protected: /** * Starts next retry exchange policy table diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h index 26b1739a38..0ec58f2419 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h @@ -115,11 +115,25 @@ class ResumeCtrl { virtual void OnSuspend() = 0; /** + * @brief Processes resumption data after receiving signal "Ignition Off" + */ + virtual void OnIgnitionOff() = 0; + + /** * @brief Processes resumption data after receiving signal "Awake" */ virtual void OnAwake() = 0; /** + * @brief Checks if SDL has already received OnExitAllApplication notification + * with "SUSPEND" reason + * + * @return Returns TRUE if SDL has received OnExitAllApplication notification + * with reason "SUSPEND" otherwise returns FALSE + */ + virtual bool is_suspended() const = 0; + + /** * @brief Method stops timer "RsmCtrlPercist" when SDL * receives OnExitAllApplication notification * with reason "SUSPEND" diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h index bb886cd5f6..d7ff621c95 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h @@ -129,11 +129,25 @@ class ResumeCtrlImpl : public ResumeCtrl, void OnSuspend() OVERRIDE; /** + * @brief Processes resumption data after receiving signal "Ignition Off" + */ + void OnIgnitionOff() OVERRIDE; + + /** * @brief Processes resumption data after receiving signal "Awake" */ void OnAwake() OVERRIDE; /** + * @brief Checks if SDL has already received OnExitAllApplication notification + * with "SUSPEND" reason + * + * @return Returns TRUE if SDL has received OnExitAllApplication notification + * with reason "SUSPEND" otherwise returns FALSE + */ + bool is_suspended() const OVERRIDE; + + /** * @brief Method stops timer "RsmCtrlPercist" when SDL * receives OnExitAllApplication notification * with reason "SUSPEND" @@ -301,6 +315,12 @@ class ResumeCtrlImpl : public ResumeCtrl, void SaveDataOnTimer(); /** + * @brief FinalPersistData persists ResumptionData last time and stops + * persistent data timer to avoid further persisting + */ + void FinalPersistData(); + + /** * @brief AddFiles allows to add files for the application * which should be resumed * @param application application which will be resumed @@ -491,6 +511,7 @@ class ResumeCtrlImpl : public ResumeCtrl, WaitingForTimerList waiting_for_timer_; bool is_resumption_active_; bool is_data_saved_; + bool is_suspended_; time_t launch_time_; utils::SharedPtr<ResumptionData> resumption_storage_; application_manager::ApplicationManager& application_manager_; diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h index aeb65b32b9..bee2bce570 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h @@ -36,6 +36,7 @@ #include "smart_objects/smart_object.h" #include "application_manager/application.h" #include "application_manager/application_manager.h" +#include "utils/macro.h" namespace application_manager { class ApplicationManagerSettings; @@ -91,7 +92,23 @@ class ResumptionData { * @brief Increments ignition counter for all registered applications * and remember ign_off time stamp */ - virtual void OnSuspend() = 0; + virtual void IncrementIgnOffCount() = 0; + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + DEPRECATED virtual void OnSuspend() = 0; + + /** + * @brief Decrements ignition counter for all registered applications + */ + virtual void DecrementIgnOffCount() = 0; + + /** + * @brief Decrements ignition counter for all registered applications + */ + DEPRECATED virtual void OnAwake() = 0; /** * @brief Retrieves hash ID for the given mobile app ID @@ -108,12 +125,6 @@ class ResumptionData { std::string& hash_id) const = 0; /** - * @brief Increments ignition counter for all registered applications - * and remember ign_off time stamp - */ - virtual void OnAwake() = 0; - - /** * @brief Retrieves data of saved application for the given mobile app ID * and device ID * @param policy_app_id - mobile application id diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h index 862816bf87..a8032d1f65 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h @@ -55,6 +55,7 @@ struct ApplicationParams { mobile_apis::HMILevel::eType m_hmi_level; bool m_is_media_application; bool m_is_valid; + app_mngr::ApplicationSharedPtr app_ptr; }; /** @@ -113,7 +114,23 @@ class ResumptionDataDB : public ResumptionData { * @brief Increments ignition counter for all registered applications * and remember ign_off time stamp */ - virtual void OnSuspend(); + DEPRECATED void OnSuspend() FINAL; + + /** + * @brief Decrements ignition counter for all registered applications + */ + DEPRECATED void OnAwake() FINAL; + + /** + * @brief Increments ignition counter for all registered applications + * and remember ign_off time stamp + */ + void IncrementIgnOffCount() FINAL; + + /** + * @brief Decrements ignition counter for all registered applications + */ + void DecrementIgnOffCount() FINAL; /** * @brief Retrieves hash ID for the given mobile app ID @@ -130,12 +147,6 @@ class ResumptionDataDB : public ResumptionData { std::string& hash_id) const; /** - * @brief Decrements ignition counter for all registered applications - * and remember ign_off time stamp - */ - virtual void OnAwake(); - - /** * @brief Retrieves data of saved application for the given mobile app ID * and device ID * @param policy_app_id - mobile application id diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h index 0be6d64db2..82ec1d9e5c 100644 --- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h +++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h @@ -85,13 +85,23 @@ class ResumptionDataJson : public ResumptionData { * @brief Increments ignition counter for all registered applications * and remember ign_off time stamp */ - virtual void OnSuspend(); + DEPRECATED void OnSuspend() FINAL; + + /** + * @brief Decrements ignition counter for all registered applications + */ + DEPRECATED void OnAwake() FINAL; /** * @brief Increments ignition counter for all registered applications * and remember ign_off time stamp */ - virtual void OnAwake(); + void IncrementIgnOffCount() FINAL; + + /** + * @brief Decrements ignition counter for all registered applications + */ + void DecrementIgnOffCount() FINAL; /** * @brief Retrieves hash ID for the given mobile app ID diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h index f2f9fb39a4..1b2033f5a8 100644 --- a/src/components/application_manager/include/application_manager/state_controller_impl.h +++ b/src/components/application_manager/include/application_manager/state_controller_impl.h @@ -289,7 +289,7 @@ class StateControllerImpl : public event_engine::EventObserver, void HMIStateStarted(ApplicationSharedPtr app) { DCHECK_OR_RETURN_VOID(app); HmiStatePtr old_hmi_state = app->CurrentHmiState(); - HmiStatePtr new_hmi_state = CreateHmiState(app->app_id(), ID); + HmiStatePtr new_hmi_state = CreateHmiState(app, ID); DCHECK_OR_RETURN_VOID(new_hmi_state); DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() != HmiState::STATE_ID_REGULAR); @@ -326,7 +326,7 @@ class StateControllerImpl : public event_engine::EventObserver, DCHECK_OR_RETURN_VOID(app); HmiStatePtr cur = app->CurrentHmiState(); HmiStatePtr old_hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(old_hmi_state); old_hmi_state->set_hmi_level(cur->hmi_level()); old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state()); @@ -431,7 +431,8 @@ class StateControllerImpl : public event_engine::EventObserver, * @param state_id state id * @return */ - HmiStatePtr CreateHmiState(uint32_t app_id, HmiState::StateID state_id) const; + HmiStatePtr CreateHmiState(utils::SharedPtr<Application> app, + HmiState::StateID state_id) const; mobile_apis::AudioStreamingState::eType CalcAudioState( ApplicationSharedPtr app, diff --git a/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc b/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc index 950bcd44fa..cc4765e6c9 100644 --- a/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc +++ b/src/components/application_manager/src/app_launch/app_launch_sql_queries.cc @@ -36,7 +36,7 @@ namespace app_launch { const std::string kCreateSchema = "CREATE TABLE IF NOT EXISTS `app_launch`( " " `deviceMac` TEXT, " - " `appID` TEXT," + " `appID` TEXT collate nocase," " `bundleID` TEXT," " `last_session` DATETIME, " " PRIMARY KEY(`deviceMac`, `appID`, `bundleID`)" diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 4a752febf8..115a52eef3 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -41,9 +41,11 @@ #include "utils/file_system.h" #include "utils/logger.h" #include "utils/gen_hash.h" +#include "utils/shared_ptr.h" #include "utils/make_shared.h" #include "utils/timer_task_impl.h" #include "application_manager/policies/policy_handler_interface.h" +#include "application_manager/resumption/resume_ctrl.h" namespace { @@ -75,10 +77,23 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") namespace application_manager { +void SwitchApplicationParameters(ApplicationSharedPtr app, + const uint32_t app_id, + const size_t device_id, + const std::string& mac_address) { + utils::SharedPtr<ApplicationImpl> application = + ApplicationSharedPtr::dynamic_pointer_cast<ApplicationImpl>(app); + DCHECK_OR_RETURN_VOID(application); + application->app_id_ = app_id; + application->device_id_ = device_id; + application->mac_address_ = mac_address; +} + ApplicationImpl::ApplicationImpl( uint32_t application_id, const std::string& mobile_app_id, const std::string& mac_address, + const connection_handler::DeviceHandle device_id, const custom_str::CustomString& app_name, utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, ApplicationManager& application_manager) @@ -104,13 +119,14 @@ ApplicationImpl::ApplicationImpl( , put_file_in_none_count_(0) , delete_file_in_none_count_(0) , list_files_in_none_count_(0) - , device_(0) , mac_address_(mac_address) + , device_id_(device_id) , usage_report_(mobile_app_id, statistics_manager) , protocol_version_( protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3) , is_voice_communication_application_(false) , is_resuming_(false) + , is_hash_changed_during_suspend_(false) , video_stream_retry_number_(0) , audio_stream_retry_number_(0) , video_stream_suspend_timer_( @@ -135,12 +151,6 @@ ApplicationImpl::ApplicationImpl( SubscribeToButton(mobile_apis::ButtonName::CUSTOM_BUTTON); // load persistent files LoadPersistentFiles(); - HmiStatePtr initial_state = application_manager_.CreateRegularState( - app_id(), - mobile_apis::HMILevel::INVALID_ENUM, - mobile_apis::AudioStreamingState::INVALID_ENUM, - mobile_api::SystemContext::SYSCTXT_MAIN); - state_.InitState(initial_state); video_stream_suspend_timeout_ = application_manager_.get_settings().video_data_stopped_timeout(); @@ -345,7 +355,7 @@ const std::string& ApplicationImpl::bundle_id() const { } connection_handler::DeviceHandle ApplicationImpl::device() const { - return device_; + return device_id_; } const std::string& ApplicationImpl::mac_address() const { @@ -605,7 +615,7 @@ void ApplicationImpl::set_app_allowed(const bool allowed) { } void ApplicationImpl::set_device(connection_handler::DeviceHandle device) { - device_ = device; + device_id_ = device; } uint32_t ApplicationImpl::get_grammar_id() const { @@ -720,19 +730,23 @@ bool ApplicationImpl::UnsubscribeFromButton( bool ApplicationImpl::SubscribeToIVI(uint32_t vehicle_info_type) { sync_primitives::AutoLock lock(vi_lock_); - return subscribed_vehicle_info_.insert(vehicle_info_type).second; + return subscribed_vehicle_info_ + .insert( + static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type)) + .second; } bool ApplicationImpl::IsSubscribedToIVI(uint32_t vehicle_info_type) const { sync_primitives::AutoLock lock(vi_lock_); - VehicleInfoSubscriptions::const_iterator it = - subscribed_vehicle_info_.find(vehicle_info_type); + VehicleInfoSubscriptions::const_iterator it = subscribed_vehicle_info_.find( + static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type)); return (subscribed_vehicle_info_.end() != it); } bool ApplicationImpl::UnsubscribeFromIVI(uint32_t vehicle_info_type) { sync_primitives::AutoLock lock(vi_lock_); - return subscribed_vehicle_info_.erase(vehicle_info_type); + return subscribed_vehicle_info_.erase( + static_cast<mobile_apis::VehicleDataType::eType>(vehicle_info_type)); } UsageStatistics& ApplicationImpl::usage_report() { @@ -857,6 +871,10 @@ bool ApplicationImpl::is_application_data_changed() const { return is_application_data_changed_; } +void ApplicationImpl::SetInitialState(HmiStatePtr state) { + state_.InitState(state); +} + void ApplicationImpl::set_is_application_data_changed( bool state_application_data) { is_application_data_changed_ = state_application_data; @@ -868,7 +886,19 @@ void ApplicationImpl::UpdateHash() { utils::gen_hash(application_manager_.get_settings().hash_string_size()); set_is_application_data_changed(true); - MessageHelper::SendHashUpdateNotification(app_id(), application_manager_); + if (!application_manager_.resume_controller().is_suspended()) { + MessageHelper::SendHashUpdateNotification(app_id(), application_manager_); + } else { + is_hash_changed_during_suspend_ = true; + } +} + +bool ApplicationImpl::IsHashChangedDuringSuspend() const { + return is_hash_changed_during_suspend_; +} + +void ApplicationImpl::SetHashChangedDuringSuspend(const bool state) { + is_hash_changed_during_suspend_ = state; } void ApplicationImpl::CleanupFiles() { @@ -1045,7 +1075,7 @@ void ApplicationImpl::set_hmi_level( usage_report_.RecordHmiStateChanged(new_hmi_level); } -const std::set<uint32_t>& ApplicationImpl::SubscribesIVI() const { +const VehicleInfoSubscriptions& ApplicationImpl::SubscribesIVI() const { return subscribed_vehicle_info_; } diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 9814b4cff8..4e13da694b 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -50,8 +50,10 @@ #include "application_manager/app_launch/app_launch_ctrl_impl.h" #include "application_manager/app_launch/app_launch_data_db.h" #include "application_manager/app_launch/app_launch_data_json.h" +#include "application_manager/helpers/application_helper.h" #include "protocol_handler/protocol_handler.h" #include "hmi_message_handler/hmi_message_handler.h" +#include "application_manager/command_holder_impl.h" #include "connection_handler/connection_handler_impl.h" #include "formatters/formatter_json_rpc.h" #include "formatters/CFormatterJsonSDLRPCv2.h" @@ -93,9 +95,40 @@ DeviceTypes devicesType = { hmi_apis::Common_TransportType::USB_IOS), std::make_pair(std::string("BLUETOOTH"), hmi_apis::Common_TransportType::BLUETOOTH), + std::make_pair(std::string("BLUETOOTH_IOS"), + hmi_apis::Common_TransportType::BLUETOOTH), std::make_pair(std::string("WIFI"), hmi_apis::Common_TransportType::WIFI)}; } +/** + * @brief device_id_comparator is predicate to compare application device id + * @param device_id Device id to compare with + * @param app Application pointer + * @return True if device id of application matches to device id passed + */ +bool device_id_comparator(const std::string& device_id, + ApplicationSharedPtr app) { + DCHECK_OR_RETURN(app, false); + LOG4CXX_DEBUG(logger_, + "Data to compare: device_id : " << device_id << " app mac: " + << app->mac_address()); + + return device_id == app->mac_address(); +} + +/** + * @brief policy_app_id_comparator is predicate to compare policy application + * ids + * @param policy_app_id Policy id of application + * @param app Application pointer + * @return True if policy id of application matches to policy id passed + */ +bool policy_app_id_comparator(const std::string& policy_app_id, + ApplicationSharedPtr app) { + DCHECK_OR_RETURN(app, false); + return app->policy_app_id() == policy_app_id; +} + uint32_t ApplicationManagerImpl::corelation_id_ = 0; const uint32_t ApplicationManagerImpl::max_corelation_id_ = UINT_MAX; @@ -164,6 +197,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( const uint32_t timeout_ms = 10000u; clearing_timer->Start(timeout_ms, timer::kSingleShot); timer_pool_.push_back(clearing_timer); + commands_holder_.reset(new CommandHolderImpl(*this)); } ApplicationManagerImpl::~ApplicationManagerImpl() { @@ -193,33 +227,6 @@ ApplicationManagerImpl::~ApplicationManagerImpl() { navi_app_to_end_stream_.clear(); } -template <class UnaryPredicate> -ApplicationSharedPtr FindApp(DataAccessor<ApplicationSet> accessor, - UnaryPredicate finder) { - ApplicationSet::iterator it = std::find_if( - accessor.GetData().begin(), accessor.GetData().end(), finder); - if (accessor.GetData().end() == it) { - LOG4CXX_DEBUG(logger_, "Unable to find application"); - return ApplicationSharedPtr(); - } - ApplicationSharedPtr app = *it; - LOG4CXX_DEBUG(logger_, " Found Application app_id = " << app->app_id()); - return app; -} - -template <class UnaryPredicate> -std::vector<ApplicationSharedPtr> FindAllApps( - DataAccessor<ApplicationSet> accessor, UnaryPredicate finder) { - std::vector<ApplicationSharedPtr> result; - ApplicationSetConstIt it = std::find_if( - accessor.GetData().begin(), accessor.GetData().end(), finder); - while (it != accessor.GetData().end()) { - result.push_back(*it); - it = std::find_if(++it, accessor.GetData().end(), finder); - } - return result; -} - DataAccessor<ApplicationSet> ApplicationManagerImpl::applications() const { DataAccessor<ApplicationSet> accessor(applications_, applications_list_lock_); return accessor; @@ -330,15 +337,6 @@ ApplicationManagerImpl::applications_by_button(uint32_t button) { return FindAllApps(accessor, finder); } -struct SubscribedToIVIPredicate { - int32_t vehicle_info_; - SubscribedToIVIPredicate(int32_t vehicle_info) - : vehicle_info_(vehicle_info) {} - bool operator()(const ApplicationSharedPtr app) const { - return app ? app->IsSubscribedToIVI(vehicle_info_) : false; - } -}; - struct IsApplication { IsApplication(connection_handler::DeviceHandle device_handle, const std::string& policy_app_id) @@ -354,18 +352,18 @@ struct IsApplication { }; std::vector<ApplicationSharedPtr> ApplicationManagerImpl::IviInfoUpdated( - VehicleDataType vehicle_info, int value) { + mobile_apis::VehicleDataType::eType vehicle_info, int value) { // Notify Policy Manager if available about info it's interested in, // i.e. odometer etc switch (vehicle_info) { - case ODOMETER: + case mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER: GetPolicyHandler().KmsChanged(value); break; default: break; } - SubscribedToIVIPredicate finder(static_cast<int32_t>(vehicle_info)); + SubscribedToIVIPredicate finder(vehicle_info); DataAccessor<ApplicationSet> accessor = applications(); return FindAllApps(accessor, finder); } @@ -393,6 +391,12 @@ void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) { event.raise(event_dispatcher()); } +void ApplicationManagerImpl::OnApplicationSwitched(ApplicationSharedPtr app) { + LOG4CXX_AUTO_TRACE(logger_); + commands_holder_->Resume(app, CommandHolder::CommandType::kMobileCommand); + commands_holder_->Resume(app, CommandHolder::CommandType::kHmiCommand); +} + bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( ApplicationConstSharedPtr app) const { bool voice_state = app->is_voice_communication_supported(); @@ -472,10 +476,10 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( // original app_id can be received via ApplicationImpl::mobile_app_id() uint32_t app_id = 0; std::list<int32_t> sessions_list; - uint32_t device_id = 0; + connection_handler::DeviceHandle device_id = 0; DCHECK_OR_RETURN(connection_handler_, ApplicationSharedPtr()); - if (connection_handler().GetDataOnSessionKey( + if (connection_handler().get_session_observer().GetDataOnSessionKey( connection_key, &app_id, &sessions_list, &device_id) == -1) { LOG4CXX_ERROR(logger_, "Failed to create application: no connection info."); utils::SharedPtr<smart_objects::SmartObject> response( @@ -488,6 +492,20 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( return ApplicationSharedPtr(); } + smart_objects::SmartObject& params = message[strings::msg_params]; + const std::string& policy_app_id = params[strings::app_id].asString(); + const custom_str::CustomString& app_name = + message[strings::msg_params][strings::app_name].asCustomString(); + std::string device_mac; + std::string connection_type; + if (connection_handler().get_session_observer().GetDataOnDeviceID( + device_id, NULL, NULL, &device_mac, &connection_type) == -1) { + LOG4CXX_DEBUG(logger_, "Failed to extract device mac for id " << device_id); + } else { + LOG4CXX_DEBUG(logger_, + "Device mac for id" << device_id << " is " << device_mac); + } + LOG4CXX_DEBUG(logger_, "Restarting application list update timer"); GetPolicyHandler().OnAppsSearchStarted(); uint32_t timeout = get_settings().application_list_update_timeout(); @@ -506,22 +524,11 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( return ApplicationSharedPtr(); } - smart_objects::SmartObject& params = message[strings::msg_params]; - const std::string& policy_app_id = params[strings::app_id].asString(); - const custom_str::CustomString& app_name = - message[strings::msg_params][strings::app_name].asCustomString(); - std::string device_mac = ""; - if (connection_handler().get_session_observer().GetDataOnDeviceID( - device_id, NULL, NULL, &device_mac, NULL) == -1) { - LOG4CXX_ERROR(logger_, "Failed to extract device mac for id " << device_id); - } else { - LOG4CXX_DEBUG(logger_, - "Device mac for id" << device_id << " is " << device_mac); - } ApplicationSharedPtr application( new ApplicationImpl(app_id, policy_app_id, device_mac, + device_id, app_name, GetPolicyHandler().GetStatisticManager(), *this)); @@ -536,12 +543,19 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( return ApplicationSharedPtr(); } + HmiStatePtr initial_state = + CreateRegularState(utils::SharedPtr<Application>(application), + mobile_apis::HMILevel::INVALID_ENUM, + mobile_apis::AudioStreamingState::INVALID_ENUM, + mobile_api::SystemContext::SYSCTXT_MAIN); + + application->SetInitialState(initial_state); + application->set_folder_name(policy_app_id + "_" + application->mac_address()); // To load persistent files, app folder name must be known first, which is now // depends on device_id and mobile_app_id application->LoadPersistentFiles(); - application->set_device(device_id); application->set_grammar_id(GenerateGrammarID()); mobile_api::Language::eType launguage_desired = @@ -624,11 +638,13 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( return application; } -bool ApplicationManagerImpl::RemoveAppDataFromHMI(ApplicationSharedPtr app) { +DEPRECATED bool ApplicationManagerImpl::RemoveAppDataFromHMI( + ApplicationSharedPtr app) { return true; } -bool ApplicationManagerImpl::LoadAppDataToHMI(ApplicationSharedPtr app) { +DEPRECATED bool ApplicationManagerImpl::LoadAppDataToHMI( + ApplicationSharedPtr app) { return true; } @@ -779,7 +795,8 @@ void ApplicationManagerImpl::set_driver_distraction(const bool is_distracting) { is_distracting_driver_ = is_distracting; } -void ApplicationManagerImpl::set_vr_session_started(const bool state) { +DEPRECATED void ApplicationManagerImpl::set_vr_session_started( + const bool state) { is_vr_session_strated_ = state; } @@ -788,6 +805,18 @@ void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) { } HmiStatePtr ApplicationManagerImpl::CreateRegularState( + utils::SharedPtr<Application> app, + mobile_apis::HMILevel::eType hmi_level, + mobile_apis::AudioStreamingState::eType audio_state, + mobile_apis::SystemContext::eType system_context) const { + HmiStatePtr state(new HmiState(app, *this)); + state->set_hmi_level(hmi_level); + state->set_audio_streaming_state(audio_state); + state->set_system_context(system_context); + return state; +} + +HmiStatePtr ApplicationManagerImpl::CreateRegularState( uint32_t app_id, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, @@ -1044,6 +1073,105 @@ void ApplicationManagerImpl::RemoveDevice( LOG4CXX_DEBUG(logger_, "device_handle " << device_handle); } +void ApplicationManagerImpl::OnDeviceSwitchingStart( + const connection_handler::Device& device_from, + const connection_handler::Device& device_to) { + LOG4CXX_AUTO_TRACE(logger_); + { + auto apps_data_accessor = applications(); + + std::copy_if(apps_data_accessor.GetData().begin(), + apps_data_accessor.GetData().end(), + std::back_inserter(reregister_wait_list_), + std::bind1st(std::ptr_fun(&device_id_comparator), + device_from.mac_address())); + } + + { + // During sending of UpdateDeviceList this lock is acquired also so making + // it scoped + sync_primitives::AutoLock lock(reregister_wait_list_lock_); + for (auto i = reregister_wait_list_.begin(); + reregister_wait_list_.end() != i; + ++i) { + auto app = *i; + request_ctrl_.terminateAppRequests(app->app_id()); + resume_ctrl_->SaveApplication(app); + } + } + + policy_handler_->OnDeviceSwitching(device_from.mac_address(), + device_to.mac_address()); + + connection_handler::DeviceMap device_list; + device_list.insert(std::make_pair(device_to.device_handle(), device_to)); + + smart_objects::SmartObjectSPtr msg_params = + MessageHelper::CreateDeviceListSO(device_list, GetPolicyHandler(), *this); + if (!msg_params) { + LOG4CXX_ERROR(logger_, "Can't create UpdateDeviceList notification"); + return; + } + + auto update_list = utils::MakeShared<smart_objects::SmartObject>(); + smart_objects::SmartObject& so_to_send = *update_list; + so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = + hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList; + so_to_send[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE] = + hmi_apis::messageType::request; + so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = 2; + so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = 1; + so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID(); + so_to_send[jhs::S_MSG_PARAMS] = *msg_params; + ManageHMICommand(update_list); +} + +void ApplicationManagerImpl::OnDeviceSwitchingFinish( + const std::string& device_uid) { + LOG4CXX_AUTO_TRACE(logger_); + UNUSED(device_uid); + sync_primitives::AutoLock lock(reregister_wait_list_lock_); + + const bool unexpected_disonnect = true; + const bool is_resuming = true; + for (auto app_it = reregister_wait_list_.begin(); + app_it != reregister_wait_list_.end(); + ++app_it) { + auto app = *app_it; + UnregisterApplication(app->app_id(), + mobile_apis::Result::INVALID_ENUM, + is_resuming, + unexpected_disonnect); + } + reregister_wait_list_.clear(); +} + +void ApplicationManagerImpl::SwitchApplication(ApplicationSharedPtr app, + const uint32_t connection_key, + const size_t device_id, + const std::string& mac_address) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(app); + sync_primitives::AutoLock lock(applications_list_lock_); + DCHECK_OR_RETURN_VOID(1 == applications_.erase(app)); + + LOG4CXX_DEBUG(logger_, + "Changing app id to " << connection_key + << ". Changing device id to " + << device_id); + + SwitchApplicationParameters(app, connection_key, device_id, mac_address); + + // Normally this is done during registration, however since switched apps are + // not being registered again need to set protocol version on session. + connection_handler().BindProtocolVersionWithSession( + connection_key, static_cast<uint8_t>(app->protocol_version())); + + // Application need to be re-inserted in order to keep sorting in applications + // container. Otherwise data loss on erasing is possible. + applications_.insert(app); +} + mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel( ApplicationConstSharedPtr application) const { using namespace mobile_apis; @@ -1166,7 +1294,6 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId( } } -// DEPRECATED bool ApplicationManagerImpl::StartNaviService( uint32_t app_id, protocol_handler::ServiceType service_type) { using namespace protocol_handler; @@ -1338,7 +1465,9 @@ void ApplicationManagerImpl::StopNaviService( app->StopStreaming(service_type); } -// DEPRECATED +// Suppress warning for deprecated method used within another deprecated method +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" bool ApplicationManagerImpl::OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, const int32_t& session_key, @@ -1374,6 +1503,7 @@ bool ApplicationManagerImpl::OnServiceStartedCallback( } return false; } +#pragma GCC diagnostic pop void ApplicationManagerImpl::OnServiceStartedCallback( const connection_handler::DeviceHandle& device_handle, @@ -1432,6 +1562,17 @@ void ApplicationManagerImpl::OnServiceEndedCallback( << type << " with reason " << close_reason << " in session 0x" << std::hex << session_key); + auto app = application(static_cast<uint32_t>(session_key)); + if (!app) { + return; + } + + if (IsAppInReconnectMode(app->policy_app_id())) { + LOG4CXX_DEBUG(logger_, + "Application is in reconnection list and won't be closed."); + return; + } + if (type == kRpc) { LOG4CXX_INFO(logger_, "Remove application."); /* In case it was unexpected disconnect or some special case @@ -1514,6 +1655,12 @@ void ApplicationManagerImpl::OnCertificateUpdateRequired() { GetPolicyHandler().OnPTExchangeNeeded(); } +bool ApplicationManagerImpl::GetPolicyCertificateData(std::string& data) const { + LOG4CXX_AUTO_TRACE(logger_); + data = GetPolicyHandler().RetrieveCertificate(); + return true; +} + security_manager::SSLContext::HandshakeContext ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const { LOG4CXX_AUTO_TRACE(logger_); @@ -1525,6 +1672,15 @@ ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const { } return SSLContext::HandshakeContext(); } + +bool ApplicationManagerImpl::CheckAppIsNavi(const uint32_t app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + ApplicationSharedPtr app = application(app_id); + if (app) { + return app->is_navi(); + } + return false; +} #endif // ENABLE_SECURITY void ApplicationManagerImpl::set_hmi_message_handler( @@ -1718,6 +1874,16 @@ bool ApplicationManagerImpl::ManageMobileCommand( return false; } + const uint32_t connection_key = static_cast<uint32_t>( + (*message)[strings::params][strings::connection_key].asUInt()); + + auto app_ptr = application(connection_key); + if (app_ptr && IsAppInReconnectMode(app_ptr->policy_app_id())) { + commands_holder_->Suspend( + app_ptr, CommandHolder::CommandType::kMobileCommand, message); + return true; + } + mobile_apis::FunctionID::eType function_id = static_cast<mobile_apis::FunctionID::eType>( (*message)[strings::params][strings::function_id].asInt()); @@ -1728,9 +1894,6 @@ bool ApplicationManagerImpl::ManageMobileCommand( ? (*message)[strings::params][strings::correlation_id].asUInt() : 0; - uint32_t connection_key = - (*message)[strings::params][strings::connection_key].asUInt(); - int32_t protocol_type = (*message)[strings::params][strings::protocol_type].asUInt(); @@ -1947,8 +2110,21 @@ bool ApplicationManagerImpl::ManageHMICommand( return false; } + if ((*message).keyExists(strings::msg_params) && + (*message)[strings::msg_params].keyExists(strings::app_id)) { + const auto connection_key = + (*message)[strings::msg_params][strings::app_id].asUInt(); + + auto app = application(static_cast<uint32_t>(connection_key)); + if (app && IsAppInReconnectMode(app->policy_app_id())) { + commands_holder_->Suspend( + app, CommandHolder::CommandType::kHmiCommand, message); + return true; + } + } + int32_t message_type = - (*(message.get()))[strings::params][strings::message_type].asInt(); + (*message)[strings::params][strings::message_type].asInt(); if (kRequest == message_type) { LOG4CXX_DEBUG(logger_, "ManageHMICommand"); @@ -1959,9 +2135,9 @@ bool ApplicationManagerImpl::ManageHMICommand( command->Run(); if (kResponse == message_type) { const uint32_t correlation_id = - (*(message.get()))[strings::params][strings::correlation_id].asUInt(); + (*message)[strings::params][strings::correlation_id].asUInt(); const int32_t function_id = - (*(message.get()))[strings::params][strings::function_id].asInt(); + (*message)[strings::params][strings::function_id].asInt(); request_ctrl_.OnHMIResponse(correlation_id, function_id); } return true; @@ -2083,9 +2259,12 @@ bool ApplicationManagerImpl::ConvertMessageToSO( message.function_id(), message.type(), message.correlation_id()); + + rpc::ValidationReport report("RPC"); + if (!conversion_result || !mobile_so_factory().attachSchema(output, true) || - ((output.validate() != smart_objects::Errors::OK))) { + ((output.validate(&report) != smart_objects::Errors::OK))) { LOG4CXX_WARN(logger_, "Failed to parse string to smart object :" << message.json_message()); @@ -2095,6 +2274,9 @@ bool ApplicationManagerImpl::ConvertMessageToSO( message.function_id(), message.correlation_id(), mobile_apis::Result::INVALID_DATA)); + + (*response)[strings::msg_params][strings::info] = + rpc::PrettyFormat(report); ManageMobileCommand(response, commands::Command::ORIGIN_SDL); return false; } @@ -2142,8 +2324,18 @@ bool ApplicationManagerImpl::ConvertMessageToSO( LOG4CXX_WARN(logger_, "Failed to attach schema to object."); return false; } - if (output.validate() != smart_objects::Errors::OK) { - LOG4CXX_ERROR(logger_, "Incorrect parameter from HMI"); + + rpc::ValidationReport report("RPC"); + + if (output.validate(&report) != smart_objects::Errors::OK) { + LOG4CXX_ERROR(logger_, + "Incorrect parameter from HMI" + << rpc::PrettyFormat(report)); + + output.erase(strings::msg_params); + output[strings::params][hmi_response::code] = + hmi_apis::Common_Result::INVALID_DATA; + output[strings::msg_params][strings::info] = rpc::PrettyFormat(report); return false; } break; @@ -2283,7 +2475,7 @@ bool ApplicationManagerImpl::ConvertSOtoMessage( } if (message.getElement(jhs::S_PARAMS).keyExists(strings::binary_data)) { - application_manager::BinaryData binaryData( + const application_manager::BinaryData binaryData( message.getElement(jhs::S_PARAMS) .getElement(strings::binary_data) .asBinary()); @@ -2319,8 +2511,11 @@ MessageValidationResult ApplicationManagerImpl::ValidateMessageBySchema( if (!mobile_so_factory().attachSchema(so, true)) { return INVALID_METADATA; } - - if (so.validate() != smart_objects::Errors::OK) { + rpc::ValidationReport report("RPC"); + if (so.validate(&report) != smart_objects::Errors::OK) { + LOG4CXX_WARN(logger_, + "validate() failed for Mobile message - " + << rpc::PrettyFormat(report)); return SCHEMA_MISMATCH; } break; @@ -2339,7 +2534,11 @@ MessageValidationResult ApplicationManagerImpl::ValidateMessageBySchema( return INVALID_METADATA; } - if (so.validate() != smart_objects::Errors::OK) { + rpc::ValidationReport report("RPC"); + if (so.validate(&report) != smart_objects::Errors::OK) { + LOG4CXX_WARN(logger_, + "validate() failed for HMI message - " + << rpc::PrettyFormat(report)); return SCHEMA_MISMATCH; } break; @@ -2587,10 +2786,10 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, const std::string app_icon_dir(settings_.app_icons_folder()); const std::string full_icon_path(app_icon_dir + "/" + policy_app_id); - uint32_t device_id = 0; + connection_handler::DeviceHandle device_id = 0; if (-1 == - connection_handler().GetDataOnSessionKey( + connection_handler().get_session_observer().GetDataOnSessionKey( connection_key, NULL, NULL, &device_id)) { LOG4CXX_ERROR(logger_, "Failed to create application: no connection info."); @@ -2612,6 +2811,7 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, new ApplicationImpl(0, policy_app_id, device_mac, + device_id, appName, GetPolicyHandler().GetStatisticManager(), *this)); @@ -2620,7 +2820,6 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array, app->SetPackageName(package_name); app->set_app_icon_path(full_icon_path); app->set_hmi_application_id(hmi_app_id); - app->set_device(device_id); app->set_vr_synonyms(vrSynonym); app->set_tts_name(ttsName); @@ -2883,7 +3082,7 @@ void ApplicationManagerImpl::UnregisterAllApplications() { } } if (is_ignition_off) { - resume_controller().OnSuspend(); + resume_controller().OnIgnitionOff(); } request_ctrl_.terminateAllHMIRequests(); } @@ -2975,13 +3174,14 @@ void ApplicationManagerImpl::UnregisterApplication( ApplicationSharedPtr app_to_remove; connection_handler::DeviceHandle handle = 0; { - DataAccessor<ApplicationSet> accessor(applications()); - ApplicationSetConstIt it = accessor.GetData().begin(); - for (; it != accessor.GetData().end(); ++it) { - if ((*it)->app_id() == app_id) { - app_to_remove = *it; - handle = app_to_remove->device(); - break; + sync_primitives::AutoLock lock(applications_list_lock_); + auto it_app = applications_.begin(); + while (applications_.end() != it_app) { + if (app_id == (*it_app)->app_id()) { + app_to_remove = *it_app; + applications_.erase(it_app++); + } else { + ++it_app; } } if (!app_to_remove) { @@ -2999,11 +3199,10 @@ void ApplicationManagerImpl::UnregisterApplication( } else { resume_controller().RemoveApplicationFromSaved(app_to_remove); } - applications_.erase(app_to_remove); (hmi_capabilities_->get_hmi_language_handler()) .OnUnregisterApplication(app_id); AppV4DevicePredicate finder(handle); - ApplicationSharedPtr app = FindApp(accessor, finder); + ApplicationSharedPtr app = FindApp(applications(), finder); if (!app) { LOG4CXX_DEBUG( logger_, "There is no more SDL4 apps with device handle: " << handle); @@ -3012,6 +3211,9 @@ void ApplicationManagerImpl::UnregisterApplication( SendUpdateAppList(); } } + + commands_holder_->Clear(app_to_remove); + if (audio_pass_thru_active_) { // May be better to put this code in MessageHelper? EndAudioPassThrough(); @@ -3234,8 +3436,9 @@ bool ApplicationManagerImpl::IsLowVoltage() { std::string ApplicationManagerImpl::GetHashedAppID( uint32_t connection_key, const std::string& mobile_app_id) const { - uint32_t device_id = 0; - connection_handler().GetDataOnSessionKey(connection_key, 0, NULL, &device_id); + connection_handler::DeviceHandle device_id = 0; + connection_handler().get_session_observer().GetDataOnSessionKey( + connection_key, 0, NULL, &device_id); std::string device_name; connection_handler().get_session_observer().GetDataOnDeviceID( device_id, &device_name, NULL, NULL, NULL); @@ -3596,6 +3799,17 @@ bool ApplicationManagerImpl::IsApplicationForbidden( return forbidden_applications.find(name) != forbidden_applications.end(); } +bool ApplicationManagerImpl::IsAppInReconnectMode( + const std::string& policy_app_id) const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(reregister_wait_list_lock_); + return reregister_wait_list_.end() != + std::find_if(reregister_wait_list_.begin(), + reregister_wait_list_.end(), + std::bind1st(std::ptr_fun(&policy_app_id_comparator), + policy_app_id)); +} + policy::DeviceConsent ApplicationManagerImpl::GetUserConsentForDevice( const std::string& device_id) const { return GetPolicyHandler().GetUserConsentForDevice(device_id); @@ -3879,6 +4093,48 @@ void ApplicationManagerImpl::OnUpdateHMIAppType( } } +void ApplicationManagerImpl::EraseAppFromReconnectionList( + const ApplicationSharedPtr& app) { + LOG4CXX_AUTO_TRACE(logger_); + if (!app) { + LOG4CXX_WARN(logger_, "Application is not valid."); + return; + } + + const auto policy_app_id = app->policy_app_id(); + sync_primitives::AutoLock lock(reregister_wait_list_lock_); + auto app_it = std::find_if( + reregister_wait_list_.begin(), + reregister_wait_list_.end(), + std::bind1st(std::ptr_fun(&policy_app_id_comparator), policy_app_id)); + if (reregister_wait_list_.end() != app_it) { + reregister_wait_list_.erase(app_it); + } +} + +void ApplicationManagerImpl::ProcessReconnection( + ApplicationSharedPtr application, const uint32_t connection_key) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(application); + + connection_handler::DeviceHandle new_device_id = 0; + connection_handler().get_session_observer().GetDataOnSessionKey( + connection_key, NULL, NULL, &new_device_id); + DCHECK_OR_RETURN_VOID(new_device_id); + + std::string device_mac; + std::string connection_type; + connection_handler().get_session_observer().GetDataOnDeviceID( + new_device_id, NULL, NULL, &device_mac, &connection_type); + + EraseAppFromReconnectionList(application); + + SwitchApplication(application, connection_key, new_device_id, device_mac); + + // Update connection type for existed device. + GetPolicyHandler().AddDevice(device_mac, connection_type); +} + void ApplicationManagerImpl::OnPTUFinished(const bool ptu_result) { #ifdef SDL_REMOTE_CONTROL if (!ptu_result) { @@ -3979,9 +4235,46 @@ void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( subscribed_way_points_apps_list_.erase(app_id); } +bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( + ApplicationSharedPtr app) const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); + LOG4CXX_DEBUG(logger_, + "There are applications subscribed: " + << subscribed_way_points_apps_list_.size()); + if (subscribed_way_points_apps_list_.find(app) == + subscribed_way_points_apps_list_.end()) { + return false; + } + return true; +} + +void ApplicationManagerImpl::SubscribeAppForWayPoints( + ApplicationSharedPtr app) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); + subscribed_way_points_apps_list_.insert(app); + LOG4CXX_DEBUG(logger_, + "There are applications subscribed: " + << subscribed_way_points_apps_list_.size()); +} + +void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( + ApplicationSharedPtr app) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); + subscribed_way_points_apps_list_.erase(app); + LOG4CXX_DEBUG(logger_, + "There are applications subscribed: " + << subscribed_way_points_apps_list_.size()); +} + bool ApplicationManagerImpl::IsAnyAppSubscribedForWayPoints() const { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); + LOG4CXX_DEBUG(logger_, + "There are applications subscribed: " + << subscribed_way_points_apps_list_.size()); return !subscribed_way_points_apps_list_.empty(); } diff --git a/src/components/application_manager/src/command_holder_impl.cc b/src/components/application_manager/src/command_holder_impl.cc new file mode 100644 index 0000000000..4e2cf89f57 --- /dev/null +++ b/src/components/application_manager/src/command_holder_impl.cc @@ -0,0 +1,141 @@ +/* + * 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. + */ + +#include "application_manager/command_holder_impl.h" +#include "application_manager/application_manager.h" +#include "application_manager/commands/command.h" + +namespace application_manager { +CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") + +CommandHolderImpl::CommandHolderImpl(ApplicationManager& app_manager) + : app_manager_(app_manager) {} + +void CommandHolderImpl::Suspend( + ApplicationSharedPtr application, + CommandType type, + utils::SharedPtr<smart_objects::SmartObject> command) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(application); + LOG4CXX_DEBUG(logger_, + "Suspending command(s) for application: " + << application->policy_app_id()); + sync_primitives::AutoLock lock(commands_lock_); + + if (CommandType::kHmiCommand == type) { + app_hmi_commands_[application].push_back(command); + LOG4CXX_DEBUG(logger_, + "Suspended HMI command(s): " << app_hmi_commands_.size()); + } else { + app_mobile_commands_[application].push_back(command); + LOG4CXX_DEBUG(logger_, + "Suspended mobile command(s): " << app_hmi_commands_.size()); + } +} + +void CommandHolderImpl::Resume(ApplicationSharedPtr application, + CommandType type) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(application); + LOG4CXX_DEBUG( + logger_, + "Resuming command(s) for application: " << application->policy_app_id()); + if (CommandType::kHmiCommand == type) { + ResumeHmiCommand(application); + } else { + ResumeMobileCommand(application); + } +} + +void CommandHolderImpl::Clear(ApplicationSharedPtr application) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(application); + LOG4CXX_DEBUG( + logger_, + "Clearing command(s) for application: " << application->policy_app_id()); + sync_primitives::AutoLock lock(commands_lock_); + auto app_hmi_commands = app_hmi_commands_.find(application); + if (app_hmi_commands_.end() != app_hmi_commands) { + LOG4CXX_DEBUG( + logger_, + "Clearing HMI command(s): " << app_hmi_commands->second.size()); + app_hmi_commands_.erase(app_hmi_commands); + } + + auto app_mobile_commands = app_mobile_commands_.find(application); + if (app_mobile_commands_.end() != app_mobile_commands) { + LOG4CXX_DEBUG( + logger_, + "Clearing mobile command(s): " << app_mobile_commands->second.size()); + app_mobile_commands_.erase(app_mobile_commands); + } +} + +void CommandHolderImpl::ResumeHmiCommand(ApplicationSharedPtr application) { + DCHECK_OR_RETURN_VOID(application); + sync_primitives::AutoLock lock(commands_lock_); + auto app_commands = app_hmi_commands_.find(application); + if (app_hmi_commands_.end() == app_commands) { + return; + } + + LOG4CXX_DEBUG(logger_, + "Resuming HMI command(s): " << app_hmi_commands_.size()); + + for (auto cmd : app_commands->second) { + (*cmd)[strings::msg_params][strings::app_id] = application->hmi_app_id(); + app_manager_.ManageHMICommand(cmd); + } + + app_hmi_commands_.erase(app_commands); +} + +void CommandHolderImpl::ResumeMobileCommand(ApplicationSharedPtr application) { + DCHECK_OR_RETURN_VOID(application); + sync_primitives::AutoLock lock(commands_lock_); + auto app_commands = app_mobile_commands_.find(application); + if (app_mobile_commands_.end() == app_commands) { + return; + } + + LOG4CXX_DEBUG(logger_, + "Resuming mobile command(s): " << app_mobile_commands_.size()); + + for (auto cmd : app_commands->second) { + (*cmd)[strings::params][strings::connection_key] = application->app_id(); + app_manager_.ManageMobileCommand( + cmd, commands::Command::CommandOrigin::ORIGIN_MOBILE); + } + + app_mobile_commands_.erase(app_commands); +} +} // application_manager diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index 0a3e65a790..b928184148 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -94,25 +94,30 @@ void CommandImpl::SetAllowedToTerminate(const bool allowed) { allowed_to_terminate_ = allowed; } -void CommandImpl::ReplaceMobileByHMIAppId( +bool CommandImpl::ReplaceMobileWithHMIAppId( NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { + LOG4CXX_AUTO_TRACE(logger_); if (message.keyExists(strings::app_id)) { ApplicationSharedPtr application = application_manager_.application(message[strings::app_id].asUInt()); - if (application.valid()) { - LOG4CXX_DEBUG(logger_, - "ReplaceMobileByHMIAppId from " - << message[strings::app_id].asInt() << " to " - << application->hmi_app_id()); - message[strings::app_id] = application->hmi_app_id(); + if (!application) { + LOG4CXX_ERROR(logger_, "Substitution mobile --> HMI id is failed."); + return false; } + LOG4CXX_DEBUG(logger_, + "ReplaceMobileWithHMIAppId from " + << message[strings::app_id].asInt() << " to " + << application->hmi_app_id()); + message[strings::app_id] = application->hmi_app_id(); } else { switch (message.getType()) { case smart_objects::SmartType::SmartType_Array: { smart_objects::SmartArray* message_array = message.asArray(); smart_objects::SmartArray::iterator it = message_array->begin(); for (; it != message_array->end(); ++it) { - ReplaceMobileByHMIAppId(*it); + if (!ReplaceMobileWithHMIAppId(*it)) { + break; + } } break; } @@ -121,36 +126,51 @@ void CommandImpl::ReplaceMobileByHMIAppId( std::set<std::string>::const_iterator key = keys.begin(); for (; key != keys.end(); ++key) { std::string k = *key; - ReplaceMobileByHMIAppId(message[*key]); + if (!ReplaceMobileWithHMIAppId(message[*key])) { + break; + } } break; } default: { break; } } } + + return true; +} + +DEPRECATED void CommandImpl::ReplaceMobileByHMIAppId( + NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { + if (!ReplaceMobileWithHMIAppId(message)) { + LOG4CXX_ERROR(logger_, "Substitution mobile --> HMI id is failed."); + } } -void CommandImpl::ReplaceHMIByMobileAppId( +bool CommandImpl::ReplaceHMIWithMobileAppId( NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { if (message.keyExists(strings::app_id)) { ApplicationSharedPtr application = application_manager_.application_by_hmi_app( message[strings::app_id].asUInt()); - if (application.valid()) { - LOG4CXX_DEBUG(logger_, - "ReplaceHMIByMobileAppId from " - << message[strings::app_id].asInt() << " to " - << application->app_id()); - message[strings::app_id] = application->app_id(); + if (!application) { + LOG4CXX_ERROR(logger_, "Substitution HMI --> mobile id is failed."); + return false; } + LOG4CXX_DEBUG(logger_, + "ReplaceHMIWithMobileAppId from " + << message[strings::app_id].asInt() << " to " + << application->app_id()); + message[strings::app_id] = application->app_id(); } else { switch (message.getType()) { case smart_objects::SmartType::SmartType_Array: { smart_objects::SmartArray* message_array = message.asArray(); smart_objects::SmartArray::iterator it = message_array->begin(); for (; it != message_array->end(); ++it) { - ReplaceHMIByMobileAppId(*it); + if (!ReplaceHMIWithMobileAppId(*it)) { + break; + } } break; } @@ -158,13 +178,24 @@ void CommandImpl::ReplaceHMIByMobileAppId( std::set<std::string> keys = message.enumerate(); std::set<std::string>::const_iterator key = keys.begin(); for (; key != keys.end(); ++key) { - ReplaceHMIByMobileAppId(message[*key]); + if (!ReplaceHMIWithMobileAppId(message[*key])) { + break; + } } break; } default: { break; } } } + + return true; +} + +DEPRECATED void CommandImpl::ReplaceHMIByMobileAppId( + NsSmartDeviceLink::NsSmartObjects::SmartObject& message) { + if (!ReplaceHMIWithMobileAppId(message)) { + LOG4CXX_ERROR(logger_, "Substitution HMI --> mobile id is failed."); + } } } // namespace commands diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 3f9a1d13b3..515d8a998c 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -31,8 +31,10 @@ */ #include <algorithm> +#include <numeric> #include <string> #include "utils/macro.h" +#include "utils/make_shared.h" #include "application_manager/commands/command_request_impl.h" #include "application_manager/application_manager.h" #include "application_manager/message_helper.h" @@ -105,20 +107,29 @@ const std::string CreateInfoForUnsupportedResult( } bool CheckResultCode(const ResponseInfo& first, const ResponseInfo& second) { - if (first.is_ok && second.is_unsupported_resource && - second.interface_state == HmiInterfaces::STATE_NOT_AVAILABLE) { + if (first.is_ok && second.is_unsupported_resource) { + return true; + } + if (first.is_ok && second.is_not_used) { + return true; + } + if (first.is_ok && second.is_ok) { return true; } return false; } -bool IsResultCodeUnsupported(const ResponseInfo& first, - const ResponseInfo& second) { - return ((first.is_ok || first.is_invalid_enum) && - second.is_unsupported_resource) || - ((second.is_ok || second.is_invalid_enum) && - first.is_unsupported_resource) || - (first.is_unsupported_resource && second.is_unsupported_resource); +bool IsResultCodeWarning(const ResponseInfo& first, + const ResponseInfo& second) { + const bool first_is_ok_second_is_warn = + (first.is_ok || first.is_not_used) && + hmi_apis::Common_Result::WARNINGS == second.result_code; + + const bool both_warnings = + hmi_apis::Common_Result::WARNINGS == first.result_code && + hmi_apis::Common_Result::WARNINGS == second.result_code; + + return first_is_ok_second_is_warn || both_warnings; } struct DisallowedParamsInserter { @@ -146,6 +157,42 @@ struct DisallowedParamsInserter { mobile_apis::VehicleDataResultCode::eType code_; }; +ResponseInfo::ResponseInfo() + : result_code(hmi_apis::Common_Result::INVALID_ENUM) + , interface(HmiInterfaces::HMI_INTERFACE_INVALID_ENUM) + , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) + , is_ok(false) + , is_unsupported_resource(false) + , is_not_used(false) {} + +ResponseInfo::ResponseInfo(const hmi_apis::Common_Result::eType result, + const HmiInterfaces::InterfaceID hmi_interface, + ApplicationManager& application_manager) + : result_code(result) + , interface(hmi_interface) + , interface_state(HmiInterfaces::STATE_NOT_RESPONSE) + , is_ok(false) + , is_unsupported_resource(false) + , is_not_used(false) { + using namespace helpers; + + interface_state = + application_manager.hmi_interfaces().GetInterfaceState(hmi_interface); + + is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + result_code, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::WRONG_LANGUAGE, + hmi_apis::Common_Result::RETRY, + hmi_apis::Common_Result::SAVED); + + is_not_used = hmi_apis::Common_Result::INVALID_ENUM == result_code; + + is_unsupported_resource = + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == result_code; +} + CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandImpl(message, application_manager) @@ -193,7 +240,7 @@ void CommandRequestImpl::onTimeOut() { function_id(), correlation_id(), mobile_api::Result::GENERIC_ERROR); - + AddTimeOutComponentInfoToMessage(*response); application_manager_.ManageMobileCommand(response, ORIGIN_SDL); } @@ -204,6 +251,7 @@ void CommandRequestImpl::SendResponse( const mobile_apis::Result::eType& result_code, const char* info, const smart_objects::SmartObject* response_params) { + LOG4CXX_AUTO_TRACE(logger_); { sync_primitives::AutoLock auto_lock(state_lock_); if (kTimedOut == current_state_) { @@ -214,11 +262,9 @@ void CommandRequestImpl::SendResponse( current_state_ = kCompleted; } - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; - if (!result) { - LOG4CXX_ERROR(logger_, "Memory allocation failed."); - return; - } + smart_objects::SmartObjectSPtr result = + utils::MakeShared<smart_objects::SmartObject>(); + smart_objects::SmartObject& response = *result; response[strings::params][strings::message_type] = MessageType::kResponse; @@ -755,6 +801,7 @@ bool CommandRequestImpl::HasDisallowedParams() const { bool CommandRequestImpl::PrepareResultForMobileResponse( hmi_apis::Common_Result::eType result_code, HmiInterfaces::InterfaceID interface) const { + LOG4CXX_AUTO_TRACE(logger_); using namespace helpers; if (Compare<hmi_apis::Common_Result::eType, EQ, ONE>( result_code, @@ -777,48 +824,9 @@ bool CommandRequestImpl::PrepareResultForMobileResponse( bool CommandRequestImpl::PrepareResultForMobileResponse( ResponseInfo& out_first, ResponseInfo& out_second) const { - using namespace helpers; - - out_first.is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - out_first.result_code, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED); - - out_second.is_ok = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( - out_second.result_code, - hmi_apis::Common_Result::SUCCESS, - hmi_apis::Common_Result::WARNINGS, - hmi_apis::Common_Result::WRONG_LANGUAGE, - hmi_apis::Common_Result::RETRY, - hmi_apis::Common_Result::SAVED); - - out_first.is_invalid_enum = - hmi_apis::Common_Result::INVALID_ENUM == out_first.result_code; - - out_second.is_invalid_enum = - hmi_apis::Common_Result::INVALID_ENUM == out_second.result_code; - - out_first.is_unsupported_resource = - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == out_first.result_code; - - out_second.is_unsupported_resource = - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == out_second.result_code; - - out_first.interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - out_first.interface); - out_second.interface_state = - application_manager_.hmi_interfaces().GetInterfaceState( - out_second.interface); - - bool result = (out_first.is_ok && out_second.is_ok) || - (out_second.is_invalid_enum && out_first.is_ok) || - (out_first.is_invalid_enum && out_second.is_ok); - result = result || CheckResultCode(out_first, out_second); - result = result || CheckResultCode(out_second, out_first); + LOG4CXX_AUTO_TRACE(logger_); + bool result = CheckResultCode(out_first, out_second) || + CheckResultCode(out_second, out_first); return result; } @@ -835,25 +843,30 @@ void CommandRequestImpl::GetInfo( mobile_apis::Result::eType CommandRequestImpl::PrepareResultCodeForResponse( const ResponseInfo& first, const ResponseInfo& second) { + LOG4CXX_AUTO_TRACE(logger_); mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - if (IsResultCodeUnsupported(first, second)) { - result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE; - } else { - // If response contains erroneous result code SDL need return erroneus - // result code. - hmi_apis::Common_Result::eType first_result = - hmi_apis::Common_Result::INVALID_ENUM; - hmi_apis::Common_Result::eType second_result = - hmi_apis::Common_Result::INVALID_ENUM; - if (!first.is_unsupported_resource) { - first_result = first.result_code; - } - if (!second.is_unsupported_resource) { - second_result = second.result_code; - } - result_code = - MessageHelper::HMIToMobileResult(std::max(first_result, second_result)); - } + if (IsResultCodeUnsupported(first, second) || + IsResultCodeUnsupported(second, first)) { + return mobile_apis::Result::UNSUPPORTED_RESOURCE; + } + if (IsResultCodeWarning(first, second) || + IsResultCodeWarning(second, first)) { + return mobile_apis::Result::WARNINGS; + } + // If response contains erroneous result code SDL need return erroneus + // result code. + hmi_apis::Common_Result::eType first_result = + hmi_apis::Common_Result::INVALID_ENUM; + hmi_apis::Common_Result::eType second_result = + hmi_apis::Common_Result::INVALID_ENUM; + if (!first.is_unsupported_resource) { + first_result = first.result_code; + } + if (!second.is_unsupported_resource) { + second_result = second.result_code; + } + result_code = + MessageHelper::HMIToMobileResult(std::max(first_result, second_result)); return result_code; } @@ -862,6 +875,100 @@ const CommandParametersPermissions& CommandRequestImpl::parameters_permissions() return parameters_permissions_; } +void CommandRequestImpl::StartAwaitForInterface( + const HmiInterfaces::InterfaceID interface_id) { + sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); + awaiting_response_interfaces_.insert(interface_id); +} + +bool CommandRequestImpl::IsInterfaceAwaited( + const HmiInterfaces::InterfaceID& interface_id) const { + sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); + std::set<HmiInterfaces::InterfaceID>::const_iterator it = + awaiting_response_interfaces_.find(interface_id); + return (it != awaiting_response_interfaces_.end()); +} + +void CommandRequestImpl::EndAwaitForInterface( + const HmiInterfaces::InterfaceID& interface_id) { + sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); + std::set<HmiInterfaces::InterfaceID>::const_iterator it = + awaiting_response_interfaces_.find(interface_id); + if (it != awaiting_response_interfaces_.end()) { + awaiting_response_interfaces_.erase(it); + } else { + LOG4CXX_WARN(logger_, + "EndAwaitForInterface called on interface \ + which was not put into await state: " + << interface_id); + } +} + +bool CommandRequestImpl::IsResultCodeUnsupported( + const ResponseInfo& first, const ResponseInfo& second) const { + const bool first_ok_second_unsupported = + (first.is_ok || first.is_not_used) && second.is_unsupported_resource; + const bool both_unsupported = + first.is_unsupported_resource && second.is_unsupported_resource; + return first_ok_second_unsupported || both_unsupported; +} + +std::string GetComponentNameFromInterface( + const HmiInterfaces::InterfaceID& interface) { + switch (interface) { + case HmiInterfaces::HMI_INTERFACE_Buttons: + return "Buttons"; + case HmiInterfaces::HMI_INTERFACE_BasicCommunication: + return "BasicCommunication"; + case HmiInterfaces::HMI_INTERFACE_VR: + return "VR"; + case HmiInterfaces::HMI_INTERFACE_TTS: + return "TTS"; + case HmiInterfaces::HMI_INTERFACE_UI: + return "UI"; + case HmiInterfaces::HMI_INTERFACE_Navigation: + return "Navigation"; + case HmiInterfaces::HMI_INTERFACE_VehicleInfo: + return "VehicleInfo"; + case HmiInterfaces::HMI_INTERFACE_SDL: + return "SDL"; + default: + return "Unknown type"; + } +} + +const std::string InfoInterfaceSeparator( + const std::string& sum, const HmiInterfaces::InterfaceID container_value) { + return sum.empty() + ? GetComponentNameFromInterface(container_value) + : sum + ", " + GetComponentNameFromInterface(container_value); +} + +void CommandRequestImpl::AddTimeOutComponentInfoToMessage( + smart_objects::SmartObject& response) const { + using NsSmartDeviceLink::NsSmartObjects::SmartObject; + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(awaiting_response_interfaces_lock_); + if (awaiting_response_interfaces_.empty()) { + LOG4CXX_ERROR(logger_, "No interfaces awaiting, info param is empty"); + return; + } + + const std::string not_responding_interfaces_string = + std::accumulate(awaiting_response_interfaces_.begin(), + awaiting_response_interfaces_.end(), + std::string(""), + InfoInterfaceSeparator); + LOG4CXX_DEBUG( + logger_, + "Not responding interfaces string: " << not_responding_interfaces_string); + if (!not_responding_interfaces_string.empty()) { + const std::string component_info = + not_responding_interfaces_string + " component does not respond"; + response[strings::msg_params][strings::info] = component_info; + } +} + } // namespace commands } // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc index 80b1edb5bb..c6c550a474 100644 --- a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc +++ b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,3 +29,45 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + +#include "application_manager/commands/hmi/basic_communication_on_awake_sdl.h" +#include "application_manager/message_helper.h" +#include "application_manager/resumption/resume_ctrl.h" + +namespace application_manager { + +namespace commands { + +OnAwakeSDLNotification::OnAwakeSDLNotification( + const MessageSharedPtr& message, ApplicationManager& application_manager) + : NotificationFromHMI(message, application_manager) {} + +OnAwakeSDLNotification::~OnAwakeSDLNotification() {} + +void OnAwakeSDLNotification::Run() { + LOG4CXX_AUTO_TRACE(logger_); + + if (!application_manager_.resume_controller().is_suspended()) { + return; + } + + { + DataAccessor<ApplicationSet> accessor = application_manager_.applications(); + ApplicationSetIt itBegin = accessor.GetData().begin(); + ApplicationSetIt itEnd = accessor.GetData().end(); + for (; itBegin != itEnd; ++itBegin) { + const ApplicationSharedPtr app = *itBegin; + if (app && app->IsHashChangedDuringSuspend()) { + MessageHelper::SendHashUpdateNotification(app->app_id(), + application_manager_); + app->SetHashChangedDuringSuspend(false); + } + } + } + + application_manager_.resume_controller().OnAwake(); +} + +} // namespace commands + +} // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc index 0bcb26df8a..42b8c64fc0 100644 --- a/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc @@ -109,6 +109,8 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) { logger_, "StartAudioStreamRequest aborted. Application can not stream"); } + application_manager_.TerminateRequest( + connection_key(), correlation_id(), function_id()); break; } if (hmi_apis::Common_Result::REJECTED == code) { @@ -125,15 +127,16 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) { } void AudioStartStreamRequest::onTimeOut() { + LOG4CXX_AUTO_TRACE(logger_); RetryStartSession(); - - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); } void AudioStartStreamRequest::RetryStartSession() { LOG4CXX_AUTO_TRACE(logger_); + application_manager_.TerminateRequest( + connection_key(), correlation_id(), function_id()); + ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { @@ -156,10 +159,11 @@ void AudioStartStreamRequest::RetryStartSession() { } uint32_t curr_retry_number = app->audio_stream_retry_number(); + LOG4CXX_DEBUG( + logger_, "Retry number " << curr_retry_number << " of " << retry_number_); + if (curr_retry_number < retry_number_) { - LOG4CXX_DEBUG( - logger_, - "Send AudioStartStream retry. retry_number = " << curr_retry_number); + LOG4CXX_DEBUG(logger_, "Send AudioStartStream retry"); MessageHelper::SendAudioStartStream(app->app_id(), application_manager_); app->set_audio_stream_retry_number(++curr_retry_number); } else { diff --git a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc index b06c69e703..ffc325b5e4 100644 --- a/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc +++ b/src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc @@ -109,6 +109,8 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) { logger_, "NaviStartStreamRequest aborted. Application can not stream"); } + application_manager_.TerminateRequest( + connection_key(), correlation_id(), function_id()); break; } if (hmi_apis::Common_Result::REJECTED == code) { @@ -125,15 +127,16 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) { } void NaviStartStreamRequest::onTimeOut() { + LOG4CXX_AUTO_TRACE(logger_); RetryStartSession(); - - application_manager_.TerminateRequest( - connection_key(), correlation_id(), function_id()); } void NaviStartStreamRequest::RetryStartSession() { LOG4CXX_AUTO_TRACE(logger_); + application_manager_.TerminateRequest( + connection_key(), correlation_id(), function_id()); + ApplicationSharedPtr app = application_manager_.application_by_hmi_app(application_id()); if (!app) { @@ -156,10 +159,11 @@ void NaviStartStreamRequest::RetryStartSession() { } uint32_t curr_retry_number = app->video_stream_retry_number(); + LOG4CXX_DEBUG( + logger_, "Retry number " << curr_retry_number << " of " << retry_number_); + if (curr_retry_number < retry_number_) { - LOG4CXX_DEBUG( - logger_, - "Send NaviStartStream retry. retry_number = " << curr_retry_number); + LOG4CXX_DEBUG(logger_, "Send NaviStartStream retry"); MessageHelper::SendNaviStartStream(app->app_id(), application_manager_); app->set_video_stream_retry_number(++curr_retry_number); } else { diff --git a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc index 64eb63fde8..3c2d73b10c 100644 --- a/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/notification_from_hmi.cc @@ -42,7 +42,7 @@ NotificationFromHMI::NotificationFromHMI( const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandImpl(message, application_manager) { // Replace HMI app id with Mobile connection id - ReplaceHMIByMobileAppId(*message); + ReplaceHMIWithMobileAppId(*message); } NotificationFromHMI::~NotificationFromHMI() {} diff --git a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc b/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc index f1e933b7ef..d52df950c3 100644 --- a/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/notification_to_hmi.cc @@ -39,15 +39,13 @@ namespace commands { NotificationToHMI::NotificationToHMI(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandImpl(message, application_manager) { - // Replace Mobile connection id with HMI app id - ReplaceMobileByHMIAppId(*(message.get())); -} + : CommandImpl(message, application_manager) {} NotificationToHMI::~NotificationToHMI() {} bool NotificationToHMI::Init() { - return true; + // Replace Mobile connection id with HMI app id + return ReplaceMobileWithHMIAppId(*message_); } bool NotificationToHMI::CleanUp() { diff --git a/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc index 10ea1ea303..f64e3e111b 100644 --- a/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_app_unregistered_notification.cc @@ -44,6 +44,12 @@ OnAppUnregisteredNotification::OnAppUnregisteredNotification( OnAppUnregisteredNotification::~OnAppUnregisteredNotification() {} +bool OnAppUnregisteredNotification::Init() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Replacement of hmi id is skipped."); + return true; +} + void OnAppUnregisteredNotification::Run() { LOG4CXX_AUTO_TRACE(logger_); diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc index 07a95adcea..cb68b21263 100644 --- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc @@ -75,6 +75,7 @@ void OnExitAllApplicationsNotification::Run() { break; } case hmi_apis::Common_ApplicationsCloseReason::SUSPEND: { + application_manager_.resume_controller().OnSuspend(); SendOnSDLPersistenceComplete(); return; } diff --git a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc index 5383876714..bba7e2f3ff 100644 --- a/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_vi_vehicle_data_notification.cc @@ -53,8 +53,9 @@ void OnVIVehicleDataNotification::Run() { const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; if (msg_params.keyExists(strings::odometer)) { - application_manager_.IviInfoUpdated(ODOMETER, - msg_params[strings::odometer].asInt()); + application_manager_.IviInfoUpdated( + mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER, + msg_params[strings::odometer].asInt()); } SendNotificationToMobile(message_); diff --git a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc index 1119e7c4fd..5a4e7b149e 100644 --- a/src/components/application_manager/src/commands/hmi/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/request_from_hmi.cc @@ -43,7 +43,7 @@ RequestFromHMI::RequestFromHMI(const MessageSharedPtr& message, : CommandImpl(message, application_manager) , EventObserver(application_manager.event_dispatcher()) { // Replace HMI app id with Mobile connection id - ReplaceHMIByMobileAppId(*(message.get())); + ReplaceHMIWithMobileAppId(*message); } RequestFromHMI::~RequestFromHMI() {} diff --git a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc index 39d549ac72..6905e7cdef 100644 --- a/src/components/application_manager/src/commands/hmi/request_to_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/request_to_hmi.cc @@ -61,15 +61,13 @@ bool ChangeInterfaceState(ApplicationManager& application_manager, RequestToHMI::RequestToHMI(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandImpl(message, application_manager) { - // Replace Mobile connection id with HMI app id - ReplaceMobileByHMIAppId(*(message.get())); -} + : CommandImpl(message, application_manager) {} RequestToHMI::~RequestToHMI() {} bool RequestToHMI::Init() { - return true; + // Replace Mobile connection id with HMI app id + return ReplaceMobileWithHMIAppId(*message_); } bool RequestToHMI::CleanUp() { diff --git a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc index 23d8e6e229..d6d5d95d07 100644 --- a/src/components/application_manager/src/commands/hmi/response_from_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/response_from_hmi.cc @@ -48,7 +48,7 @@ ResponseFromHMI::ResponseFromHMI(const MessageSharedPtr& message, } // Replace HMI app id with Mobile connection id - ReplaceHMIByMobileAppId(*(message.get())); + ReplaceHMIWithMobileAppId(*message); } ResponseFromHMI::~ResponseFromHMI() {} diff --git a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc b/src/components/application_manager/src/commands/hmi/response_to_hmi.cc index e6f64047ba..de1e1e0fde 100644 --- a/src/components/application_manager/src/commands/hmi/response_to_hmi.cc +++ b/src/components/application_manager/src/commands/hmi/response_to_hmi.cc @@ -39,15 +39,13 @@ namespace commands { ResponseToHMI::ResponseToHMI(const MessageSharedPtr& message, ApplicationManager& application_manager) - : CommandImpl(message, application_manager) { - // Replace Mobile connection id with HMI app id - ReplaceMobileByHMIAppId(*(message.get())); -} + : CommandImpl(message, application_manager) {} ResponseToHMI::~ResponseToHMI() {} bool ResponseToHMI::Init() { - return true; + // Replace Mobile connection id with HMI app id + return ReplaceMobileWithHMIAppId(*message_); } bool ResponseToHMI::CleanUp() { diff --git a/src/components/application_manager/src/commands/mobile/add_command_request.cc b/src/components/application_manager/src/commands/mobile/add_command_request.cc index c748ddcbb6..69948b8122 100644 --- a/src/components/application_manager/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_command_request.cc @@ -192,10 +192,12 @@ void AddCommandRequest::Run() { } if (send_ui_) { + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_AddCommand, &ui_msg_params, true); } if (send_vr_) { + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &vr_msg_params, true); } } @@ -317,6 +319,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_AddCommand: { LOG4CXX_INFO(logger_, "Received UI_AddCommand event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -328,6 +331,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::VR_AddCommand: { LOG4CXX_INFO(logger_, "Received VR_AddCommand event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc index a5491481dc..fe44e5a41f 100644 --- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc @@ -94,6 +94,7 @@ void AddSubMenuRequest::Run() { (*message_)[strings::msg_params][strings::menu_name]; msg_params[strings::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_AddSubMenu, &msg_params, true); } @@ -103,6 +104,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_AddSubMenu: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc index b151990289..d5767690d7 100644 --- a/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc @@ -111,6 +111,7 @@ void AlertManeuverRequest::Run() { } pending_requests_.Add(hmi_apis::FunctionID::Navigation_AlertManeuver); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); SendHMIRequest( hmi_apis::FunctionID::Navigation_AlertManeuver, &msg_params, true); @@ -123,6 +124,7 @@ void AlertManeuverRequest::Run() { msg_params[hmi_request::speak_type] = hmi_apis::Common_MethodName::ALERT_MANEUVER; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, &msg_params, true); } } @@ -134,6 +136,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { switch (event_id) { case hmi_apis::FunctionID::Navigation_AlertManeuver: { LOG4CXX_INFO(logger_, "Received Navigation_AlertManeuver event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); pending_requests_.Remove(event_id); navi_alert_maneuver_result_code_ = static_cast<hmi_apis::Common_Result::eType>( @@ -143,6 +146,7 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::TTS_Speak: { LOG4CXX_INFO(logger_, "Received TTS_Speak event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); pending_requests_.Remove(event_id); tts_speak_result_code_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -191,10 +195,13 @@ bool AlertManeuverRequest::PrepareResponseParameters( application_manager::commands::ResponseInfo navigation_alert_info( navi_alert_maneuver_result_code_, - HmiInterfaces::HMI_INTERFACE_Navigation); + HmiInterfaces::HMI_INTERFACE_Navigation, + application_manager_); application_manager::commands::ResponseInfo tts_alert_info( - tts_speak_result_code_, HmiInterfaces::HMI_INTERFACE_TTS); + tts_speak_result_code_, + HmiInterfaces::HMI_INTERFACE_TTS, + application_manager_); const bool result = PrepareResultForMobileResponse(navigation_alert_info, tts_alert_info); @@ -216,23 +223,42 @@ bool AlertManeuverRequest::PrepareResponseParameters( bool AlertManeuverRequest::IsWhiteSpaceExist() { LOG4CXX_AUTO_TRACE(logger_); - const char* str = NULL; + using smart_objects::SmartArray; if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) { - const smart_objects::SmartArray* tc_array = + const SmartArray* tts_chunks_arr = (*message_)[strings::msg_params][strings::tts_chunks].asArray(); - smart_objects::SmartArray::const_iterator it_tc = tc_array->begin(); - smart_objects::SmartArray::const_iterator it_tc_end = tc_array->end(); + SmartArray::const_iterator it_tts_chunk = tts_chunks_arr->begin(); - for (; it_tc != it_tc_end; ++it_tc) { - str = (*it_tc)[strings::text].asCharArray(); - if (strlen(str) && !CheckSyntax(str)) { + for (; it_tts_chunk != tts_chunks_arr->end(); ++it_tts_chunk) { + const char* tts_chunk_text = (*it_tts_chunk)[strings::text].asCharArray(); + if (strlen(tts_chunk_text) && !CheckSyntax(tts_chunk_text)) { LOG4CXX_ERROR(logger_, "Invalid tts_chunks syntax check failed"); return true; } } } + if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + DCHECK_OR_RETURN( + (*message_)[strings::msg_params][strings::soft_buttons].getType() == + smart_objects::SmartType_Array, + true); + const smart_objects::SmartArray* soft_button_array = + (*message_)[strings::msg_params][strings::soft_buttons].asArray(); + + SmartArray::const_iterator it_soft_button = soft_button_array->begin(); + + for (; it_soft_button != soft_button_array->end(); ++it_soft_button) { + const char* soft_button_text = + (*it_soft_button)[strings::text].asCharArray(); + if (!CheckSyntax(soft_button_text)) { + LOG4CXX_ERROR(logger_, "Invalid soft_buttons syntax check failed"); + return true; + } + } + } + return false; } diff --git a/src/components/application_manager/src/commands/mobile/alert_request.cc b/src/components/application_manager/src/commands/mobile/alert_request.cc index 3288870b92..3c42e43767 100644 --- a/src/components/application_manager/src/commands/mobile/alert_request.cc +++ b/src/components/application_manager/src/commands/mobile/alert_request.cc @@ -116,18 +116,6 @@ void AlertRequest::Run() { } } -void AlertRequest::onTimeOut() { - LOG4CXX_AUTO_TRACE(logger_); - if (false == - (*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { - CommandRequestImpl::onTimeOut(); - return; - } - LOG4CXX_INFO(logger_, - "Default timeout ignored. " - "AlertRequest with soft buttons wait timeout on HMI side"); -} - void AlertRequest::on_event(const event_engine::Event& event) { LOG4CXX_AUTO_TRACE(logger_); const smart_objects::SmartObject& message = event.smart_object(); @@ -148,6 +136,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::UI_Alert: { LOG4CXX_INFO(logger_, "Received UI_Alert event"); // Unsubscribe from event to avoid unwanted messages + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); unsubscribe_from_event(hmi_apis::FunctionID::UI_Alert); awaiting_ui_alert_response_ = false; HmiInterfaces::InterfaceState ui_interface_state = @@ -157,6 +146,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { if (awaiting_tts_speak_response_ && HmiInterfaces::STATE_NOT_AVAILABLE != ui_interface_state) { awaiting_tts_stop_speaking_response_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL, true); } alert_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -170,6 +160,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { case hmi_apis::FunctionID::TTS_Speak: { LOG4CXX_INFO(logger_, "Received TTS_Speak event"); // Unsubscribe from event to avoid unwanted messages + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak); awaiting_tts_speak_response_ = false; tts_speak_result_ = static_cast<hmi_apis::Common_Result::eType>( @@ -179,6 +170,7 @@ void AlertRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::TTS_StopSpeaking: { LOG4CXX_INFO(logger_, "Received TTS_StopSpeaking event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); // Unsubscribe from event to avoid unwanted messages unsubscribe_from_event(hmi_apis::FunctionID::TTS_StopSpeaking); awaiting_tts_stop_speaking_response_ = false; @@ -204,9 +196,11 @@ void AlertRequest::on_event(const event_engine::Event& event) { bool AlertRequest::PrepareResponseParameters( mobile_apis::Result::eType& result_code, std::string& info) { - ResponseInfo ui_alert_info(alert_result_, HmiInterfaces::HMI_INTERFACE_UI); + ResponseInfo ui_alert_info( + alert_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); ResponseInfo tts_alert_info(tts_speak_result_, - HmiInterfaces::HMI_INTERFACE_TTS); + HmiInterfaces::HMI_INTERFACE_TTS, + application_manager_); bool result = PrepareResultForMobileResponse(ui_alert_info, tts_alert_info); @@ -219,7 +213,7 @@ bool AlertRequest::PrepareResponseParameters( result = false; } result_code = mobile_apis::Result::WARNINGS; - if ((ui_alert_info.is_ok || ui_alert_info.is_invalid_enum) && + if ((ui_alert_info.is_ok || ui_alert_info.is_not_used) && tts_alert_info.is_unsupported_resource && HmiInterfaces::STATE_AVAILABLE == tts_alert_info.interface_state) { tts_response_info_ = "Unsupported phoneme type sent in a prompt"; @@ -230,6 +224,10 @@ bool AlertRequest::PrepareResponseParameters( result_code = PrepareResultCodeForResponse(ui_alert_info, tts_alert_info); info = MergeInfos( ui_alert_info, ui_response_info_, tts_alert_info, tts_response_info_); + // Mobile Alert request is successful when UI_Alert is successful + if (is_ui_alert_sent_ && !ui_alert_info.is_ok) { + return false; + } return result; } @@ -346,6 +344,7 @@ void AlertRequest::SendAlertRequest(int32_t app_id) { msg_params.keyExists(hmi_request::soft_buttons)) { awaiting_ui_alert_response_ = true; is_ui_alert_sent_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_Alert, &msg_params, true); } } @@ -370,6 +369,7 @@ void AlertRequest::SendSpeakRequest(int32_t app_id, } msg_params[strings::app_id] = app_id; msg_params[hmi_request::speak_type] = Common_MethodName::ALERT; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true); } diff --git a/src/components/application_manager/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/src/commands/mobile/change_registration_request.cc index f1f3b93e24..f55767c723 100644 --- a/src/components/application_manager/src/commands/mobile/change_registration_request.cc +++ b/src/components/application_manager/src/commands/mobile/change_registration_request.cc @@ -66,6 +66,73 @@ ChangeRegistrationRequest::ChangeRegistrationRequest( ChangeRegistrationRequest::~ChangeRegistrationRequest() {} +void ChangeRegistrationRequest::SendVRRequest( + ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { + const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); + auto function = hmi_apis::FunctionID::VR_ChangeRegistration; + pending_requests_.Add(function); + smart_objects::SmartObject vr_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + vr_params[strings::language] = msg_params[strings::language]; + + vr_params[strings::app_id] = app->app_id(); + if (msg_params.keyExists(strings::vr_synonyms)) { + vr_params[strings::vr_synonyms] = msg_params[strings::vr_synonyms]; + app->set_vr_synonyms(msg_params[strings::vr_synonyms]); + } + StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function)); + SendHMIRequest(function, &vr_params, true); +} + +void ChangeRegistrationRequest::SendTTSRequest( + ApplicationSharedPtr app, smart_objects::SmartObject& msg_params) { + const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); + auto function = hmi_apis::FunctionID::TTS_ChangeRegistration; + pending_requests_.Add(function); + + smart_objects::SmartObject tts_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + tts_params[strings::language] = msg_params[strings::language]; + + tts_params[strings::app_id] = app->app_id(); + if (msg_params.keyExists(strings::tts_name)) { + tts_params[strings::tts_name] = msg_params[strings::tts_name]; + app->set_tts_name(msg_params[strings::tts_name]); + } + StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function)); + SendHMIRequest(function, &tts_params, true); +} + +void ChangeRegistrationRequest::SendUIRequest( + ApplicationSharedPtr app, + smart_objects::SmartObject& msg_params, + const int32_t hmi_language) { + const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); + auto function = hmi_apis::FunctionID::UI_ChangeRegistration; + pending_requests_.Add(function); + // UI processing + smart_objects::SmartObject ui_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + ui_params[strings::language] = hmi_language; + ui_params[strings::app_id] = app->app_id(); + if (msg_params.keyExists(strings::app_name)) { + ui_params[strings::app_name] = msg_params[strings::app_name]; + app->set_name(msg_params[strings::app_name].asCustomString()); + } + if (msg_params.keyExists(strings::ngn_media_screen_app_name)) { + ui_params[strings::ngn_media_screen_app_name] = + msg_params[strings::ngn_media_screen_app_name]; + app->set_ngn_media_screen_name( + msg_params[strings::ngn_media_screen_app_name]); + } + + StartAwaitForInterface(hmi_interfaces.GetInterfaceFromFunction(function)); + SendHMIRequest(function, &ui_params, true); +} + void ChangeRegistrationRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); using namespace smart_objects; @@ -111,53 +178,42 @@ void ChangeRegistrationRequest::Run() { return; } - pending_requests_.Add(hmi_apis::FunctionID::UI_ChangeRegistration); - pending_requests_.Add(hmi_apis::FunctionID::VR_ChangeRegistration); - pending_requests_.Add(hmi_apis::FunctionID::TTS_ChangeRegistration); + const HmiInterfaces& hmi_interfaces = application_manager_.hmi_interfaces(); - // UI processing - SmartObject ui_params = SmartObject(SmartType_Map); + const HmiInterfaces::InterfaceState vr_state = + hmi_interfaces.GetInterfaceState( + HmiInterfaces::InterfaceID::HMI_INTERFACE_VR); + const HmiInterfaces::InterfaceState ui_state = + hmi_interfaces.GetInterfaceState( + HmiInterfaces::InterfaceID::HMI_INTERFACE_UI); + const HmiInterfaces::InterfaceState tts_state = + hmi_interfaces.GetInterfaceState( + HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS); - ui_params[strings::language] = hmi_language; - ui_params[strings::app_id] = app->app_id(); - if (msg_params.keyExists(strings::app_name)) { - ui_params[strings::app_name] = msg_params[strings::app_name]; - app->set_name(msg_params[strings::app_name].asCustomString()); + using helpers::Compare; + using helpers::EQ; + using helpers::ALL; + + if (Compare<HmiInterfaces::InterfaceState, EQ, ALL>( + HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE, + vr_state, + tts_state, + ui_state)) { + SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE); + return; } - if (msg_params.keyExists(strings::ngn_media_screen_app_name)) { - ui_params[strings::ngn_media_screen_app_name] = - msg_params[strings::ngn_media_screen_app_name]; - app->set_ngn_media_screen_name( - msg_params[strings::ngn_media_screen_app_name]); + if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != vr_state) { + // VR processing + SendVRRequest(app, msg_params); } - - SendHMIRequest(hmi_apis::FunctionID::UI_ChangeRegistration, &ui_params, true); - - // VR processing - SmartObject vr_params = SmartObject(SmartType_Map); - - vr_params[strings::language] = msg_params[strings::language]; - - vr_params[strings::app_id] = app->app_id(); - if (msg_params.keyExists(strings::vr_synonyms)) { - vr_params[strings::vr_synonyms] = msg_params[strings::vr_synonyms]; - app->set_vr_synonyms(msg_params[strings::vr_synonyms]); + if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != tts_state) { + // TTS processing + SendTTSRequest(app, msg_params); } - SendHMIRequest(hmi_apis::FunctionID::VR_ChangeRegistration, &vr_params, true); - - // TTS processing - SmartObject tts_params = SmartObject(SmartType_Map); - tts_params[strings::language] = msg_params[strings::language]; - - tts_params[strings::app_id] = app->app_id(); - if (msg_params.keyExists(strings::tts_name)) { - tts_params[strings::tts_name] = msg_params[strings::tts_name]; - app->set_tts_name(msg_params[strings::tts_name]); + if (HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE != ui_state) { + SendUIRequest(app, msg_params, hmi_language); } - - SendHMIRequest( - hmi_apis::FunctionID::TTS_ChangeRegistration, &tts_params, true); } void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { @@ -169,6 +225,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { switch (event_id) { case hmi_apis::FunctionID::UI_ChangeRegistration: { LOG4CXX_INFO(logger_, "Received UI_ChangeRegistration event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); pending_requests_.Remove(event_id); ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -177,6 +234,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::VR_ChangeRegistration: { LOG4CXX_INFO(logger_, "Received VR_ChangeRegistration event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); pending_requests_.Remove(event_id); vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -185,6 +243,7 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::TTS_ChangeRegistration: { LOG4CXX_INFO(logger_, "Received TTS_ChangeRegistration event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); pending_requests_.Remove(event_id); tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -295,12 +354,14 @@ bool ChangeRegistrationRequest::PrepareResponseParameters( hmi_interfaces.GetInterfaceState( HmiInterfaces::InterfaceID::HMI_INTERFACE_UI); - ResponseInfo ui_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI); + ResponseInfo ui_properties_info( + ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - ResponseInfo tts_properties_info(tts_result_, - HmiInterfaces::HMI_INTERFACE_TTS); + ResponseInfo tts_properties_info( + tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_); - ResponseInfo vr_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_VR); + ResponseInfo vr_properties_info( + ui_result_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_); bool result = ((!is_tts_ui_vr_unsupported) && is_tts_succeeded_unsupported && is_ui_succeeded_unsupported && is_vr_succeeded_unsupported); @@ -338,6 +399,9 @@ bool ChangeRegistrationRequest::PrepareResponseParameters( } result_code = MessageHelper::HMIToMobileResult( std::max(std::max(ui_result, vr_result), tts_result)); + if (mobile_api::Result::INVALID_ENUM == result_code) { + result_code = mobile_api::Result::UNSUPPORTED_RESOURCE; + } } const bool is_tts_state_available = diff --git a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc index e1148bd126..20387ef230 100644 --- a/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc @@ -287,6 +287,7 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests( sync_primitives::AutoLock commands_lock(vr_commands_lock_); const uint32_t vr_cmd_id = msg_params[strings::cmd_id].asUInt(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); const uint32_t vr_corr_id = SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &msg_params, true); @@ -356,6 +357,7 @@ void CreateInteractionChoiceSetRequest::on_event( uint32_t corr_id = static_cast<uint32_t>( message[strings::params][strings::correlation_id].asUInt()); if (event.id() == hmi_apis::FunctionID::VR_AddCommand) { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); { sync_primitives::AutoLock commands_lock(vr_commands_lock_); if (is_no_error) { @@ -376,6 +378,7 @@ void CreateInteractionChoiceSetRequest::onTimeOut() { if (!error_from_hmi_) { SendResponse(false, mobile_apis::Result::GENERIC_ERROR); } + CommandRequestImpl::onTimeOut(); DeleteChoices(); // We have to keep request alive until receive all responses from HMI diff --git a/src/components/application_manager/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/src/commands/mobile/delete_command_request.cc index cfc8e12144..f894ed452c 100644 --- a/src/components/application_manager/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_command_request.cc @@ -104,12 +104,14 @@ void DeleteCommandRequest::Run() { is_vr_send_ = true; } if (is_ui_send_) { + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params, true); } if (is_vr_send_) { // VR params msg_params[strings::grammar_id] = application->get_grammar_id(); msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params, true); } } @@ -117,8 +119,10 @@ void DeleteCommandRequest::Run() { bool DeleteCommandRequest::PrepareResponseParameters( mobile_apis::Result::eType& result_code, std::string& info) { using namespace helpers; - ResponseInfo ui_delete_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI); - ResponseInfo vr_delete_info(vr_result_, HmiInterfaces::HMI_INTERFACE_VR); + ResponseInfo ui_delete_info( + ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); + ResponseInfo vr_delete_info( + vr_result_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_); const bool result = PrepareResultForMobileResponse(ui_delete_info, vr_delete_info); @@ -143,6 +147,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); switch (event.id()) { case hmi_apis::FunctionID::UI_DeleteCommand: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -153,6 +158,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { break; } case hmi_apis::FunctionID::VR_DeleteCommand: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); is_vr_received_ = true; vr_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc index 21c7ecce90..09f3139245 100644 --- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc @@ -74,6 +74,7 @@ void DeleteSubMenuRequest::Run() { msg_params[strings::menu_id] = (*message_)[strings::msg_params][strings::menu_id]; msg_params[strings::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params, true); } @@ -143,6 +144,7 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_DeleteSubMenu: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc index 5c5d250026..7704d700f9 100644 --- a/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc @@ -83,6 +83,7 @@ void DiagnosticMessageRequest::Run() { // Add app_id for HMI request (*message_)[strings::msg_params][strings::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage, &(*message_)[strings::msg_params], true); @@ -94,6 +95,7 @@ void DiagnosticMessageRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::VehicleInfo_DiagnosticMessage: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/dial_number_request.cc b/src/components/application_manager/src/commands/mobile/dial_number_request.cc index 64685afe2e..d0ab42e266 100644 --- a/src/components/application_manager/src/commands/mobile/dial_number_request.cc +++ b/src/components/application_manager/src/commands/mobile/dial_number_request.cc @@ -87,6 +87,7 @@ void DialNumberRequest::Run() { (*message_)[strings::msg_params][strings::number].asString(); msg_params[strings::app_id] = application->hmi_app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); SendHMIRequest( hmi_apis::FunctionID::BasicCommunication_DialNumber, &msg_params, true); } @@ -106,6 +107,7 @@ void DialNumberRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::BasicCommunication_DialNumber: { LOG4CXX_INFO(logger_, "Received DialNumber event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); result_code = CommandRequestImpl::GetMobileResultCode( static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt())); diff --git a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc index f67d1f2434..0bd83078e5 100644 --- a/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/end_audio_pass_thru_request.cc @@ -47,6 +47,7 @@ EndAudioPassThruRequest::~EndAudioPassThruRequest() {} void EndAudioPassThruRequest::Run() { LOG4CXX_AUTO_TRACE(logger_); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_EndAudioPassThru, NULL, true); } @@ -56,6 +57,7 @@ void EndAudioPassThruRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_EndAudioPassThru: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt()); diff --git a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc index d98207c772..88fd07234a 100644 --- a/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_dtcs_request.cc @@ -72,6 +72,7 @@ void GetDTCsRequest::Run() { msg_params[strings::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_GetDTCs, &msg_params, true); } @@ -81,6 +82,7 @@ void GetDTCsRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::VehicleInfo_GetDTCs: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc index 46ef221d89..f81d0a8c2a 100644 --- a/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc @@ -250,6 +250,7 @@ void GetVehicleDataRequest::Run() { } } if (msg_params.length() > min_length_msg_params) { + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); SendHMIRequest( hmi_apis::FunctionID::VehicleInfo_GetVehicleData, &msg_params, true); return; @@ -266,6 +267,7 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::VehicleInfo_GetVehicleData: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc index c313d74d4b..da4ce38646 100644 --- a/src/components/application_manager/src/commands/mobile/get_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/get_way_points_request.cc @@ -31,6 +31,7 @@ void GetWayPointsRequest::Run() { msg_params = (*message_)[strings::msg_params]; msg_params[strings::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); SendHMIRequest(hmi_apis::FunctionID::Navigation_GetWayPoints, msg_params.empty() ? NULL : &msg_params, true); @@ -48,6 +49,7 @@ void GetWayPointsRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::Navigation_GetWayPoints: { LOG4CXX_INFO(logger_, "Received Navigation_GetWayPoints event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc index 9f5fd937f9..a05d41c098 100644 --- a/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc @@ -47,8 +47,6 @@ namespace str = strings; PerformAudioPassThruRequest::PerformAudioPassThruRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandRequestImpl(message, application_manager) - , awaiting_tts_speak_response_(false) - , awaiting_ui_response_(false) , result_tts_speak_(hmi_apis::Common_Result::INVALID_ENUM) , result_ui_(hmi_apis::Common_Result::INVALID_ENUM) { subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout); @@ -97,7 +95,7 @@ void PerformAudioPassThruRequest::Run() { // According with new implementation processing of UNSUPPORTE_RESOURCE // need set flag before sending to hmi - awaiting_ui_response_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); if ((*message_)[str::msg_params].keyExists(str::initial_prompt) && (0 < (*message_)[str::msg_params][str::initial_prompt].length())) { // In case TTS Speak, subscribe on notification @@ -119,7 +117,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_PerformAudioPassThru: { LOG4CXX_TRACE(logger_, "Received UI_PerformAudioPassThru"); - awaiting_ui_response_ = false; + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); result_ui_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt()); @@ -142,7 +140,7 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { result_tts_speak_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt()); GetInfo(message, tts_info_); - awaiting_tts_speak_response_ = false; + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); const bool is_tts_speak_success_unsuported = Compare<hmi_apis::Common_Result::eType, EQ, ONE>( result_tts_speak_, @@ -179,36 +177,58 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) { return; } - std::string return_info; - mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; - const bool result = PrepareResponseParameters(result_code, return_info); + const ResponseParams response_params = PrepareResponseParameters(); - SendResponse(result, - result_code, - return_info.empty() ? NULL : return_info.c_str(), - &(message[strings::msg_params])); + SendResponse( + response_params.success, + response_params.result_code, + response_params.info.empty() ? NULL : response_params.info.c_str(), + &(message[strings::msg_params])); } -bool PerformAudioPassThruRequest::PrepareResponseParameters( - mobile_apis::Result::eType& result_code, std::string& info) { +const PerformAudioPassThruRequest::ResponseParams& +PerformAudioPassThruRequest::PrepareResponseParameters() { LOG4CXX_AUTO_TRACE(logger_); - ResponseInfo ui_perform_info(result_ui_, HmiInterfaces::HMI_INTERFACE_UI); + ResponseInfo ui_perform_info( + result_ui_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); ResponseInfo tts_perform_info(result_tts_speak_, - HmiInterfaces::HMI_INTERFACE_TTS); - const bool result = - PrepareResultForMobileResponse(ui_perform_info, tts_perform_info); + HmiInterfaces::HMI_INTERFACE_TTS, + application_manager_); + // Note(dtrunov): According to requirment "WARNINGS, success:true on getting + // UNSUPPORTED_RESOURCE for "ttsChunks" if (ui_perform_info.is_ok && tts_perform_info.is_unsupported_resource && HmiInterfaces::STATE_AVAILABLE == tts_perform_info.interface_state) { - result_code = mobile_apis::Result::WARNINGS; + response_params_.result_code = mobile_apis::Result::WARNINGS; tts_info_ = "Unsupported phoneme type sent in a prompt"; - info = MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_); - return result; + response_params_.info = + MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_); + response_params_.success = true; + return response_params_; } - result_code = PrepareResultCodeForResponse(ui_perform_info, tts_perform_info); - info = MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_); - return result; + + response_params_.success = + PrepareResultForMobileResponse(ui_perform_info, tts_perform_info); + if (IsResultCodeUnsupported(ui_perform_info, tts_perform_info)) { + response_params_.result_code = mobile_apis::Result::UNSUPPORTED_RESOURCE; + } else { + AudioPassThruResults results = PrepareAudioPassThruResultCodeForResponse( + ui_perform_info, tts_perform_info); + response_params_.success = results.second; + response_params_.result_code = results.first; + } + response_params_.info = + MergeInfos(ui_perform_info, ui_info_, tts_perform_info, tts_info_); + + return response_params_; +} + +bool PerformAudioPassThruRequest::PrepareResponseParameters( + mobile_apis::Result::eType& result_code, std::string& info) { + LOG4CXX_AUTO_TRACE(logger_); + NOTREACHED(); + return false; } void PerformAudioPassThruRequest::SendSpeakRequest() { @@ -229,7 +249,7 @@ void PerformAudioPassThruRequest::SendSpeakRequest() { // app_id msg_params[strings::app_id] = connection_key(); msg_params[hmi_request::speak_type] = Common_MethodName::AUDIO_PASS_THRU; - awaiting_tts_speak_response_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true); } @@ -273,6 +293,7 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() { msg_params[str::mute_audio] = true; } + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest( hmi_apis::FunctionID::UI_PerformAudioPassThru, &msg_params, true); } @@ -353,16 +374,56 @@ void PerformAudioPassThruRequest::FinishTTSSpeak() { LOG4CXX_DEBUG(logger_, "Stop AudioPassThru."); application_manager_.StopAudioPassThru(connection_key()); } - if (!awaiting_tts_speak_response_) { + if (!IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS)) { LOG4CXX_WARN(logger_, "TTS Speak is inactive."); return; } SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL); } +PerformAudioPassThruRequest::AudioPassThruResults +PerformAudioPassThruRequest::PrepareAudioPassThruResultCodeForResponse( + const ResponseInfo& ui_response, const ResponseInfo& tts_response) { + mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM; + + hmi_apis::Common_Result::eType common_result = + hmi_apis::Common_Result::INVALID_ENUM; + const hmi_apis::Common_Result::eType ui_result = ui_response.result_code; + const hmi_apis::Common_Result::eType tts_result = tts_response.result_code; + bool result = false; + + if ((ui_result == hmi_apis::Common_Result::SUCCESS) && + (tts_result == hmi_apis::Common_Result::SUCCESS)) { + result = true; + } + + if ((ui_result == hmi_apis::Common_Result::SUCCESS) && + (tts_result == hmi_apis::Common_Result::INVALID_ENUM)) { + result = true; + } + + if ((ui_result == hmi_apis::Common_Result::SUCCESS) && + (tts_result != hmi_apis::Common_Result::SUCCESS) && + (tts_result != hmi_apis::Common_Result::INVALID_ENUM)) { + common_result = hmi_apis::Common_Result::WARNINGS; + result = true; + } else if (ui_response.is_ok && + tts_result == hmi_apis::Common_Result::WARNINGS) { + common_result = hmi_apis::Common_Result::WARNINGS; + result = true; + } else if (ui_result == hmi_apis::Common_Result::INVALID_ENUM) { + common_result = tts_result; + } else { + common_result = ui_result; + } + result_code = MessageHelper::HMIToMobileResult(common_result); + return std::make_pair(result_code, result); +} + bool PerformAudioPassThruRequest::IsWaitingHMIResponse() { LOG4CXX_AUTO_TRACE(logger_); - return awaiting_tts_speak_response_ || awaiting_ui_response_; + return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) || + IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc index 007440e8e6..68940158b9 100644 --- a/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc +++ b/src/components/application_manager/src/commands/mobile/perform_interaction_request.cc @@ -143,11 +143,10 @@ void PerformInteractionRequest::Run() { } } - if (choice_set_id_list_length && - (!CheckChoiceIDFromRequest( - app, - choice_set_id_list_length, - msg_params[strings::interaction_choice_set_id_list]))) { + if (!CheckChoiceIDFromRequest( + app, + choice_set_id_list_length, + msg_params[strings::interaction_choice_set_id_list])) { LOG4CXX_ERROR(logger_, "PerformInteraction has choice sets with " "duplicated IDs or application does not have choice sets"); @@ -227,6 +226,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::UI_PerformInteraction: { LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); ui_response_received_ = true; unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction); ui_result_code_ = static_cast<hmi_apis::Common_Result::eType>( @@ -237,6 +237,7 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::VR_PerformInteraction: { LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); vr_response_received_ = true; unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction); vr_result_code_ = static_cast<hmi_apis::Common_Result::eType>( @@ -392,14 +393,14 @@ void PerformInteractionRequest::ProcessUIResponse( if (result) { if (is_pi_warning) { ui_result_code_ = hmi_apis::Common_Result::WARNINGS; - ui_info_ = "Unsupported phoneme type was sent in an item"; + ui_info_ = message[strings::msg_params][strings::info].asString(); if (message.keyExists(strings::params) && message[strings::params].keyExists(strings::data)) { msg_params = message[strings::params][strings::data]; } } else if (is_pi_unsupported) { ui_result_code_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - ui_info_ = "Unsupported phoneme type was sent in an item"; + ui_info_ = message[strings::msg_params][strings::info].asString(); } else if (message.keyExists(strings::msg_params)) { msg_params = message[strings::msg_params]; } @@ -503,6 +504,7 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest( (*message_)[strings::msg_params][hmi_request::interaction_layout] .asInt(); } + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest( hmi_apis::FunctionID::UI_PerformInteraction, &msg_params, true); } @@ -595,6 +597,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest( msg_params[strings::timeout] = default_timeout_; } msg_params[strings::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); SendHMIRequest( hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, true); } @@ -926,10 +929,10 @@ void PerformInteractionRequest::SendBothModeResponse( LOG4CXX_AUTO_TRACE(logger_); mobile_apis::Result::eType perform_interaction_result_code = mobile_apis::Result::INVALID_ENUM; - ResponseInfo ui_perform_info(ui_result_code_, - HmiInterfaces::HMI_INTERFACE_UI); - ResponseInfo vr_perform_info(vr_result_code_, - HmiInterfaces::HMI_INTERFACE_VR); + ResponseInfo ui_perform_info( + ui_result_code_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); + ResponseInfo vr_perform_info( + vr_result_code_, HmiInterfaces::HMI_INTERFACE_VR, application_manager_); const bool result = PrepareResultForMobileResponse(ui_perform_info, vr_perform_info); perform_interaction_result_code = diff --git a/src/components/application_manager/src/commands/mobile/read_did_request.cc b/src/components/application_manager/src/commands/mobile/read_did_request.cc index 0bf747bde3..c51f545e7e 100644 --- a/src/components/application_manager/src/commands/mobile/read_did_request.cc +++ b/src/components/application_manager/src/commands/mobile/read_did_request.cc @@ -87,6 +87,7 @@ void ReadDIDRequest::Run() { (*message_)[strings::msg_params][strings::ecu_name]; msg_params[strings::did_location] = (*message_)[strings::msg_params][strings::did_location]; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_ReadDID, &msg_params, true); } @@ -97,6 +98,7 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::VehicleInfo_ReadDID: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc index 5185d9e5a6..a3a30ddb20 100644 --- a/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/src/commands/mobile/register_app_interface_request.cc @@ -46,6 +46,7 @@ #include "application_manager/message_helper.h" #include "application_manager/resumption/resume_ctrl.h" #include "application_manager/policies/policy_handler.h" +#include "application_manager/helpers/application_helper.h" #include "config_profile/profile.h" #include "interfaces/MOBILE_API.h" #include "interfaces/generated_msg_version.h" @@ -217,6 +218,10 @@ void RegisterAppInterfaceRequest::Run() { return; } + if (IsApplicationSwitched()) { + return; + } + const std::string mobile_app_id = (*message_)[strings::msg_params][strings::app_id].asString(); @@ -231,7 +236,13 @@ void RegisterAppInterfaceRequest::Run() { const smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - const std::string& policy_app_id = msg_params[strings::app_id].asString(); + const std::string policy_app_id = msg_params[strings::app_id].asString(); + std::string new_policy_app_id = policy_app_id; + std::transform(policy_app_id.begin(), + policy_app_id.end(), + new_policy_app_id.begin(), + ::tolower); + (*message_)[strings::msg_params][strings::app_id] = new_policy_app_id; if (application_manager_.IsApplicationForbidden(connection_key(), policy_app_id)) { @@ -359,7 +370,7 @@ void RegisterAppInterfaceRequest::Run() { GetPolicyHandler().SetDeviceInfo(device_mac, device_info); - SendRegisterAppInterfaceResponseToMobile(); + SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication); smart_objects::SmartObjectSPtr so = GetLockScreenIconUrlNotification(connection_key(), application); application_manager_.ManageMobileCommand(so, commands::Command::ORIGIN_SDL); @@ -498,7 +509,8 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params, hmi_capabilities.rc_supported(); } -void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { +void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile( + ApplicationType app_type) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObject response_params(smart_objects::SmartType_Map); @@ -569,18 +581,27 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { FillUIRelatedFields(response_params, hmi_capabilities); } + if (HmiInterfaces::STATE_NOT_AVAILABLE != + application_manager_.hmi_interfaces().GetInterfaceState( + HmiInterfaces::HMI_INTERFACE_VehicleInfo)) { + FillVIRelatedFields(response_params, hmi_capabilities); + } + if (hmi_capabilities.button_capabilities()) { response_params[hmi_response::button_capabilities] = *hmi_capabilities.button_capabilities(); } + if (hmi_capabilities.soft_button_capabilities()) { response_params[hmi_response::soft_button_capabilities] = *hmi_capabilities.soft_button_capabilities(); } + if (hmi_capabilities.preset_bank_capabilities()) { response_params[hmi_response::preset_bank_capabilities] = *hmi_capabilities.preset_bank_capabilities(); } + if (hmi_capabilities.hmi_zone_capabilities()) { if (smart_objects::SmartType_Array == hmi_capabilities.hmi_zone_capabilities()->getType()) { @@ -593,23 +614,11 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { } } - if (HmiInterfaces::STATE_NOT_AVAILABLE != - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_TTS)) { - FillTTSRelatedFields(response_params, hmi_capabilities); - } - if (hmi_capabilities.pcm_stream_capabilities()) { response_params[strings::pcm_stream_capabilities] = *hmi_capabilities.pcm_stream_capabilities(); } - if (HmiInterfaces::STATE_NOT_AVAILABLE != - application_manager_.hmi_interfaces().GetInterfaceState( - HmiInterfaces::HMI_INTERFACE_VehicleInfo)) { - FillVIRelatedFields(response_params, hmi_capabilities); - } - const std::vector<uint32_t>& diag_modes = application_manager_.get_settings().supported_diag_modes(); if (!diag_modes.empty()) { @@ -620,6 +629,7 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { ++index; } } + response_params[strings::sdl_version] = application_manager_.get_settings().sdl_version(); const std::string ccpu_version = @@ -628,6 +638,27 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { response_params[strings::system_software_version] = ccpu_version; } + if (ApplicationType::kSwitchedApplicationWrongHashId == app_type) { + LOG4CXX_DEBUG(logger_, + "Application has been switched from another transport, " + "but doesn't have correct hashID."); + + application_manager::DeleteApplicationData(application, + application_manager_); + + SendResponse( + true, mobile_apis::Result::RESUME_FAILED, NULL, &response_params); + return; + } + + if (ApplicationType::kSwitchedApplicationHashOk == app_type) { + LOG4CXX_DEBUG(logger_, + "Application has been switched from another transport " + "and has correct hashID."); + SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params); + return; + } + bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id); @@ -710,6 +741,11 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { SendChangeRegistrationOnHMI(application); } +DEPRECATED void +RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() { + SendRegisterAppInterfaceResponseToMobile(ApplicationType::kNewApplication); +} + void RegisterAppInterfaceRequest::SendChangeRegistration( const hmi_apis::FunctionID::eType function_id, const int32_t language, @@ -1191,6 +1227,56 @@ void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() { CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params); } +bool RegisterAppInterfaceRequest::IsApplicationSwitched() { + const smart_objects::SmartObject& msg_params = + (*message_)[strings::msg_params]; + + const std::string& policy_app_id = msg_params[strings::app_id].asString(); + + LOG4CXX_DEBUG(logger_, "Looking for application id " << policy_app_id); + + auto app = application_manager_.application_by_policy_id(policy_app_id); + + if (!app) { + LOG4CXX_DEBUG(logger_, + "Application with policy id " << policy_app_id + << " is not found."); + return false; + } + + LOG4CXX_DEBUG(logger_, + "Application with policy id " << policy_app_id << " is found."); + if (!application_manager_.IsAppInReconnectMode(policy_app_id)) { + LOG4CXX_DEBUG(logger_, + "Policy id " << policy_app_id + << " is not found in reconnection list."); + SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY); + return false; + } + + LOG4CXX_DEBUG(logger_, "Application is found in reconnection list."); + + auto app_type = ApplicationType::kSwitchedApplicationWrongHashId; + if ((*message_)[strings::msg_params].keyExists(strings::hash_id)) { + const auto hash_id = + (*message_)[strings::msg_params][strings::hash_id].asString(); + + auto& resume_ctrl = application_manager_.resume_controller(); + if (resume_ctrl.CheckApplicationHash(app, hash_id)) { + app_type = ApplicationType::kSwitchedApplicationHashOk; + } + } + + application_manager_.ProcessReconnection(app, connection_key()); + SendRegisterAppInterfaceResponseToMobile(app_type); + + application_manager_.SendHMIStatusNotification(app); + + application_manager_.OnApplicationSwitched(app); + + return true; +} + policy::PolicyHandlerInterface& RegisterAppInterfaceRequest::GetPolicyHandler() { return application_manager_.GetPolicyHandler(); diff --git a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc index 713d50e190..a7c2db0e65 100644 --- a/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc @@ -46,10 +46,6 @@ namespace commands { ResetGlobalPropertiesRequest::ResetGlobalPropertiesRequest( const MessageSharedPtr& message, ApplicationManager& application_manager) : CommandRequestImpl(message, application_manager) - , is_ui_send_(false) - , is_tts_send_(false) - , is_ui_received_(false) - , is_tts_received_(false) , ui_result_(hmi_apis::Common_Result::INVALID_ENUM) , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {} @@ -111,11 +107,11 @@ void ResetGlobalPropertiesRequest::Run() { if (vr_help_title_items || menu_name || menu_icon || is_key_board_properties) { - is_ui_send_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); } if (timeout_prompt || helpt_promt) { - is_tts_send_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); } app->set_reset_global_properties_active(true); @@ -245,7 +241,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); - is_ui_received_ = true; + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, ui_response_info_); @@ -253,7 +249,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); - is_tts_received_ = true; + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, tts_response_info_); @@ -292,9 +288,10 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters( using namespace helpers; bool result = false; - ResponseInfo ui_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI); - ResponseInfo tts_properties_info(tts_result_, - HmiInterfaces::HMI_INTERFACE_TTS); + ResponseInfo ui_properties_info( + ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); + ResponseInfo tts_properties_info( + tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_); HmiInterfaces::InterfaceState tts_interface_state = application_manager_.hmi_interfaces().GetInterfaceState( @@ -321,7 +318,8 @@ bool ResetGlobalPropertiesRequest::PrepareResponseParameters( } bool ResetGlobalPropertiesRequest::IsPendingResponseExist() { - return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_; + return IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_TTS) || + IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI); } } // namespace commands diff --git a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc index 0c770953fe..b0b2d5f464 100644 --- a/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc +++ b/src/components/application_manager/src/commands/mobile/scrollable_message_request.cc @@ -109,7 +109,7 @@ void ScrollableMessageRequest::Run() { MessageHelper::SubscribeApplicationToSoftButton( (*message_)[strings::msg_params], app, function_id()); } - + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_ScrollableMessage, &msg_params, true); } @@ -126,6 +126,7 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::UI_ScrollableMessage: { LOG4CXX_INFO(logger_, "Received UI_ScrollableMessage event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( diff --git a/src/components/application_manager/src/commands/mobile/send_location_request.cc b/src/components/application_manager/src/commands/mobile/send_location_request.cc index 9ec4ca3fcc..54664a8771 100644 --- a/src/components/application_manager/src/commands/mobile/send_location_request.cc +++ b/src/components/application_manager/src/commands/mobile/send_location_request.cc @@ -125,6 +125,7 @@ void SendLocationRequest::Run() { SmartObject request_msg_params = SmartObject(smart_objects::SmartType_Map); request_msg_params = msg_params; request_msg_params[strings::app_id] = app->hmi_app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); SendHMIRequest( hmi_apis::FunctionID::Navigation_SendLocation, &request_msg_params, true); } @@ -135,6 +136,7 @@ void SendLocationRequest::on_event(const event_engine::Event& event) { const smart_objects::SmartObject& message = event.smart_object(); if (hmi_apis::FunctionID::Navigation_SendLocation == event.id()) { LOG4CXX_INFO(logger_, "Received Navigation_SendLocation event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const Common_Result::eType result_code = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); std::string response_info; diff --git a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc index 5afddfb4d0..ee544e956a 100644 --- a/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_app_icon_request.cc @@ -114,7 +114,7 @@ void SetAppIconRequest::Run() { // for further use in on_event function (*message_)[strings::msg_params][strings::sync_file_name] = msg_params[strings::sync_file_name]; - + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true); } @@ -242,6 +242,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetAppIcon: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc index 984690384a..38b62ce731 100644 --- a/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_display_layout_request.cc @@ -58,6 +58,7 @@ void SetDisplayLayoutRequest::Run() { } (*message_)[strings::msg_params][strings::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_SetDisplayLayout, &((*message_)[strings::msg_params]), true); @@ -70,6 +71,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetDisplayLayout: { LOG4CXX_INFO(logger_, "Received UI_SetDisplayLayout event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc index 096c4ed783..e811f5d154 100644 --- a/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_global_properties_request.cc @@ -229,6 +229,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); is_ui_received_ = true; ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -237,6 +238,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { LOG4CXX_INFO(logger_, "Received TTS_SetGlobalProperties event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); is_tts_received_ = true; tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -277,10 +279,11 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters( LOG4CXX_AUTO_TRACE(logger_); using namespace helpers; - ResponseInfo ui_properties_info(ui_result_, HmiInterfaces::HMI_INTERFACE_UI); + ResponseInfo ui_properties_info( + ui_result_, HmiInterfaces::HMI_INTERFACE_UI, application_manager_); - ResponseInfo tts_properties_info(tts_result_, - HmiInterfaces::HMI_INTERFACE_TTS); + ResponseInfo tts_properties_info( + tts_result_, HmiInterfaces::HMI_INTERFACE_TTS, application_manager_); const bool result = PrepareResultForMobileResponse(ui_properties_info, tts_properties_info); if (result && @@ -397,6 +400,7 @@ void SetGlobalPropertiesRequest::SendTTSRequest( const smart_objects::SmartObject& params, bool use_events) { LOG4CXX_AUTO_TRACE(logger_); is_tts_send_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); SendHMIRequest( hmi_apis::FunctionID::TTS_SetGlobalProperties, ¶ms, use_events); } @@ -405,6 +409,7 @@ void SetGlobalPropertiesRequest::SendUIRequest( const smart_objects::SmartObject& params, bool use_events) { LOG4CXX_AUTO_TRACE(logger_); is_ui_send_ = true; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest( hmi_apis::FunctionID::UI_SetGlobalProperties, ¶ms, use_events); } diff --git a/src/components/application_manager/src/commands/mobile/set_icon_request.cc b/src/components/application_manager/src/commands/mobile/set_icon_request.cc index 85f34aead9..037de54456 100644 --- a/src/components/application_manager/src/commands/mobile/set_icon_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_icon_request.cc @@ -95,7 +95,7 @@ void SetIconRequest::Run() { // for further use in on_event function (*message_)[strings::msg_params][strings::sync_file_name] = msg_params[strings::sync_file_name]; - + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_SetAppIcon, &msg_params, true); } @@ -105,6 +105,7 @@ void SetIconRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetAppIcon: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); mobile_apis::Result::eType result_code = static_cast<mobile_apis::Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc index 1e0a00318d..54727abe01 100644 --- a/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc +++ b/src/components/application_manager/src/commands/mobile/set_media_clock_timer_request.cc @@ -71,6 +71,7 @@ void SetMediaClockRequest::Run() { // copy entirely msg msg_params = (*message_)[strings::msg_params]; msg_params[strings::app_id] = app->app_id(); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest( hmi_apis::FunctionID::UI_SetMediaClockTimer, &msg_params, true); @@ -85,6 +86,7 @@ void SetMediaClockRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_SetMediaClockTimer: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc index b1cc40009d..42bfea4864 100644 --- a/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc @@ -172,6 +172,7 @@ void ShowConstantTBTRequest::Run() { } app->set_tbt_show_command(msg_params); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); SendHMIRequest( hmi_apis::FunctionID::Navigation_ShowConstantTBT, &msg_params, true); } @@ -184,6 +185,7 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::Navigation_ShowConstantTBT: { LOG4CXX_INFO(logger_, "Received Navigation_ShowConstantTBT event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const Common_Result::eType result_code = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/show_request.cc b/src/components/application_manager/src/commands/mobile/show_request.cc index 5b8e98d7ea..ad598efc1d 100644 --- a/src/components/application_manager/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/src/commands/mobile/show_request.cc @@ -263,6 +263,7 @@ void ShowRequest::Run() { (*message_)[strings::msg_params][strings::custom_presets]; } + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_Show, &msg_params, true); MessageSharedPtr persistentData = new smart_objects::SmartObject(msg_params); @@ -278,6 +279,7 @@ void ShowRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::UI_Show: { LOG4CXX_DEBUG(logger_, "Received UI_Show event."); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); std::string response_info; hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc index 054d0ec16d..f98869b08f 100644 --- a/src/components/application_manager/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/src/commands/mobile/slider_request.cc @@ -107,6 +107,7 @@ void SliderRequest::Run() { msg_params[strings::timeout] = default_timeout_; } + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); SendHMIRequest(hmi_apis::FunctionID::UI_Slider, &msg_params, true); } @@ -132,7 +133,7 @@ void SliderRequest::on_event(const event_engine::Event& event) { } LOG4CXX_DEBUG(logger_, "Received UI_Slider event"); - + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); const Common_Result::eType response_code = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/commands/mobile/speak_request.cc b/src/components/application_manager/src/commands/mobile/speak_request.cc index 6cbb762102..1954cde181 100644 --- a/src/components/application_manager/src/commands/mobile/speak_request.cc +++ b/src/components/application_manager/src/commands/mobile/speak_request.cc @@ -72,6 +72,7 @@ void SpeakRequest::Run() { (*message_)[strings::msg_params][strings::app_id] = app->app_id(); (*message_)[strings::msg_params][hmi_request::speak_type] = hmi_apis::Common_MethodName::SPEAK; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); SendHMIRequest(hmi_apis::FunctionID::TTS_Speak, &message_->getElement(strings::msg_params), true); @@ -82,7 +83,7 @@ void SpeakRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::TTS_Speak: { LOG4CXX_INFO(logger_, "Received TTS_Speak event"); - + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_TTS); ProcessTTSSpeakResponse(event.smart_object()); break; } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc index fc839a43f4..28cf4c754c 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc @@ -149,6 +149,7 @@ void SubscribeVehicleDataRequest::Run() { ++it) SendHMIRequest(it->func_id, &msg_params, true); #else + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData, &msg_params, true); @@ -165,7 +166,7 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { LOG4CXX_ERROR(logger_, "Received unknown event."); return; } - + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); @@ -250,6 +251,15 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { result_code = mobile_apis::Result::IGNORED; response_info = "Already subscribed on some provided VehicleData."; } + + if (!vi_waiting_for_subscribe_.empty()) { + LOG4CXX_DEBUG(logger_, "Subscribing to all pending VehicleData"); + VehicleInfoSubscriptions::const_iterator key = + vi_waiting_for_subscribe_.begin(); + for (; key != vi_waiting_for_subscribe_.end(); ++key) { + app->SubscribeToIVI(*key); + } + } } UnsubscribeFailedSubscriptions(app, message[strings::msg_params]); @@ -276,20 +286,33 @@ void SubscribeVehicleDataRequest::AddAlreadySubscribedVI( smart_objects::SmartObject& msg_params) const { LOG4CXX_AUTO_TRACE(logger_); using namespace mobile_apis; + auto vi_to_string = + [](const mobile_apis::VehicleDataType::eType vehicle_data) { + for (auto& vi_str_to_int_pair : MessageHelper::vehicle_data()) { + if (vehicle_data == vi_str_to_int_pair.second) { + return vi_str_to_int_pair.first; + } + } + return std::string(); + }; + VehicleInfoSubscriptions::const_iterator it_same_app = vi_already_subscribed_by_this_app_.begin(); for (; vi_already_subscribed_by_this_app_.end() != it_same_app; ++it_same_app) { - msg_params[*it_same_app][strings::result_code] = + msg_params[vi_to_string(*it_same_app)][strings::result_code] = VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED; + msg_params[vi_to_string(*it_same_app)][strings::data_type] = *it_same_app; } VehicleInfoSubscriptions::const_iterator it_another_app = vi_already_subscribed_by_another_apps_.begin(); for (; vi_already_subscribed_by_another_apps_.end() != it_another_app; ++it_another_app) { - msg_params[*it_another_app][strings::result_code] = + msg_params[vi_to_string(*it_another_app)][strings::result_code] = VehicleDataResultCode::VDRC_SUCCESS; + msg_params[vi_to_string(*it_another_app)][strings::data_type] = + *it_another_app; } } @@ -366,7 +389,7 @@ void SubscribeVehicleDataRequest::CheckVISubscribtions( ++items_to_subscribe; } if (!is_interface_not_available && is_key_enabled) { - VehicleDataType key_type = it->second; + mobile_apis::VehicleDataType::eType key_type = it->second; if (app->IsSubscribedToIVI(key_type)) { LOG4CXX_DEBUG(logger_, "App with connection key " @@ -407,12 +430,13 @@ void SubscribeVehicleDataRequest::CheckVISubscribtions( out_request_params[key_name] = is_key_enabled; - if (app->SubscribeToIVI(static_cast<uint32_t>(key_type))) { + if (is_key_enabled) { + vi_waiting_for_subscribe_.insert(key_type); LOG4CXX_DEBUG( logger_, "App with connection key " << connection_key() - << " have been subscribed for VehicleDataType: " << key_type); + << " will be subscribed for VehicleDataType: " << key_type); ++subscribed_items; } } diff --git a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc index 0e0d760228..8195697dfc 100644 --- a/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/subscribe_way_points_request.cc @@ -25,17 +25,18 @@ void SubscribeWayPointsRequest::Run() { return; } - if (application_manager_.IsAppSubscribedForWayPoints(app->app_id())) { + if (application_manager_.IsAppSubscribedForWayPoints(app)) { SendResponse(false, mobile_apis::Result::IGNORED); return; } if (application_manager_.IsAnyAppSubscribedForWayPoints()) { - application_manager_.SubscribeAppForWayPoints(app->app_id()); + application_manager_.SubscribeAppForWayPoints(app); SendResponse(true, mobile_apis::Result::SUCCESS); return; } + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); SendHMIRequest( hmi_apis::FunctionID::Navigation_SubscribeWayPoints, NULL, true); } @@ -47,6 +48,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::Navigation_SubscribeWayPoints: { LOG4CXX_INFO(logger_, "Received Navigation_SubscribeWayPoints event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -55,7 +57,7 @@ void SubscribeWayPointsRequest::on_event(const event_engine::Event& event) { const bool result = PrepareResultForMobileResponse( result_code, HmiInterfaces::HMI_INTERFACE_Navigation); if (result) { - application_manager_.SubscribeAppForWayPoints(app->app_id()); + application_manager_.SubscribeAppForWayPoints(app); } SendResponse(result, MessageHelper::HMIToMobileResult(result_code), diff --git a/src/components/application_manager/src/commands/mobile/system_request.cc b/src/components/application_manager/src/commands/mobile/system_request.cc index e4706441ef..fe38b93732 100644 --- a/src/components/application_manager/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/src/commands/mobile/system_request.cc @@ -535,19 +535,8 @@ void SystemRequest::Run() { if (!file || !file->is_download_complete || !file_system::MoveFile(app_full_file_path, file_dst_path)) { LOG4CXX_DEBUG(logger_, "Binary data not found."); - - std::string origin_file_name; - if ((*message_)[strings::msg_params].keyExists(strings::file_name)) { - origin_file_name = - (*message_)[strings::msg_params][strings::file_name].asString(); - } - if (!(mobile_apis::RequestType::HTTP == request_type && - 0 == origin_file_name.compare(kIVSU))) { - LOG4CXX_DEBUG(logger_, "Binary data required. Invalid data"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - LOG4CXX_DEBUG(logger_, "IVSU does not require binary data. Continue"); + SendResponse(false, mobile_apis::Result::REJECTED); + return; } processing_file_ = file_dst_path; } @@ -598,6 +587,7 @@ void SystemRequest::Run() { msg_params[strings::request_type] = (*message_)[strings::msg_params][strings::request_type]; + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_SystemRequest, &msg_params, true); @@ -611,6 +601,7 @@ void SystemRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::BasicCommunication_SystemRequest: { + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_BasicCommunication); mobile_apis::Result::eType result_code = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asUInt())); diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc index 739135d19e..d6ad928bf7 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc @@ -134,7 +134,7 @@ void UnsubscribeVehicleDataRequest::Run() { if (is_key_enabled) { ++items_to_unsubscribe; - VehicleDataType key_type = it->second; + mobile_apis::VehicleDataType::eType key_type = it->second; if (!app->IsSubscribedToIVI(key_type)) { ++unsubscribed_items; vi_already_unsubscribed_by_this_app_.insert(key_type); @@ -234,6 +234,7 @@ void UnsubscribeVehicleDataRequest::Run() { ++it) SendHMIRequest(it->func_id, &msg_params, true); #else + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData, &msg_params, true); @@ -250,6 +251,7 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) { LOG4CXX_ERROR(logger_, "Received unknown event."); return; } + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VehicleInfo); ApplicationSharedPtr app = application_manager_.application(CommandRequestImpl::connection_key()); diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc index 953bbc7a12..dc3404c022 100644 --- a/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc +++ b/src/components/application_manager/src/commands/mobile/unsubscribe_way_points_request.cc @@ -25,11 +25,12 @@ void UnSubscribeWayPointsRequest::Run() { return; } - if (!application_manager_.IsAppSubscribedForWayPoints(app->app_id())) { + if (!application_manager_.IsAppSubscribedForWayPoints(app)) { SendResponse(false, mobile_apis::Result::IGNORED); return; } + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); SendHMIRequest( hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints, NULL, true); } @@ -41,6 +42,7 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints: { LOG4CXX_INFO(logger_, "Received Navigation_UnSubscribeWayPoints event"); + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); @@ -49,7 +51,7 @@ void UnSubscribeWayPointsRequest::on_event(const event_engine::Event& event) { const bool result = PrepareResultForMobileResponse( result_code, HmiInterfaces::HMI_INTERFACE_Navigation); if (result) { - application_manager_.UnsubscribeAppFromWayPoints(app->app_id()); + application_manager_.UnsubscribeAppFromWayPoints(app); } SendResponse(result, MessageHelper::HMIToMobileResult(result_code), diff --git a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc index becab175e9..44fe9d0d07 100644 --- a/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc +++ b/src/components/application_manager/src/commands/mobile/update_turn_list_request.cc @@ -138,6 +138,7 @@ void UpdateTurnListRequest::Run() { if ((*message_)[strings::msg_params].keyExists(strings::turn_list) || (*message_)[strings::msg_params].keyExists(strings::soft_buttons)) { + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); SendHMIRequest( hmi_apis::FunctionID::Navigation_UpdateTurnList, &msg_params, true); } else { @@ -154,7 +155,7 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) { switch (event.id()) { case hmi_apis::FunctionID::Navigation_UpdateTurnList: { LOG4CXX_INFO(logger_, "Received Navigation_UpdateTurnList event"); - + EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_Navigation); const hmi_apis::Common_Result::eType result_code = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); diff --git a/src/components/application_manager/src/helpers/application_helper.cc b/src/components/application_manager/src/helpers/application_helper.cc new file mode 100644 index 0000000000..16b49faa2a --- /dev/null +++ b/src/components/application_manager/src/helpers/application_helper.cc @@ -0,0 +1,146 @@ +#include <vector> +#include <string> +#include "application_manager/helpers/application_helper.h" +#include "application_manager/message_helper.h" +#include "utils/logger.h" +#include "utils/file_system.h" + +namespace { +using namespace application_manager; +void DeleteWayPoints(ApplicationSharedPtr app, + ApplicationManager& app_manager) { + app_manager.UnsubscribeAppFromWayPoints(app); + if (!app_manager.IsAnyAppSubscribedForWayPoints()) { + MessageHelper::SendUnsubscribedWayPoints(app_manager); + } +} + +void DeleteCommands(ApplicationSharedPtr app, ApplicationManager& app_manager) { + CommandsMap cmap = app->commands_map().GetData(); + + for (auto cmd : cmap) { + MessageHelper::SendDeleteCommandRequest(cmd.second, app, app_manager); + app->RemoveCommand(cmd.first); + } +} + +void DeleteSubmenus(ApplicationSharedPtr app, ApplicationManager& app_manager) { + SubMenuMap smap = app->sub_menu_map().GetData(); + + for (auto smenu : smap) { + MessageHelper::SendDeleteSubmenuRequest(smenu.second, app, app_manager); + app->RemoveSubMenu(smenu.first); + } +} + +void DeleteChoiceSets(ApplicationSharedPtr app, + ApplicationManager& app_manager) { + ChoiceSetMap csmap = app->choice_set_map().GetData(); + + for (auto choice : csmap) { + MessageHelper::SendDeleteChoiceSetRequest(choice.second, app, app_manager); + app->RemoveChoiceSet(choice.first); + } +} + +void DeleteGlobalProperties(ApplicationSharedPtr app, + ApplicationManager& app_manager) { + using namespace smart_objects; + + const std::vector<std::string>& timeout_prompt = + app_manager.get_settings().time_out_promt(); + + SmartObject so_default_timeout_prompt = SmartObject(SmartType_Array); + + int32_t index = 0; + for (auto prompt : timeout_prompt) { + SmartObject timeoutPrompt = SmartObject(SmartType_Map); + timeoutPrompt[strings::text] = timeout_prompt[static_cast<size_t>(index)]; + timeoutPrompt[strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT; + so_default_timeout_prompt[index] = timeoutPrompt; + ++index; + } + + app->set_timeout_prompt(so_default_timeout_prompt); + + SmartObject empty_so = SmartObject(SmartType_Array); + app->set_help_prompt(empty_so); + app->reset_vr_help_title(); + app->reset_vr_help(); + app->set_keyboard_props(empty_so); + app->set_menu_icon(empty_so); + app->set_menu_title(empty_so); + + MessageHelper::SendResetPropertiesRequest(app, app_manager); +} + +void DeleteButtonSubscriptions(ApplicationSharedPtr app, + ApplicationManager& app_manager) { + ButtonSubscriptions buttons = app->SubscribedButtons().GetData(); + + for (auto button : buttons) { + if (mobile_apis::ButtonName::CUSTOM_BUTTON == button) { + continue; + } + MessageHelper::SendUnsubscribeButtonNotification(button, app, app_manager); + app->UnsubscribeFromButton(button); + } +} + +void DeleteVISubscriptions(ApplicationSharedPtr app, + ApplicationManager& app_manager) { + VehicleInfoSubscriptions ivi = app->SubscribedIVI().GetData(); + + for (auto i : ivi) { + app->UnsubscribeFromIVI(i); + SubscribedToIVIPredicate p(i); + auto app = FindApp(app_manager.applications(), p); + if (!app) { + MessageHelper::SendUnsubscribeIVIRequest(i, app, app_manager); + } + } +} + +void CleanupAppFiles(ApplicationSharedPtr app) { + const auto icon_file = app->app_icon_path(); + + auto files = app->getAppFiles(); + for (auto file : files) { + auto file_name = file.first; + if (icon_file == file_name) { + continue; + } + app->DeleteFile(file_name); + file_system::DeleteFile(file_name); + } +} +} // namespace + +namespace application_manager { + +CREATE_LOGGERPTR_GLOBAL(logger, "ApplicationManager") + +SubscribedToIVIPredicate::SubscribedToIVIPredicate(uint32_t vehicle_info) + : vehicle_info_(vehicle_info) {} + +bool SubscribedToIVIPredicate::operator()( + const ApplicationSharedPtr app) const { + return app ? app->IsSubscribedToIVI(vehicle_info_) : false; +} + +void DeleteApplicationData(ApplicationSharedPtr app, + ApplicationManager& app_manager) { + LOG4CXX_AUTO_TRACE(logger); + DCHECK_OR_RETURN_VOID(app); + + DeleteWayPoints(app, app_manager); + DeleteCommands(app, app_manager); + DeleteSubmenus(app, app_manager); + DeleteChoiceSets(app, app_manager); + DeleteGlobalProperties(app, app_manager); + DeleteButtonSubscriptions(app, app_manager); + DeleteVISubscriptions(app, app_manager); + CleanupAppFiles(app); +} + +} // namespace application_manager diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc index ffaa8d9b5f..a7f3ce7e6b 100644 --- a/src/components/application_manager/src/hmi_command_factory.cc +++ b/src/components/application_manager/src/hmi_command_factory.cc @@ -269,6 +269,7 @@ #include "application_manager/commands/hmi/on_system_error_notification.h" #include "application_manager/commands/hmi/basic_communication_system_request.h" #include "application_manager/commands/hmi/basic_communication_system_response.h" +#include "application_manager/commands/hmi/basic_communication_on_awake_sdl.h" #include "application_manager/commands/hmi/sdl_policy_update.h" #include "application_manager/commands/hmi/sdl_policy_update_response.h" #include "application_manager/commands/hmi/on_received_policy_update.h" @@ -781,6 +782,11 @@ CommandSharedPtr HMICommandFactory::CreateCommand( message, application_manager)); break; } + case hmi_apis::FunctionID::BasicCommunication_OnAwakeSDL: { + command.reset( + new commands::OnAwakeSDLNotification(message, application_manager)); + break; + } case hmi_apis::FunctionID::BasicCommunication_OnExitApplication: { command.reset(new commands::OnExitApplicationNotification( message, application_manager)); diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index 393a9d7784..bc1ccd8f42 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -37,47 +37,65 @@ namespace application_manager { -HmiState::HmiState(uint32_t app_id, +HmiState::HmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr, StateID state_id) - : app_id_(app_id) + : app_(app) , state_id_(state_id) , app_mngr_(app_mngr) , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {} -HmiState::HmiState(uint32_t app_id, const ApplicationManager& app_mngr) - : app_id_(app_id) +HmiState::HmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr) + : app_(app) , state_id_(STATE_ID_REGULAR) , app_mngr_(app_mngr) , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {} +DEPRECATED HmiState::HmiState(uint32_t app_id, + const ApplicationManager& app_mngr, + StateID state_id) + : state_id_(state_id) + , app_mngr_(app_mngr) + , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) + , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) + , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { + app_ = app_mngr_.application(app_id); +} + +DEPRECATED HmiState::HmiState(uint32_t app_id, + const ApplicationManager& app_mngr) + : state_id_(STATE_ID_REGULAR) + , app_mngr_(app_mngr) + , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM) + , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM) + , system_context_(mobile_apis::SystemContext::INVALID_ENUM) { + app_ = app_mngr_.application(app_id); +} + void HmiState::set_parent(HmiStatePtr parent) { DCHECK_OR_RETURN_VOID(parent); parent_ = parent; } -bool HmiState::is_navi_app(const uint32_t app_id) const { - const ApplicationSharedPtr app = app_mngr_.application(app_id); - return app ? app->is_navi() : false; +bool HmiState::is_navi_app() const { + return app_->is_navi(); } -bool HmiState::is_media_app(const uint32_t app_id) const { - const ApplicationSharedPtr app = app_mngr_.application(app_id); - return app ? app->is_media_application() : false; +bool HmiState::is_media_app() const { + return app_->is_media_application(); } -bool HmiState::is_voice_communication_app(const uint32_t app_id) const { - const ApplicationSharedPtr app = app_mngr_.application(app_id); - return app ? app->is_voice_communication_supported() : false; +bool HmiState::is_voice_communication_app() const { + return app_->is_voice_communication_supported(); } -bool HmiState::is_mobile_projection_app(const uint32_t app_id) const { - const ApplicationSharedPtr app = app_mngr_.application(app_id); - return app ? app->mobile_projection_enabled() : false; +bool HmiState::is_mobile_projection_app() const { + return app_->mobile_projection_enabled(); } mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state() @@ -86,10 +104,20 @@ mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state() return AudioStreamingState::NOT_AUDIBLE; } -VRHmiState::VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr) +VRHmiState::VRHmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_VR_SESSION) {} + +DEPRECATED VRHmiState::VRHmiState(uint32_t app_id, + const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_VR_SESSION) {} -TTSHmiState::TTSHmiState(uint32_t app_id, const ApplicationManager& app_mngr) +TTSHmiState::TTSHmiState(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_TTS_SESSION) {} + +DEPRECATED TTSHmiState::TTSHmiState(uint32_t app_id, + const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_TTS_SESSION) {} mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state() @@ -107,8 +135,12 @@ mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state() return expected_state; } -NaviStreamingHmiState::NaviStreamingHmiState(uint32_t app_id, +NaviStreamingHmiState::NaviStreamingHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_NAVI_STREAMING) {} + +DEPRECATED NaviStreamingHmiState::NaviStreamingHmiState( + uint32_t app_id, const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_NAVI_STREAMING) {} mobile_apis::AudioStreamingState::eType @@ -117,7 +149,7 @@ NaviStreamingHmiState::audio_streaming_state() const { using namespace mobile_apis; AudioStreamingState::eType expected_state = parent()->audio_streaming_state(); - if (!is_navi_app(app_id_) && AudioStreamingState::AUDIBLE == expected_state) { + if (!is_navi_app() && AudioStreamingState::AUDIBLE == expected_state) { if (app_mngr_.is_attenuated_supported()) { expected_state = AudioStreamingState::ATTENUATED; } else { @@ -127,8 +159,12 @@ NaviStreamingHmiState::audio_streaming_state() const { return expected_state; } -PhoneCallHmiState::PhoneCallHmiState(uint32_t app_id, +PhoneCallHmiState::PhoneCallHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {} + +DEPRECATED PhoneCallHmiState::PhoneCallHmiState( + uint32_t app_id, const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_PHONE_CALL) {} mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { @@ -139,21 +175,29 @@ mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { HMILevel::HMI_NONE)) { return parent()->hmi_level(); } - if (is_navi_app(app_id_) || is_mobile_projection_app(app_id_)) { + if (is_navi_app() || is_mobile_projection_app()) { return HMILevel::HMI_LIMITED; } - if (!is_media_app(app_id_)) { + if (!is_media_app()) { return parent()->hmi_level(); } return HMILevel::HMI_BACKGROUND; } -SafetyModeHmiState::SafetyModeHmiState(uint32_t app_id, +SafetyModeHmiState::SafetyModeHmiState(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_SAFETY_MODE) {} + +DEPRECATED SafetyModeHmiState::SafetyModeHmiState( + uint32_t app_id, const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_SAFETY_MODE) {} -DeactivateHMI::DeactivateHMI(uint32_t app_id, +DeactivateHMI::DeactivateHMI(utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_DEACTIVATE_HMI) {} + +DEPRECATED DeactivateHMI::DeactivateHMI(uint32_t app_id, + const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_DEACTIVATE_HMI) {} mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { @@ -167,7 +211,12 @@ mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { return HMILevel::HMI_BACKGROUND; } -AudioSource::AudioSource(uint32_t app_id, const ApplicationManager& app_mngr) +AudioSource::AudioSource(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE) {} + +DEPRECATED AudioSource::AudioSource(uint32_t app_id, + const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_AUDIO_SOURCE) {} mobile_apis::HMILevel::eType AudioSource::hmi_level() const { @@ -181,13 +230,18 @@ mobile_apis::HMILevel::eType AudioSource::hmi_level() const { HMILevel::HMI_NONE)) { return parent()->hmi_level(); } - if (is_navi_app(app_id_) || is_voice_communication_app(app_id_)) { + if (is_navi_app() || is_voice_communication_app()) { return HMILevel::HMI_LIMITED; } return HMILevel::HMI_BACKGROUND; } -EmbeddedNavi::EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr) +EmbeddedNavi::EmbeddedNavi(utils::SharedPtr<Application> app, + const ApplicationManager& app_mngr) + : HmiState(app, app_mngr, STATE_ID_EMBEDDED_NAVI) {} + +DEPRECATED EmbeddedNavi::EmbeddedNavi(uint32_t app_id, + const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_EMBEDDED_NAVI) {} mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const { @@ -198,7 +252,7 @@ mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const { HMILevel::HMI_NONE)) { return parent()->hmi_level(); } - if (is_media_app(app_id_)) { + if (is_media_app()) { return HMILevel::HMI_LIMITED; } return HMILevel::HMI_BACKGROUND; diff --git a/src/components/application_manager/src/message.cc b/src/components/application_manager/src/message.cc index b211b270b8..7bc686aef1 100644 --- a/src/components/application_manager/src/message.cc +++ b/src/components/application_manager/src/message.cc @@ -89,7 +89,7 @@ Message& Message::operator=(const Message& message) { set_data_size(message.data_size_); set_payload_size(message.payload_size_); if (message.binary_data_) { - set_binary_data(message.binary_data_); + set_binary_data(static_cast<const BinaryData*>(message.binary_data_)); } set_json_message(message.json_message_); set_protocol_version(message.protocol_version()); @@ -207,6 +207,19 @@ void Message::set_binary_data(BinaryData* data) { binary_data_ = new BinaryData(*data); } +void Message::set_binary_data(const BinaryData* data) { + if (NULL == data) { + NOTREACHED(); + return; + } + + if (binary_data_) { + delete binary_data_; + } + + binary_data_ = new BinaryData(*data); +} + void Message::set_json_message(const std::string& json_message) { json_message_ = json_message; } diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 40afa5822c..f544b5161e 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -42,6 +42,7 @@ #include <algorithm> #include <utility> #include <map> +#include <functional> #include "application_manager/application.h" #include "application_manager/application_manager.h" @@ -158,37 +159,60 @@ struct ExternalConsentStatusAppender } // namespace -std::pair<std::string, VehicleDataType> kVehicleDataInitializer[] = { - std::make_pair(strings::gps, GPS), - std::make_pair(strings::speed, SPEED), - std::make_pair(strings::rpm, RPM), - std::make_pair(strings::fuel_level, FUELLEVEL), - std::make_pair(strings::fuel_level_state, FUELLEVEL_STATE), - std::make_pair(strings::instant_fuel_consumption, FUELCONSUMPTION), - std::make_pair(strings::external_temp, EXTERNTEMP), - std::make_pair(strings::vin, VIN), - std::make_pair(strings::prndl, PRNDL), - std::make_pair(strings::tire_pressure, TIREPRESSURE), - std::make_pair(strings::odometer, ODOMETER), - std::make_pair(strings::belt_status, BELTSTATUS), - std::make_pair(strings::body_information, BODYINFO), - std::make_pair(strings::device_status, DEVICESTATUS), - std::make_pair(strings::driver_braking, BRAKING), - std::make_pair(strings::wiper_status, WIPERSTATUS), - std::make_pair(strings::head_lamp_status, HEADLAMPSTATUS), - std::make_pair(strings::e_call_info, ECALLINFO), - std::make_pair(strings::airbag_status, AIRBAGSTATUS), - std::make_pair(strings::emergency_event, EMERGENCYEVENT), - std::make_pair(strings::cluster_mode_status, CLUSTERMODESTATUS), - std::make_pair(strings::my_key, MYKEY), +std::pair<std::string, + mobile_apis::VehicleDataType::eType> kVehicleDataInitializer[] = { + std::make_pair(strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_GPS), + std::make_pair(strings::speed, + mobile_apis::VehicleDataType::VEHICLEDATA_SPEED), + std::make_pair(strings::rpm, mobile_apis::VehicleDataType::VEHICLEDATA_RPM), + std::make_pair(strings::fuel_level, + mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL), + std::make_pair(strings::fuel_level_state, + mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL_STATE), + std::make_pair(strings::instant_fuel_consumption, + mobile_apis::VehicleDataType::VEHICLEDATA_FUELCONSUMPTION), + std::make_pair(strings::external_temp, + mobile_apis::VehicleDataType::VEHICLEDATA_EXTERNTEMP), + std::make_pair(strings::vin, mobile_apis::VehicleDataType::VEHICLEDATA_VIN), + std::make_pair(strings::prndl, + mobile_apis::VehicleDataType::VEHICLEDATA_PRNDL), + std::make_pair(strings::tire_pressure, + mobile_apis::VehicleDataType::VEHICLEDATA_TIREPRESSURE), + std::make_pair(strings::odometer, + mobile_apis::VehicleDataType::VEHICLEDATA_ODOMETER), + std::make_pair(strings::belt_status, + mobile_apis::VehicleDataType::VEHICLEDATA_BELTSTATUS), + std::make_pair(strings::body_information, + mobile_apis::VehicleDataType::VEHICLEDATA_BODYINFO), + std::make_pair(strings::device_status, + mobile_apis::VehicleDataType::VEHICLEDATA_DEVICESTATUS), + std::make_pair(strings::driver_braking, + mobile_apis::VehicleDataType::VEHICLEDATA_BRAKING), + std::make_pair(strings::wiper_status, + mobile_apis::VehicleDataType::VEHICLEDATA_WIPERSTATUS), + std::make_pair(strings::head_lamp_status, + mobile_apis::VehicleDataType::VEHICLEDATA_HEADLAMPSTATUS), + std::make_pair(strings::e_call_info, + mobile_apis::VehicleDataType::VEHICLEDATA_ECALLINFO), + std::make_pair(strings::airbag_status, + mobile_apis::VehicleDataType::VEHICLEDATA_AIRBAGSTATUS), + std::make_pair(strings::emergency_event, + mobile_apis::VehicleDataType::VEHICLEDATA_EMERGENCYEVENT), + std::make_pair(strings::cluster_mode_status, + mobile_apis::VehicleDataType::VEHICLEDATA_CLUSTERMODESTATUS), + std::make_pair(strings::my_key, + mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY), /* NOT DEFINED in mobile API std::make_pair(strings::gps, BATTVOLTAGE), */ - std::make_pair(strings::engine_torque, ENGINETORQUE), - std::make_pair(strings::acc_pedal_pos, ACCPEDAL), - std::make_pair(strings::steering_wheel_angle, STEERINGWHEEL), + std::make_pair(strings::engine_torque, + mobile_apis::VehicleDataType::VEHICLEDATA_ENGINETORQUE), + std::make_pair(strings::acc_pedal_pos, + mobile_apis::VehicleDataType::VEHICLEDATA_ACCPEDAL), + std::make_pair(strings::steering_wheel_angle, + mobile_apis::VehicleDataType::VEHICLEDATA_STEERINGWHEEL), }; const VehicleData MessageHelper::vehicle_data_( @@ -287,21 +311,20 @@ std::string MessageHelper::CommonLanguageToString( return std::string(); } -smart_objects::SmartObjectSPtr MessageHelper::CreateRequestObject( - const uint32_t correlation_id) { +smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI( + hmi_apis::messageType::eType message_type, const uint32_t correlation_id) { using namespace smart_objects; - SmartObjectSPtr request = utils::MakeShared<SmartObject>(SmartType_Map); - SmartObject& ref = *request; + SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObject& ref = *message; - ref[strings::params][strings::message_type] = - static_cast<int>(hmi_apis::messageType::request); + ref[strings::params][strings::message_type] = static_cast<int>(message_type); ref[strings::params][strings::protocol_version] = commands::CommandImpl::protocol_version_; ref[strings::params][strings::protocol_type] = commands::CommandImpl::hmi_protocol_type_; ref[strings::params][strings::correlation_id] = correlation_id; - return request; + return message; } smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification( @@ -321,8 +344,8 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification( void MessageHelper::SendDecryptCertificateToHMI(const std::string& file_name, ApplicationManager& app_mngr) { using namespace smart_objects; - SmartObjectSPtr message = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); DCHECK(message); SmartObject& object = *message; @@ -377,6 +400,253 @@ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( return notification; } +void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(cmd); + using namespace smart_objects; + SmartObject msg_params = SmartObject(smart_objects::SmartType_Map); + + msg_params[strings::cmd_id] = (*cmd)[strings::cmd_id]; + msg_params[strings::app_id] = application->app_id(); + + if ((*cmd).keyExists(strings::menu_params)) { + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::UI_DeleteCommand; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); + } + + if ((*cmd).keyExists(strings::vr_commands)) { + msg_params[strings::grammar_id] = application->get_grammar_id(); + msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; + + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::VR_DeleteCommand; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); + } +} + +void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(cmd); + using namespace smart_objects; + + SmartObject msg_params = SmartObject(smart_objects::SmartType_Map); + + msg_params[strings::menu_id] = (*cmd)[strings::menu_id]; + msg_params[strings::app_id] = application->app_id(); + + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::UI_DeleteSubMenu; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); + + const DataAccessor<CommandsMap> accessor = application->commands_map(); + const CommandsMap& commands = accessor.GetData(); + CommandsMap::const_iterator it = commands.begin(); + + for (; commands.end() != it; ++it) { + if (!(*it->second).keyExists(strings::vr_commands)) { + continue; + } + + if ((*cmd)[strings::menu_id].asInt() == + (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) { + SmartObject msg_params = SmartObject(smart_objects::SmartType_Map); + msg_params[strings::cmd_id] = (*it->second)[strings::cmd_id].asInt(); + msg_params[strings::app_id] = application->app_id(); + msg_params[strings::grammar_id] = application->get_grammar_id(); + msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; + + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::VR_DeleteCommand; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); + } + } +} + +void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + LOG4CXX_AUTO_TRACE(logger_); + DCHECK_OR_RETURN_VOID(cmd); + using namespace smart_objects; + + // Same is deleted with SendDeleteCommandRequest? + + SmartObject msg_params = SmartObject(smart_objects::SmartType_Map); + + msg_params[strings::app_id] = application->app_id(); + msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice; + msg_params[strings::grammar_id] = (*cmd)[strings::grammar_id]; + cmd = &((*cmd)[strings::choice_set]); + for (uint32_t i = 0; i < (*cmd).length(); ++i) { + msg_params[strings::cmd_id] = (*cmd)[i][strings::choice_id]; + + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::VR_DeleteCommand; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); + } +} + +void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + LOG4CXX_AUTO_TRACE(logger_); + using namespace smart_objects; + + { + SmartObject msg_params = SmartObject(smart_objects::SmartType_Map); + + msg_params = *MessageHelper::CreateAppVrHelp(application); + msg_params[hmi_request::menu_title] = ""; + + smart_objects::SmartObject key_board_properties = + smart_objects::SmartObject(smart_objects::SmartType_Map); + key_board_properties[strings::language] = + static_cast<int32_t>(hmi_apis::Common_Language::EN_US); + key_board_properties[hmi_request::keyboard_layout] = + static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY); + + key_board_properties[hmi_request::auto_complete_text] = ""; + msg_params[hmi_request::keyboard_properties] = key_board_properties; + + msg_params[strings::app_id] = application->app_id(); + + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::UI_SetGlobalProperties; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); + } + + { + SmartObject msg_params = SmartObject(smart_objects::SmartType_Map); + + msg_params[strings::help_prompt] = application->help_prompt(); + msg_params[strings::timeout_prompt] = application->timeout_prompt(); + msg_params[strings::app_id] = application->app_id(); + + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::TTS_SetGlobalProperties; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); + } +} + +void MessageHelper::SendUnsubscribeButtonNotification( + mobile_apis::ButtonName::eType button, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + using namespace smart_objects; + using namespace hmi_apis; + + SmartObject msg_params = SmartObject(SmartType_Map); + msg_params[strings::app_id] = application->app_id(); + msg_params[strings::name] = button; + msg_params[strings::is_suscribed] = false; + + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::notification, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::Buttons_OnButtonSubscription; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); +} + +void MessageHelper::SendUnsubscribeIVIRequest(int32_t ivi_id, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + using namespace smart_objects; + + std::string key_name; + for (auto item : vehicle_data_) { + if (ivi_id == item.second) { + key_name = item.first; + break; + } + } + + if (key_name.empty()) { + return; + } + + smart_objects::SmartObject msg_params = + smart_objects::SmartObject(smart_objects::SmartType_Map); + msg_params[key_name] = true; + + SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); + DCHECK(message); + + SmartObject& object = *message; + object[strings::params][strings::function_id] = + hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData; + + object[strings::msg_params] = msg_params; + + app_mngr.ManageHMICommand(message); +} + const VehicleData& MessageHelper::vehicle_data() { return vehicle_data_; } @@ -829,7 +1099,7 @@ smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests( const VehicleInfoSubscriptions& subscriptions = vi_accessor.GetData(); for (; vehicle_data.end() != ivi_it; ++ivi_it) { - uint32_t type_id = static_cast<int>(ivi_it->second); + mobile_apis::VehicleDataType::eType type_id = ivi_it->second; if (subscriptions.end() != subscriptions.find(type_id)) { std::string key_name = ivi_it->first; msg_params[key_name] = true; @@ -927,7 +1197,9 @@ void MessageHelper::SendSetAppIcon( using namespace smart_objects; SmartObjectSPtr set_app_icon = - CreateRequestObject(application_manager.GetNextHMICorrelationID()); + CreateMessageForHMI(hmi_apis::messageType::request, + application_manager.GetNextHMICorrelationID()); + if (set_app_icon) { SmartObject& so_to_send = *set_app_icon; so_to_send[strings::params][strings::function_id] = @@ -986,7 +1258,7 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( if (app->vr_help_title() || app->vr_help()) { smart_objects::SmartObjectSPtr ui_global_properties = - CreateRequestObject(correlation_id); + CreateMessageForHMI(hmi_apis::messageType::request, correlation_id); if (!ui_global_properties) { return requests; } @@ -1021,7 +1293,7 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( // TTS global properties if (app->help_prompt() || app->timeout_prompt()) { smart_objects::SmartObjectSPtr tts_global_properties = - CreateRequestObject(correlation_id); + CreateMessageForHMI(hmi_apis::messageType::request, correlation_id); if (!tts_global_properties) { return requests; } @@ -1053,8 +1325,9 @@ void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app, if (!app) { return; } - smart_objects::SmartObjectSPtr tts_global_properties = - CreateRequestObject(app_man.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr tts_global_properties = CreateMessageForHMI( + hmi_apis::messageType::request, app_man.GetNextHMICorrelationID()); + if (tts_global_properties) { smart_objects::SmartObject& so_to_send = *tts_global_properties; so_to_send[strings::params][strings::function_id] = @@ -1132,7 +1405,7 @@ smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI( if (app->show_command()) { smart_objects::SmartObjectSPtr ui_show = - CreateRequestObject(correlation_id); + CreateMessageForHMI(hmi_apis::messageType::request, correlation_id); (*ui_show)[strings::params][strings::function_id] = static_cast<int>(hmi_apis::FunctionID::UI_Show); @@ -1164,8 +1437,8 @@ void MessageHelper::SendShowConstantTBTRequestToHMI( } if (app->tbt_show_command()) { - smart_objects::SmartObjectSPtr navi_show_tbt = - CreateRequestObject(app_man.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr navi_show_tbt = CreateMessageForHMI( + hmi_apis::messageType::request, app_man.GetNextHMICorrelationID()); if (!navi_show_tbt) { return; } @@ -1205,8 +1478,8 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI( for (; commands.end() != i; ++i) { // UI Interface if ((*i->second).keyExists(strings::menu_params)) { - smart_objects::SmartObjectSPtr ui_command = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr ui_command = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!ui_command) { return requests; } @@ -1258,8 +1531,8 @@ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI( (*(it->second))[strings::grammar_id].asUInt(); const size_t size = (*(it->second))[strings::choice_set].length(); for (size_t j = 0; j < size; ++j) { - smart_objects::SmartObjectSPtr vr_command = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr vr_command = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!vr_command) { return requests; } @@ -1292,8 +1565,8 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration( const uint32_t app_id, const smart_objects::SmartObject* app_types, ApplicationManager& app_mngr) { - smart_objects::SmartObjectSPtr command = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr command = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!command) { return NULL; } @@ -1349,8 +1622,8 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI( const smart_objects::SmartObject& vr_commands, uint32_t app_id, ApplicationManager& app_mngr) { - smart_objects::SmartObjectSPtr vr_command = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr vr_command = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!vr_command) { return NULL; } @@ -1469,7 +1742,7 @@ smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI( SubMenuMap::const_iterator i = sub_menu.begin(); for (; sub_menu.end() != i; ++i) { smart_objects::SmartObjectSPtr ui_sub_menu = - CreateRequestObject(correlation_id); + CreateMessageForHMI(hmi_apis::messageType::request, correlation_id); if (!ui_sub_menu) { return requsets; } @@ -1508,7 +1781,7 @@ void MessageHelper::SendOnAppUnregNotificationToHMI( message[strings::params][strings::message_type] = MessageType::kNotification; // we put hmi_app_id because applicaton list does not contain application on // this momment - // and ReplaceHMIByMobileAppId function will be unable to replace app_id to + // and ReplaceHMIWithMobileAppId function will be unable to replace app_id to // hmi_app_id message[strings::msg_params][strings::app_id] = app->hmi_app_id(); message[strings::msg_params][strings::unexpected_disconnect] = @@ -1658,8 +1931,8 @@ void MessageHelper::SendPolicyUpdate(const std::string& file_path, const uint32_t timeout, const std::vector<int>& retries, ApplicationManager& app_mngr) { - smart_objects::SmartObjectSPtr message = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); smart_objects::SmartObject& object = *message; object[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_PolicyUpdate; @@ -1840,8 +2113,8 @@ void MessageHelper::SendNaviSetVideoConfig( ApplicationManager& app_mngr, const smart_objects::SmartObject& video_params) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr request = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr request = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!request) { return; } @@ -1858,8 +2131,8 @@ void MessageHelper::SendNaviSetVideoConfig( void MessageHelper::SendNaviStartStream(const int32_t app_id, ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr start_stream = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr start_stream = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!start_stream) { return; } @@ -1897,8 +2170,8 @@ void MessageHelper::SendNaviStartStream(const int32_t app_id, void MessageHelper::SendNaviStopStream(const int32_t app_id, ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr stop_stream = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr stop_stream = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!stop_stream) { return; } @@ -1914,8 +2187,8 @@ void MessageHelper::SendNaviStopStream(const int32_t app_id, void MessageHelper::SendAudioStartStream(const int32_t app_id, ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr start_stream = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr start_stream = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!start_stream) { return; @@ -1954,8 +2227,8 @@ void MessageHelper::SendAudioStartStream(const int32_t app_id, void MessageHelper::SendAudioStopStream(const int32_t app_id, ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr stop_stream = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr stop_stream = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!stop_stream) { return; @@ -2004,8 +2277,8 @@ void MessageHelper::SendOnDataStreaming( bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) { LOG4CXX_INFO(logger_, "MessageHelper::SendAudioStopAudioPathThru"); - smart_objects::SmartObjectSPtr result = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr result = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); (*result)[strings::params][strings::function_id] = hmi_apis::FunctionID::UI_EndAudioPassThru; @@ -2016,8 +2289,8 @@ bool MessageHelper::SendStopAudioPathThru(ApplicationManager& app_mngr) { bool MessageHelper::SendUnsubscribedWayPoints(ApplicationManager& app_mngr) { LOG4CXX_INFO(logger_, "MessageHelper::SendUnsubscribedWayPoints"); - smart_objects::SmartObjectSPtr result = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr result = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); (*result)[strings::params][strings::function_id] = hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints; @@ -2376,8 +2649,8 @@ void MessageHelper::SendOnStatusUpdate(const std::string& status, } void MessageHelper::SendGetSystemInfoRequest(ApplicationManager& app_mngr) { - smart_objects::SmartObjectSPtr message = - CreateRequestObject(app_mngr.GetNextHMICorrelationID()); + smart_objects::SmartObjectSPtr message = CreateMessageForHMI( + hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID()); if (!message) { return; } diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc index a3b5aa7dbd..2f06c5f3b5 100644 --- a/src/components/application_manager/src/mobile_message_handler.cc +++ b/src/components/application_manager/src/mobile_message_handler.cc @@ -196,7 +196,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2( outgoing_message->set_payload_size(message->payload_size()); if (!payload.data.empty()) { - BinaryData binary_payload_data(payload.data); + const BinaryData binary_payload_data(payload.data); outgoing_message->set_binary_data(&binary_payload_data); } return outgoing_message.release(); diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index e6ebaf3b83..b6b208b39b 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -852,6 +852,13 @@ uint32_t PolicyHandler::ChooseRandomAppForPolicyUpdate( return 0; } +void PolicyHandler::OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) { + LOG4CXX_AUTO_TRACE(logger_); + POLICY_LIB_CHECK_VOID(); + policy_manager_->OnDeviceSwitching(device_id_from, device_id_to); +} + void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) { LOG4CXX_AUTO_TRACE(logger_); POLICY_LIB_CHECK_VOID(); @@ -1170,7 +1177,7 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( continue; } policy_manager_->SetUserConsentForDevice(device_id, is_allowed); - uint32_t device_handle = 0; + connection_handler::DeviceHandle device_handle = 0; if (!connection_handler.GetDeviceID(device_id, &device_handle)) { LOG4CXX_WARN(logger_, "Device handle with mac " << device_id @@ -1204,7 +1211,7 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( } // Case, when specific device was changed - uint32_t device_handle = 0u; + connection_handler::DeviceHandle device_handle = 0u; if (device_specific) { policy_manager_->SetUserConsentForDevice(device_mac, is_allowed); if (!connection_handler.GetDeviceID(device_mac, &device_handle)) { @@ -1768,7 +1775,7 @@ void PolicyHandler::OnCertificateUpdated(const std::string& certificate_data) { void PolicyHandler::OnPTUFinished(const bool ptu_result) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(listeners_lock_); - HandlersCollection::const_iterator it = listeners_.begin(); + std::for_each( listeners_.begin(), listeners_.end(), diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index e7788bf9ff..72f2246e7c 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -67,6 +67,7 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager) this, &ResumeCtrlImpl::SaveDataOnTimer)) , is_resumption_active_(false) , is_data_saved_(false) + , is_suspended_(false) , launch_time_(time(NULL)) , application_manager_(application_manager) {} #ifdef BUILD_TESTS @@ -263,16 +264,25 @@ bool ResumeCtrlImpl::RemoveApplicationFromSaved( void ResumeCtrlImpl::OnSuspend() { LOG4CXX_AUTO_TRACE(logger_); - StopSavePersistentDataTimer(); - SaveAllApplications(); - resumption_storage_->OnSuspend(); - resumption_storage_->Persist(); + is_suspended_ = true; + FinalPersistData(); +} + +void ResumeCtrlImpl::OnIgnitionOff() { + LOG4CXX_AUTO_TRACE(logger_); + resumption_storage_->IncrementIgnOffCount(); + FinalPersistData(); } void ResumeCtrlImpl::OnAwake() { + LOG4CXX_AUTO_TRACE(logger_); + is_suspended_ = false; ResetLaunchTime(); StartSavePersistentDataTimer(); - return resumption_storage_->OnAwake(); +} + +bool ResumeCtrlImpl::is_suspended() const { + return is_suspended_; } void ResumeCtrlImpl::StartSavePersistentDataTimer() { @@ -433,6 +443,13 @@ void ResumeCtrlImpl::SaveDataOnTimer() { } } +void ResumeCtrlImpl::FinalPersistData() { + LOG4CXX_AUTO_TRACE(logger_); + StopSavePersistentDataTimer(); + SaveAllApplications(); + resumption_storage_->Persist(); +} + bool ResumeCtrlImpl::IsDeviceMacAddressEqual( ApplicationSharedPtr application, const std::string& saved_device_mac) { LOG4CXX_AUTO_TRACE(logger_); @@ -580,7 +597,7 @@ void ResumeCtrlImpl::AddWayPointsSubscription( const smart_objects::SmartObject& subscribed_for_way_points_so = saved_app[strings::subscribed_for_way_points]; if (true == subscribed_for_way_points_so.asBool()) { - application_manager_.SubscribeAppForWayPoints(application->app_id()); + application_manager_.SubscribeAppForWayPoints(application); } } } @@ -609,9 +626,10 @@ void ResumeCtrlImpl::AddSubscriptions( if (subscribtions.keyExists(strings::application_vehicle_info)) { const smart_objects::SmartObject& subscribtions_ivi = subscribtions[strings::application_vehicle_info]; - VehicleDataType ivi; + mobile_apis::VehicleDataType::eType ivi; for (size_t i = 0; i < subscribtions_ivi.length(); ++i) { - ivi = static_cast<VehicleDataType>((subscribtions_ivi[i]).asInt()); + ivi = static_cast<mobile_apis::VehicleDataType::eType>( + (subscribtions_ivi[i]).asInt()); application->SubscribeToIVI(ivi); } ProcessHMIRequests(MessageHelper::GetIVISubscriptionRequests( @@ -773,7 +791,7 @@ void ResumeCtrlImpl::LoadResumeData() { "Resumption data for application " << app_id << " and device id " << device_id << " will be dropped."); - resumption_storage_->DropAppDataResumption(device_id, app_id); + resumption_storage_->RemoveApplicationFromSaved(app_id, device_id); continue; } } diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc index 273cd5413e..bd5bdbddab 100644 --- a/src/components/application_manager/src/resumption/resumption_data.cc +++ b/src/components/application_manager/src/resumption/resumption_data.cc @@ -33,7 +33,6 @@ #include "application_manager/resumption/resumption_data.h" #include "utils/logger.h" #include "application_manager/smart_object_keys.h" -#include "application_manager/vehicle_info_data.h" #include "application_manager/application_manager_settings.h" namespace resumption { diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc index 08de6d8190..b031fd0afd 100644 --- a/src/components/application_manager/src/resumption/resumption_data_db.cc +++ b/src/components/application_manager/src/resumption/resumption_data_db.cc @@ -212,7 +212,9 @@ uint32_t ResumptionDataDB::GetHMIApplicationID( return hmi_app_id; } -void ResumptionDataDB::OnSuspend() { +DEPRECATED void ResumptionDataDB::OnSuspend() {} + +void ResumptionDataDB::IncrementIgnOffCount() { LOG4CXX_AUTO_TRACE(logger_); utils::dbms::SQLQuery query_update_suspend_data(db()); @@ -291,7 +293,9 @@ bool ResumptionDataDB::GetHashId(const std::string& policy_app_id, return SelectHashId(policy_app_id, device_id, hash_id); } -void ResumptionDataDB::OnAwake() { +DEPRECATED void ResumptionDataDB::OnAwake() {} + +void ResumptionDataDB::DecrementIgnOffCount() { LOG4CXX_AUTO_TRACE(logger_); UpdateDataOnAwake(); @@ -2578,7 +2582,7 @@ bool ResumptionDataDB::InsertApplicationData( const mobile_apis::HMILevel::eType hmi_level = application.m_hmi_level; bool is_media_application = application.m_is_media_application; bool is_subscribed_for_way_points = - application_manager_.IsAppSubscribedForWayPoints(connection_key); + application_manager_.IsAppSubscribedForWayPoints(application.app_ptr); if (!query.Prepare(kInsertApplication)) { LOG4CXX_WARN(logger_, @@ -2804,6 +2808,7 @@ ApplicationParams::ApplicationParams(app_mngr::ApplicationSharedPtr application) m_hmi_app_id = application->hmi_app_id(); m_hmi_level = application->hmi_level(); m_is_media_application = application->IsAudioApplication(); + app_ptr = application; } } diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc index 7866fc4de1..e99d8bae26 100644 --- a/src/components/application_manager/src/resumption/resumption_data_json.cc +++ b/src/components/application_manager/src/resumption/resumption_data_json.cc @@ -66,7 +66,7 @@ void ResumptionDataJson::SaveApplication( const std::string device_mac = application->mac_address(); const mobile_apis::HMILevel::eType hmi_level = application->hmi_level(); const bool is_subscribed_for_way_points = - application_manager_.IsAppSubscribedForWayPoints(application->app_id()); + application_manager_.IsAppSubscribedForWayPoints(application); sync_primitives::AutoLock autolock(resumption_lock_); Json::Value tmp; @@ -143,11 +143,13 @@ uint32_t ResumptionDataJson::GetHMIApplicationID( return hmi_app_id; } -void ResumptionDataJson::OnSuspend() { +DEPRECATED void ResumptionDataJson::OnSuspend() {} + +void ResumptionDataJson::IncrementIgnOffCount() { using namespace app_mngr; LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock autolock(resumption_lock_); - Json::Value to_save; + Json::Value to_save = Json::arrayValue; for (Json::Value::iterator it = GetSavedApplications().begin(); it != GetSavedApplications().end(); ++it) { @@ -167,7 +169,9 @@ void ResumptionDataJson::OnSuspend() { LOG4CXX_DEBUG(logger_, GetResumptionData().toStyledString()); } -void ResumptionDataJson::OnAwake() { +DEPRECATED void ResumptionDataJson::OnAwake() {} + +void ResumptionDataJson::DecrementIgnOffCount() { using namespace app_mngr; LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock autolock(resumption_lock_); diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc index 5f318e6955..7a5008542c 100644 --- a/src/components/application_manager/src/resumption/resumption_sql_queries.cc +++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc @@ -212,7 +212,7 @@ const std::string kCreateSchema = "`vrHelpItemArray`(`idglobalProperties`); " "CREATE TABLE IF NOT EXISTS `application`( " " `idApplication` INTEGER PRIMARY KEY NOT NULL, " - " `appID` TEXT, " + " `appID` TEXT COLLATE NOCASE, " " `connection_key` INTEGER, " " `grammarID` INTEGER, " " `hashID` TEXT, " diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index b456ff6abb..84081a3830 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -123,7 +123,7 @@ void StateControllerImpl::SetRegularState( HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(hmi_level); hmi_state->set_audio_streaming_state(audio_state); @@ -144,7 +144,7 @@ void StateControllerImpl::SetRegularState( return; } const HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(hmi_level); @@ -166,7 +166,7 @@ void StateControllerImpl::SetRegularState( return; } HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(hmi_level); hmi_state->set_audio_streaming_state(audio_state); @@ -184,7 +184,7 @@ void StateControllerImpl::SetRegularState( } HmiStatePtr prev_state = app->RegularHmiState(); HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(hmi_level); hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level)); @@ -206,7 +206,7 @@ void StateControllerImpl::SetRegularState( HmiStatePtr prev_regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_regular); HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(prev_regular->hmi_level()); hmi_state->set_audio_streaming_state( @@ -227,7 +227,7 @@ void StateControllerImpl::SetRegularState( HmiStatePtr prev_state = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_state); HmiStatePtr hmi_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(hmi_state); hmi_state->set_hmi_level(prev_state->hmi_level()); hmi_state->set_audio_streaming_state(audio_state); @@ -325,7 +325,7 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app, << state->system_context()); HmiStatePtr available_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN(available_state, HmiStatePtr()); available_state->set_hmi_level(state->hmi_level()); available_state->set_audio_streaming_state(state->audio_streaming_state()); @@ -502,7 +502,7 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app, << ", system_context " << state->system_context()); HmiStatePtr curr_state = app->CurrentHmiState(); HmiStatePtr old_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(old_state); old_state->set_hmi_level(curr_state->hmi_level()); old_state->set_audio_streaming_state(curr_state->audio_streaming_state()); @@ -533,7 +533,7 @@ void StateControllerImpl::SetupRegularHmiState( HmiStatePtr prev_state = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(prev_state); HmiStatePtr new_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(new_state); new_state->set_hmi_level(hmi_level); new_state->set_audio_streaming_state(audio_state); @@ -716,7 +716,7 @@ void StateControllerImpl::OnApplicationRegistered( active_states_lock_.Acquire(); StateIDList::iterator it = active_states_.begin(); for (; it != active_states_.end(); ++it) { - HmiStatePtr new_state = CreateHmiState(app->app_id(), *it); + HmiStatePtr new_state = CreateHmiState(app, *it); DCHECK_OR_RETURN_VOID(new_state); DCHECK_OR_RETURN_VOID(new_state->state_id() != HmiState::STATE_ID_REGULAR); HmiStatePtr old_hmi_state = app->CurrentHmiState(); @@ -726,7 +726,7 @@ void StateControllerImpl::OnApplicationRegistered( active_states_lock_.Release(); HmiStatePtr default_state = - CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR); + CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR); DCHECK_OR_RETURN_VOID(default_state); default_state->set_hmi_level(default_level); default_state->set_audio_streaming_state(CalcAudioState(app, default_level)); @@ -896,49 +896,49 @@ bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const { } HmiStatePtr StateControllerImpl::CreateHmiState( - uint32_t app_id, HmiState::StateID state_id) const { + utils::SharedPtr<Application> app, HmiState::StateID state_id) const { using namespace utils; LOG4CXX_AUTO_TRACE(logger_); HmiStatePtr new_state; switch (state_id) { case HmiState::STATE_ID_PHONE_CALL: { - new_state = MakeShared<PhoneCallHmiState>(app_id, app_mngr_); + new_state = MakeShared<PhoneCallHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_SAFETY_MODE: { - new_state = MakeShared<SafetyModeHmiState>(app_id, app_mngr_); + new_state = MakeShared<SafetyModeHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_VR_SESSION: { - new_state = MakeShared<VRHmiState>(app_id, app_mngr_); + new_state = MakeShared<VRHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_TTS_SESSION: { - new_state = MakeShared<TTSHmiState>(app_id, app_mngr_); + new_state = MakeShared<TTSHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_NAVI_STREAMING: { - new_state = MakeShared<NaviStreamingHmiState>(app_id, app_mngr_); + new_state = MakeShared<NaviStreamingHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_REGULAR: { - new_state = MakeShared<HmiState>(app_id, app_mngr_); + new_state = MakeShared<HmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_POSTPONED: { - new_state = MakeShared<HmiState>(app_id, app_mngr_, state_id); + new_state = MakeShared<HmiState>(app, app_mngr_, state_id); break; } case HmiState::STATE_ID_DEACTIVATE_HMI: { - new_state = MakeShared<DeactivateHMI>(app_id, app_mngr_); + new_state = MakeShared<DeactivateHMI>(app, app_mngr_); break; } case HmiState::STATE_ID_AUDIO_SOURCE: { - new_state = MakeShared<AudioSource>(app_id, app_mngr_); + new_state = MakeShared<AudioSource>(app, app_mngr_); break; } case HmiState::STATE_ID_EMBEDDED_NAVI: { - new_state = MakeShared<EmbeddedNavi>(app_id, app_mngr_); + new_state = MakeShared<EmbeddedNavi>(app, app_mngr_); break; } default: diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt index 0580998e84..3e9010e22c 100644 --- a/src/components/application_manager/test/CMakeLists.txt +++ b/src/components/application_manager/test/CMakeLists.txt @@ -31,12 +31,6 @@ include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/platform.cmake) include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) -# TODO{ALeshin}: APPLINK-10792. Do not write tests which use -# application manager(AM) singleton while refactoring of AM is finished. - -# TODO{ILytvynenko}: SDLOPEN-797 Uncomment application_manager_impl_test and -# cover with UT missed files. - include_directories( ${GMOCK_INCLUDE_DIRECTORY} ${CMAKE_BINARY_DIR}/src/components/ @@ -68,9 +62,15 @@ set(testSources ${AM_TEST_DIR}/application_state_test.cc ${AM_TEST_DIR}/usage_statistics_test.cc ${AM_TEST_DIR}/policy_handler_test.cc - ${AM_TEST_DIR}/mock_message_helper.cc ${AM_TEST_DIR}/application_manager_impl_test.cc + ${AM_TEST_DIR}/application_helper_test.cc + ${AM_TEST_DIR}/command_holder_test.cc +) +set(testSourcesMockHmi + ${AM_SOURCE_DIR}/src/message_helper/message_helper.cc + ${AM_TEST_DIR}/application_manager_impl_mock_hmi_test.cc + ${AM_TEST_DIR}/mock_hmi_command_factory.cc ) if(REMOTE_CONTROL) @@ -130,10 +130,11 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath=${CMAKE_CURRENT_BINARY_DIR}" ) create_test("application_manager_test" "${testSources}" "${LIBRARIES}") +create_test("application_manager_mock_hmi_test" "${testSourcesMockHmi}" "${LIBRARIES}") add_dependencies("application_manager_test" libbson) + create_test("request_controller_test" "${RequestController_SOURCES}" "${LIBRARIES}") -# TODO [AKozoriz] : Fix not buildable tests set(ResumptionData_SOURCES ${AM_TEST_DIR}/resumption/resumption_data_test.cc ${AM_TEST_DIR}/resumption/resumption_data_db_test.cc diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc new file mode 100644 index 0000000000..a0b6fd6aa2 --- /dev/null +++ b/src/components/application_manager/test/application_helper_test.cc @@ -0,0 +1,258 @@ +/* + * 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. + */ + +#include <gmock/gmock.h> +#include <string> +#include <vector> + +#include "application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_message_helper.h" +#include "policy/usage_statistics/mock_statistics_manager.h" +#include "policy/mock_policy_settings.h" + +#include "application_manager/application.h" +#include "application_manager/application_impl.h" +#include "application_manager/application_manager_impl.h" +#include "application_manager/usage_statistics.h" +#include "application_manager/helpers/application_helper.h" +#include "application_manager/smart_object_keys.h" +#include "interfaces/MOBILE_API.h" +#include "connection_handler/device.h" +#include "smart_objects/smart_object.h" +#include "utils/custom_string.h" +#include "utils/macro.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +namespace { +const uint8_t expected_tread_pool_size = 2u; +const uint8_t stop_streaming_timeout = 1u; +const std::string kDirectoryName = "./test_storage"; +const std::vector<std::string> kTimeoutPrompt{"timeoutPrompt"}; +} + +namespace test { +namespace components { +namespace application_manager_test { + +using testing::_; +using ::testing::Mock; +using ::testing::NiceMock; +using ::testing::Return; +using ::testing::ReturnRef; + +using namespace application_manager; +using namespace policy_handler_test; + +class ApplicationHelperTest : public testing::Test { + public: + ApplicationHelperTest() + : mock_message_helper_( + application_manager::MockMessageHelper::message_helper_mock()) + , app_manager_impl_(mock_application_manager_settings_, + mock_policy_settings_) {} + + void SetUp() OVERRIDE { + ON_CALL(mock_application_manager_settings_, thread_pool_size()) + .WillByDefault(Return(expected_tread_pool_size)); + ON_CALL(mock_application_manager_settings_, app_icons_folder()) + .WillByDefault(ReturnRef(kDirectoryName)); + ON_CALL(mock_application_manager_settings_, app_storage_folder()) + .WillByDefault(ReturnRef(kDirectoryName)); + ON_CALL(mock_application_manager_settings_, launch_hmi()) + .WillByDefault(Return(true)); + ON_CALL(mock_application_manager_settings_, stop_streaming_timeout()) + .WillByDefault(Return(stop_streaming_timeout)); + ON_CALL(mock_application_manager_settings_, time_out_promt()) + .WillByDefault(ReturnRef(kTimeoutPrompt)); + + CreateApplication(); + app_manager_impl_.AddMockApplication(app_impl_); + + Mock::VerifyAndClearExpectations(&mock_message_helper_); + } + + void TearDown() OVERRIDE { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + } + + void CreateApplication() { + const uint32_t application_id = 1; + const std::string policy_app_id = "p_app_id"; + const std::string mac_address = "MA:CA:DD:RE:SS"; + const connection_handler::DeviceHandle device_id = 1; + const custom_str::CustomString app_name(""); + + app_impl_ = new ApplicationImpl( + application_id, + policy_app_id, + mac_address, + device_id, + app_name, + utils::MakeShared<usage_statistics_test::MockStatisticsManager>(), + app_manager_impl_); + } + + MockMessageHelper* mock_message_helper_; + NiceMock<MockApplicationManagerSettings> mock_application_manager_settings_; + NiceMock<MockPolicySettings> mock_policy_settings_; + + ApplicationManagerImpl app_manager_impl_; + ApplicationSharedPtr app_impl_; +}; + +TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectAppDataReset) { + const uint32_t cmd_id = 1; + const uint32_t menu_id = 2; + const uint32_t choice_set_id = 3; + const mobile_apis::VehicleDataType::eType vi = + mobile_apis::VehicleDataType::VEHICLEDATA_ACCPEDAL; + const mobile_apis::ButtonName::eType button = mobile_apis::ButtonName::AC; + + smart_objects::SmartObject cmd; + cmd[strings::msg_params][strings::cmd_id] = cmd_id; + cmd[strings::msg_params][strings::vr_commands][0] = "vrCmd"; + cmd[strings::msg_params][strings::menu_id] = menu_id; + cmd[strings::msg_params][strings::interaction_choice_set_id] = choice_set_id; + + app_impl_->AddCommand(cmd_id, cmd[strings::msg_params]); + app_impl_->AddSubMenu(menu_id, cmd[strings::menu_params]); + app_impl_->AddChoiceSet(choice_set_id, cmd[strings::msg_params]); + EXPECT_TRUE(app_impl_->SubscribeToIVI(static_cast<uint32_t>(vi))); + EXPECT_TRUE(app_impl_->SubscribeToButton(button)); + + const std::string some_string = "some_string"; + smart_objects::SmartObject dummy_data = + smart_objects::SmartObject(smart_objects::SmartType_String); + dummy_data = some_string; + app_impl_->set_help_prompt(dummy_data); + app_impl_->set_timeout_prompt(dummy_data); + app_impl_->set_vr_help(dummy_data); + app_impl_->set_vr_help_title(dummy_data); + app_impl_->set_keyboard_props(dummy_data); + app_impl_->set_menu_title(dummy_data); + app_impl_->set_menu_icon(dummy_data); + + const bool persistent = false; + const bool downloaded = true; + const std::string filename = "filename"; + AppFile file(filename, persistent, downloaded, mobile_apis::FileType::BINARY); + + app_impl_->AddFile(file); + + EXPECT_TRUE(NULL != app_impl_->FindCommand(cmd_id)); + EXPECT_TRUE(NULL != app_impl_->FindSubMenu(menu_id)); + EXPECT_TRUE(NULL != app_impl_->FindChoiceSet(choice_set_id)); + EXPECT_TRUE(app_impl_->IsSubscribedToButton(button)); + EXPECT_TRUE(app_impl_->IsSubscribedToIVI(static_cast<uint32_t>(vi))); + auto help_prompt = app_impl_->help_prompt(); + EXPECT_TRUE(help_prompt->asString() == some_string); + auto timeout_prompt = app_impl_->timeout_prompt(); + EXPECT_TRUE(timeout_prompt->asString() == some_string); + auto vr_help = app_impl_->vr_help(); + EXPECT_TRUE(vr_help->asString() == some_string); + auto vr_help_title = app_impl_->vr_help_title(); + EXPECT_TRUE(vr_help_title->asString() == some_string); + auto kb_properties = app_impl_->keyboard_props(); + EXPECT_TRUE(kb_properties->asString() == some_string); + auto menu_title = app_impl_->menu_title(); + EXPECT_TRUE(menu_title->asString() == some_string); + auto menu_icon = app_impl_->menu_icon(); + EXPECT_TRUE(menu_icon->asString() == some_string); + auto file_ptr = app_impl_->GetFile(filename); + EXPECT_TRUE(NULL != file_ptr); + EXPECT_TRUE(file_ptr->file_name == filename); + + // Act + application_manager::DeleteApplicationData(app_impl_, app_manager_impl_); + EXPECT_FALSE(NULL != app_impl_->FindCommand(cmd_id)); + EXPECT_FALSE(NULL != app_impl_->FindSubMenu(menu_id)); + EXPECT_FALSE(NULL != app_impl_->FindChoiceSet(choice_set_id)); + EXPECT_FALSE(app_impl_->IsSubscribedToButton(button)); + EXPECT_FALSE(app_impl_->IsSubscribedToIVI(static_cast<uint32_t>(vi))); + help_prompt = app_impl_->help_prompt(); + EXPECT_FALSE(help_prompt->asString() == some_string); + timeout_prompt = app_impl_->timeout_prompt(); + EXPECT_FALSE(timeout_prompt->asString() == some_string); + vr_help = app_impl_->vr_help(); + EXPECT_TRUE(vr_help == NULL); + vr_help_title = app_impl_->vr_help_title(); + EXPECT_TRUE(vr_help_title == NULL); + kb_properties = app_impl_->keyboard_props(); + EXPECT_FALSE(kb_properties->asString() == some_string); + menu_title = app_impl_->menu_title(); + EXPECT_FALSE(menu_title->asString() == some_string); + menu_icon = app_impl_->menu_icon(); + EXPECT_FALSE(menu_icon->asString() == some_string); + file_ptr = app_impl_->GetFile(filename); + EXPECT_TRUE(NULL == file_ptr); +} + +TEST_F(ApplicationHelperTest, RecallApplicationData_ExpectHMICleanupRequests) { + const uint32_t cmd_id = 1; + const uint32_t menu_id = 2; + const uint32_t choice_set_id = 3; + smart_objects::SmartObject cmd; + cmd[strings::msg_params][strings::cmd_id] = cmd_id; + cmd[strings::msg_params][strings::vr_commands][0] = "vrCmd"; + cmd[strings::msg_params][strings::menu_id] = menu_id; + cmd[strings::msg_params][strings::interaction_choice_set_id] = choice_set_id; + + app_impl_->AddCommand(cmd_id, cmd[strings::msg_params]); + app_impl_->AddSubMenu(menu_id, cmd[strings::menu_params]); + app_impl_->AddChoiceSet(choice_set_id, cmd[strings::msg_params]); + app_impl_->SubscribeToIVI(static_cast<uint32_t>( + mobile_apis::VehicleDataType::VEHICLEDATA_ACCPEDAL)); + app_impl_->SubscribeToButton(mobile_apis::ButtonName::AC); + + EXPECT_CALL(*mock_message_helper_, SendUnsubscribedWayPoints(_)); + + EXPECT_CALL(*mock_message_helper_, SendDeleteCommandRequest(_, _, _)); + + EXPECT_CALL(*mock_message_helper_, SendDeleteSubmenuRequest(_, _, _)); + + EXPECT_CALL(*mock_message_helper_, SendDeleteChoiceSetRequest(_, _, _)); + + EXPECT_CALL(*mock_message_helper_, SendResetPropertiesRequest(_, _)); + + EXPECT_CALL(*mock_message_helper_, + SendUnsubscribeButtonNotification(_, _, _)); + + EXPECT_CALL(*mock_message_helper_, SendUnsubscribeIVIRequest(_, _, _)); + + // Act + application_manager::DeleteApplicationData(app_impl_, app_manager_impl_); +} + +} // application_manager_test +} // components +} // test diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc index a1e284b40d..e02191e4da 100644 --- a/src/components/application_manager/test/application_impl_test.cc +++ b/src/components/application_manager/test/application_impl_test.cc @@ -50,6 +50,7 @@ #include "resumption/last_state.h" #include "application_manager/resumption/resume_ctrl.h" #include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/mock_resume_ctrl.h" #include "policy/usage_statistics/mock_statistics_manager.h" #include "smart_objects/smart_object.h" @@ -77,14 +78,12 @@ class ApplicationImplTest : public ::testing::Test { policy_app_id = "policy_app_id"; app_name = "app_name"; mac_address = "mac_address"; + device_handle = 0; test_lvl = HMILevel::INVALID_ENUM; state_id = HmiState::STATE_ID_REGULAR; audiostate = AudioStreamingState::NOT_AUDIBLE; syst_context = SystemContext::SYSCTXT_MAIN; - testHmiState = CreateTestHmiState(); - EXPECT_CALL(mock_application_manager_, CreateRegularState(app_id, _, _, _)) - .WillOnce(Return(testHmiState)); EXPECT_CALL(mock_application_manager_, get_settings()) .WillRepeatedly(ReturnRef(mock_application_manager_settings_)); EXPECT_CALL(mock_application_manager_settings_, app_icons_folder()) @@ -95,15 +94,17 @@ class ApplicationImplTest : public ::testing::Test { audio_data_stopped_timeout()).WillOnce(Return(0)); EXPECT_CALL(mock_application_manager_settings_, video_data_stopped_timeout()).WillOnce(Return(0)); - app_impl = new ApplicationImpl(app_id, - policy_app_id, - mac_address, - app_name, - utils::MakeShared<MockStatisticsManager>(), - mock_application_manager_); - } - void TearDown() OVERRIDE { - delete app_impl; + app_impl.reset( + new ApplicationImpl(app_id, + policy_app_id, + mac_address, + device_handle, + app_name, + utils::MakeShared<MockStatisticsManager>(), + mock_application_manager_)); + + HmiStatePtr initial_state = CreateTestHmiState(); + app_impl->SetInitialState(initial_state); } HmiStatePtr CreateTestHmiState(); @@ -114,10 +115,11 @@ class ApplicationImplTest : public ::testing::Test { void CheckCurrentHMIState(); MockApplicationManagerSettings mock_application_manager_settings_; MockApplicationManager mock_application_manager_; - ApplicationImpl* app_impl; + utils::SharedPtr<ApplicationImpl> app_impl; uint32_t app_id; std::string policy_app_id; std::string mac_address; + connection_handler::DeviceHandle device_handle; custom_str::CustomString app_name; const std::string directory_name = "./test_storage"; HmiState::StateID state_id; @@ -128,8 +130,10 @@ class ApplicationImplTest : public ::testing::Test { }; HmiStatePtr ApplicationImplTest::CreateTestHmiState() { - HmiStatePtr testState = - utils::MakeShared<HmiState>(app_id, mock_application_manager_, state_id); + HmiStatePtr testState = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(app_impl), + mock_application_manager_, + state_id); testState->set_hmi_level(test_lvl); testState->set_audio_streaming_state(audiostate); testState->set_system_context(syst_context); @@ -142,7 +146,7 @@ HmiStatePtr ApplicationImplTest::TestAddHmiState(HMILevel::eType hmi_lvl, test_lvl = hmi_lvl; state_id = id_state; HmiStatePtr state = CreateTestHmiState(); - (app_impl->*hmi_action)(state); + ((app_impl.get())->*hmi_action)(state); return state; } @@ -565,7 +569,7 @@ TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) { TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeNotNaviNotVoice) { smart_objects::SmartObject type_media; - type_media[0] = AppHMIType::MEDIA; + type_media[0] = mobile_apis::AppHMIType::MEDIA; EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); @@ -581,7 +585,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeNotNaviNotVoice) { TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsVoice) { smart_objects::SmartObject type_comm; - type_comm[0] = AppHMIType::COMMUNICATION; + type_comm[0] = mobile_apis::AppHMIType::COMMUNICATION; EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); @@ -597,7 +601,7 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsVoice) { TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNavi) { smart_objects::SmartObject type_navi; - type_navi[0] = AppHMIType::NAVIGATION; + type_navi[0] = mobile_apis::AppHMIType::NAVIGATION; EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); @@ -613,9 +617,9 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNavi) { TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoice) { smart_objects::SmartObject app_types; - app_types[0] = AppHMIType::NAVIGATION; - app_types[1] = AppHMIType::COMMUNICATION; - app_types[2] = AppHMIType::MEDIA; + app_types[0] = mobile_apis::AppHMIType::NAVIGATION; + app_types[1] = mobile_apis::AppHMIType::COMMUNICATION; + app_types[2] = mobile_apis::AppHMIType::MEDIA; EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); @@ -632,10 +636,10 @@ TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoice) { TEST_F(ApplicationImplTest, ChangeSupportingAppHMIType_TypeIsNaviAndVoiceAndProjection) { smart_objects::SmartObject app_types; - app_types[0] = AppHMIType::NAVIGATION; - app_types[1] = AppHMIType::COMMUNICATION; - app_types[2] = AppHMIType::MEDIA; - app_types[3] = AppHMIType::PROJECTION; + app_types[0] = mobile_apis::AppHMIType::NAVIGATION; + app_types[1] = mobile_apis::AppHMIType::COMMUNICATION; + app_types[2] = mobile_apis::AppHMIType::MEDIA; + app_types[3] = mobile_apis::AppHMIType::PROJECTION; EXPECT_FALSE(app_impl->is_navi()); EXPECT_FALSE(app_impl->is_voice_communication_supported()); @@ -652,6 +656,22 @@ TEST_F(ApplicationImplTest, TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) { EXPECT_CALL(*MockMessageHelper::message_helper_mock(), SendHashUpdateNotification(app_id, _)).Times(1); + resumprion_test::MockResumeCtrl mock_resume_ctrl; + EXPECT_CALL(mock_application_manager_, resume_controller()) + .WillOnce(ReturnRef(mock_resume_ctrl)); + EXPECT_CALL(mock_resume_ctrl, is_suspended()).WillOnce(Return(false)); + app_impl->UpdateHash(); + + EXPECT_TRUE(app_impl->is_application_data_changed()); +} + +TEST_F(ApplicationImplTest, UpdateHash_AppMngrSuspended) { + EXPECT_CALL(*MockMessageHelper::message_helper_mock(), + SendHashUpdateNotification(app_id, _)).Times(0); + resumprion_test::MockResumeCtrl mock_resume_ctrl; + EXPECT_CALL(mock_application_manager_, resume_controller()) + .WillOnce(ReturnRef(mock_resume_ctrl)); + EXPECT_CALL(mock_resume_ctrl, is_suspended()).WillOnce(Return(true)); app_impl->UpdateHash(); EXPECT_TRUE(app_impl->is_application_data_changed()); diff --git a/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc b/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc new file mode 100644 index 0000000000..b9437d55e0 --- /dev/null +++ b/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc @@ -0,0 +1,254 @@ +/* + * 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. + */ +#include <stdint.h> +#include <memory> +#include <string> + +#include "gtest/gtest.h" +#include "application_manager/application.h" +#include "application_manager/application_impl.h" +#include "application_manager/application_manager_impl.h" +#include "utils/custom_string.h" +#include "utils/make_shared.h" +#include "encryption/hashing.h" + +#include "application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_resumption_data.h" +#include "application_manager/mock_hmi_command_factory.h" +#include "application_manager/mock_request.h" +#include "connection_handler/mock_connection_handler.h" +#include "policy/mock_policy_settings.h" +#include "policy/usage_statistics/mock_statistics_manager.h" +#include "protocol_handler/mock_session_observer.h" + +namespace test { +namespace components { +namespace application_manager_test { + +namespace am = application_manager; + +using testing::_; +using ::testing::DoAll; +using ::testing::Mock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::NiceMock; +using ::testing::SetArgPointee; + +using namespace application_manager; + +namespace { +const uint32_t kApplicationId = 0u; +const std::string kDirectoryName = "./test_storage"; +const uint32_t kTimeout = 10000u; +} // namespace + +/** + * @brief The ApplicationManagerImplMockHmiTest class uses mocked HMI factory + * which calls its static method and real (non-mocked) MessageHelper. + * Class is separated from ApplicationManagerImplTest since it requires real + * HMI factory and mocked MessageHelper. So it is not possible to combine + * this code together. + */ +class ApplicationManagerImplMockHmiTest : public ::testing::Test { + public: + ApplicationManagerImplMockHmiTest() + : mock_storage_( + ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData> >( + mock_app_mngr_)) {} + + protected: + void SetUp() OVERRIDE { + const uint8_t expected_tread_pool_size = 2u; + const uint8_t stop_streaming_timeout = 1u; + + ON_CALL(mock_application_manager_settings_, thread_pool_size()) + .WillByDefault(Return(expected_tread_pool_size)); + ON_CALL(mock_application_manager_settings_, app_icons_folder()) + .WillByDefault(ReturnRef(kDirectoryName)); + ON_CALL(mock_application_manager_settings_, app_storage_folder()) + .WillByDefault(ReturnRef(kDirectoryName)); + ON_CALL(mock_application_manager_settings_, launch_hmi()) + .WillByDefault(Return(true)); + ON_CALL(mock_application_manager_settings_, stop_streaming_timeout()) + .WillByDefault(Return(stop_streaming_timeout)); + ON_CALL(mock_application_manager_settings_, default_timeout()) + .WillByDefault(ReturnRef(kTimeout)); + + ON_CALL(mock_connection_handler_, get_session_observer()) + .WillByDefault(ReturnRef(mock_session_observer_)); + + app_manager_impl_.reset(new am::ApplicationManagerImpl( + mock_application_manager_settings_, mock_policy_settings_)); + + app_manager_impl_->set_connection_handler(&mock_connection_handler_); + app_manager_impl_->resume_controller().set_resumption_storage( + mock_storage_); + } + + void SetCommonExpectationOnAppReconnection( + const connection_handler::DeviceHandle new_device_id, + const uint32_t new_application_id, + const std::string& mac_address) { + EXPECT_CALL( + mock_session_observer_, + GetDataOnSessionKey(new_application_id, + _, + _, + testing::An<connection_handler::DeviceHandle*>())) + .WillOnce(DoAll(SetArgPointee<3u>(new_device_id), Return(0))); + + const std::string connection_type = "MyConnectionType"; + EXPECT_CALL( + mock_session_observer_, + GetDataOnDeviceID( + ::testing::Matcher<connection_handler::DeviceHandle>(new_device_id), + _, + _, + _, + _)) + .WillOnce(DoAll(SetArgPointee<3u>(mac_address), + SetArgPointee<4u>(connection_type), + Return(0))); + } + + utils::SharedPtr<NiceMock<resumption_test::MockResumptionData> > + mock_storage_; + application_manager_test::MockApplicationManager mock_app_mngr_; + NiceMock<policy_handler_test::MockPolicySettings> mock_policy_settings_; + NiceMock<connection_handler_test::MockConnectionHandler> + mock_connection_handler_; + NiceMock<protocol_handler_test::MockSessionObserver> mock_session_observer_; + NiceMock<MockApplicationManagerSettings> mock_application_manager_settings_; + std::unique_ptr<am::ApplicationManagerImpl> app_manager_impl_; +}; + +TEST_F(ApplicationManagerImplMockHmiTest, + PostponeCommandsDuringSwitching_ExpectSendingOnSwitchingEnd) { + const uint32_t application_id = 1u; + const std::string policy_app_id = "p_app_id"; + const std::string mac_address = "MA:CA:DD:RE:SS"; + const connection_handler::DeviceHandle device_id = 1u; + const custom_str::CustomString app_name(""); + + utils::SharedPtr<ApplicationImpl> app_impl = new ApplicationImpl( + application_id, + policy_app_id, + encryption::MakeHash(mac_address), + device_id, + app_name, + utils::SharedPtr<usage_statistics::StatisticsManager>( + new usage_statistics_test::MockStatisticsManager()), + *app_manager_impl_); + + app_manager_impl_->AddMockApplication(app_impl); + + const connection_handler::Device bt( + device_id, "BT_device", mac_address, "BLUETOOTH"); + + const connection_handler::Device usb( + device_id + 1, "USB_device", "USB_serial", "USB_IOS"); + + MockHMICommandFactory* mock_hmi_factory = + MockHMICommandFactory::mock_hmi_command_factory(); + + // Skip sending notification on device switching as it is not the goal here + EXPECT_CALL(*mock_hmi_factory, CreateCommand(_, _)) + .WillOnce(Return(utils::SharedPtr<commands::Command>())); + + app_manager_impl_->OnDeviceSwitchingStart(bt, usb); + + const uint32_t connection_key = 1u; + const uint32_t correlation_id_1 = 1u; + const uint32_t correlation_id_2 = 2u; + const uint32_t correlation_id_3 = 3u; + utils::SharedPtr<NiceMock<MockRequest> > cmd_1 = + utils::MakeShared<NiceMock<MockRequest> >(connection_key, + correlation_id_1); + utils::SharedPtr<NiceMock<MockRequest> > cmd_2 = + utils::MakeShared<NiceMock<MockRequest> >(connection_key, + correlation_id_2); + utils::SharedPtr<NiceMock<MockRequest> > cmd_3 = + utils::MakeShared<NiceMock<MockRequest> >(connection_key, + correlation_id_3); + + EXPECT_CALL(*mock_hmi_factory, CreateCommand(_, _)) + .WillOnce(Return(cmd_1)) + .WillOnce(Return(cmd_2)) + .WillOnce(Return(cmd_3)); + + commands::MessageSharedPtr hmi_msg_1 = + utils::MakeShared<smart_objects::SmartObject>(); + commands::MessageSharedPtr hmi_msg_2 = + utils::MakeShared<smart_objects::SmartObject>(); + commands::MessageSharedPtr hmi_msg_3 = + utils::MakeShared<smart_objects::SmartObject>(); + + (*hmi_msg_1)[strings::msg_params][strings::app_id] = + (*hmi_msg_2)[strings::msg_params][strings::app_id] = + (*hmi_msg_3)[strings::msg_params][strings::app_id] = application_id; + + EXPECT_CALL(*cmd_1, Init()).Times(0); + EXPECT_CALL(*cmd_2, Init()).Times(0); + EXPECT_CALL(*cmd_3, Init()).Times(0); + + // Act + app_manager_impl_->ManageHMICommand(hmi_msg_1); + app_manager_impl_->ManageHMICommand(hmi_msg_2); + app_manager_impl_->ManageHMICommand(hmi_msg_3); + + EXPECT_CALL(*mock_hmi_factory, CreateCommand(_, _)) + .WillOnce(Return(cmd_1)) + .WillOnce(Return(cmd_2)) + .WillOnce(Return(cmd_3)); + + EXPECT_CALL(*cmd_1, Init()).WillOnce(Return(true)); + EXPECT_CALL(*cmd_1, Run()); + EXPECT_CALL(*cmd_2, Init()).WillOnce(Return(true)); + EXPECT_CALL(*cmd_2, Run()); + EXPECT_CALL(*cmd_3, Init()).WillOnce(Return(true)); + EXPECT_CALL(*cmd_3, Run()); + + const connection_handler::DeviceHandle new_device_id = 2; + const uint32_t new_application_id = 2; + SetCommonExpectationOnAppReconnection( + new_device_id, new_application_id, mac_address); + + app_manager_impl_->ProcessReconnection(app_impl, new_application_id); + app_manager_impl_->OnApplicationSwitched(app_impl); + + Mock::VerifyAndClearExpectations(&mock_hmi_factory); +} + +} // application_manager_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc index d19d3cd8ed..e54bc612ca 100644 --- a/src/components/application_manager/test/application_manager_impl_test.cc +++ b/src/components/application_manager/test/application_manager_impl_test.cc @@ -32,6 +32,8 @@ #include <stdint.h> #include <memory> #include <set> +#include <string> +#include <vector> #include <bson_object.h> #include "gtest/gtest.h" @@ -54,6 +56,7 @@ #include "utils/lock.h" #include "utils/make_shared.h" #include "utils/push_log.h" +#include "encryption/hashing.h" namespace test { namespace components { @@ -64,6 +67,7 @@ namespace policy_test = test::components::policy_handler_test; namespace con_test = connection_handler_test; using testing::_; +using ::testing::Matcher; using ::testing::ByRef; using ::testing::DoAll; using ::testing::Mock; @@ -83,8 +87,7 @@ ACTION_P6(InvokeMemberFuncWithArg4, ptr, memberFunc, a, b, c, d) { namespace { const std::string kDirectoryName = "./test_storage"; const uint32_t kTimeout = 10000u; -sync_primitives::Lock state_lock_; -sync_primitives::ConditionalVariable state_condition_; +connection_handler::DeviceHandle kDeviceId = 12345u; } // namespace class ApplicationManagerImplTest : public ::testing::Test { @@ -92,7 +95,7 @@ class ApplicationManagerImplTest : public ::testing::Test { ApplicationManagerImplTest() : mock_storage_( ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData> >( - app_mngr_)) + mock_app_mngr_)) , mock_message_helper_( application_manager::MockMessageHelper::message_helper_mock()) , app_id_(0u) { @@ -106,8 +109,7 @@ class ApplicationManagerImplTest : public ::testing::Test { protected: void SetUp() OVERRIDE { CreateAppManager(); - - ON_CALL(mock_connection_handler_, GetDataOnSessionKey(_, _, _, _)) + ON_CALL(mock_connection_handler_, GetDataOnSessionKey(_, _, _, &kDeviceId)) .WillByDefault(DoAll(SetArgPointee<3u>(app_id_), Return(0))); ON_CALL(mock_connection_handler_, get_session_observer()) .WillByDefault(ReturnRef(mock_session_observer_)); @@ -128,11 +130,12 @@ class ApplicationManagerImplTest : public ::testing::Test { ON_CALL(mock_application_manager_settings_, app_storage_folder()) .WillByDefault(ReturnRef(kDirectoryName)); ON_CALL(mock_application_manager_settings_, launch_hmi()) - .WillByDefault(Return(true)); + .WillByDefault(Return(false)); ON_CALL(mock_application_manager_settings_, stop_streaming_timeout()) .WillByDefault(Return(stop_streaming_timeout)); ON_CALL(mock_application_manager_settings_, default_timeout()) .WillByDefault(ReturnRef(kTimeout)); + app_manager_impl_.reset(new am::ApplicationManagerImpl( mock_application_manager_settings_, mock_policy_settings_)); mock_app_ptr_ = utils::SharedPtr<MockApplication>(new MockApplication()); @@ -145,17 +148,42 @@ class ApplicationManagerImplTest : public ::testing::Test { app_manager_impl_->AddMockApplication(mock_app_ptr_); } + void SetCommonExpectationOnAppReconnection( + const connection_handler::DeviceHandle new_device_id, + const uint32_t new_application_id, + const std::string& mac_address) { + EXPECT_CALL( + mock_session_observer_, + GetDataOnSessionKey(new_application_id, + _, + _, + testing::An<connection_handler::DeviceHandle*>())) + .WillOnce(DoAll(SetArgPointee<3u>(new_device_id), Return(0))); + + const std::string connection_type = "MyConnectionType"; + EXPECT_CALL( + mock_session_observer_, + GetDataOnDeviceID( + ::testing::Matcher<connection_handler::DeviceHandle>(new_device_id), + _, + _, + _, + _)) + .WillOnce(DoAll(SetArgPointee<3u>(mac_address), + SetArgPointee<4u>(connection_type), + Return(0))); + } + NiceMock<policy_test::MockPolicySettings> mock_policy_settings_; utils::SharedPtr<NiceMock<resumption_test::MockResumptionData> > mock_storage_; NiceMock<con_test::MockConnectionHandler> mock_connection_handler_; NiceMock<protocol_handler_test::MockSessionObserver> mock_session_observer_; NiceMock<MockApplicationManagerSettings> mock_application_manager_settings_; - application_manager_test::MockApplicationManager app_mngr_; + application_manager_test::MockApplicationManager mock_app_mngr_; std::auto_ptr<am::ApplicationManagerImpl> app_manager_impl_; application_manager::MockMessageHelper* mock_message_helper_; uint32_t app_id_; - application_manager::MessageHelper* message_helper_; utils::SharedPtr<MockApplication> mock_app_ptr_; }; @@ -181,16 +209,20 @@ TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) { TEST_F(ApplicationManagerImplTest, SubscribeAppForWayPoints_ExpectSubscriptionApp) { - app_manager_impl_->SubscribeAppForWayPoints(app_id_); - EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_id_)); + auto app_ptr = + ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_); + app_manager_impl_->SubscribeAppForWayPoints(app_ptr); + EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr)); } TEST_F(ApplicationManagerImplTest, UnsubscribeAppForWayPoints_ExpectUnsubscriptionApp) { - app_manager_impl_->SubscribeAppForWayPoints(app_id_); - EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_id_)); - app_manager_impl_->UnsubscribeAppFromWayPoints(app_id_); - EXPECT_FALSE(app_manager_impl_->IsAppSubscribedForWayPoints(app_id_)); + auto app_ptr = + ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_); + app_manager_impl_->SubscribeAppForWayPoints(app_ptr); + EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr)); + app_manager_impl_->UnsubscribeAppFromWayPoints(app_ptr); + EXPECT_FALSE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr)); const std::set<int32_t> result = app_manager_impl_->GetAppsSubscribedForWayPoints(); EXPECT_TRUE(result.empty()); @@ -207,10 +239,12 @@ TEST_F( TEST_F( ApplicationManagerImplTest, GetAppsSubscribedForWayPoints_SubcribeAppForWayPoints_ExpectCorrectResult) { - app_manager_impl_->SubscribeAppForWayPoints(app_id_); + auto app_ptr = + ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_); + app_manager_impl_->SubscribeAppForWayPoints(app_ptr); std::set<int32_t> result = app_manager_impl_->GetAppsSubscribedForWayPoints(); EXPECT_EQ(1u, result.size()); - EXPECT_TRUE(result.find(app_id_) != result.end()); + EXPECT_TRUE(result.find(app_ptr) != result.end()); } TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_RpcService) { @@ -639,6 +673,157 @@ TEST_F(ApplicationManagerImplTest, EXPECT_TRUE(rejected_params.empty()); } +TEST_F(ApplicationManagerImplTest, + OnDeviceSwitchingStart_ExpectPutAppsInWaitList) { + utils::SharedPtr<MockApplication> switching_app_ptr = + utils::MakeShared<MockApplication>(); + + const std::string switching_device_id = "switching"; + const std::string switching_device_id_hash = + encryption::MakeHash(switching_device_id); + app_manager_impl_->AddMockApplication(switching_app_ptr); + EXPECT_CALL(*switching_app_ptr, mac_address()) + .WillRepeatedly(ReturnRef(switching_device_id_hash)); + + const std::string policy_app_id_switch = "abc"; + EXPECT_CALL(*switching_app_ptr, policy_app_id()) + .WillRepeatedly(Return(policy_app_id_switch)); + + const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL; + EXPECT_CALL(*switching_app_ptr, hmi_level()) + .WillRepeatedly(Return(hmi_level_switching_app)); + + utils::SharedPtr<MockApplication> nonswitching_app_ptr = + utils::MakeShared<MockApplication>(); + + const std::string nonswitching_device_id = "nonswitching"; + const std::string nonswitching_device_id_hash = + encryption::MakeHash(nonswitching_device_id); + app_manager_impl_->AddMockApplication(nonswitching_app_ptr); + EXPECT_CALL(*nonswitching_app_ptr, mac_address()) + .WillRepeatedly(ReturnRef(nonswitching_device_id_hash)); + + const std::string policy_app_id_nonswitch = "efg"; + EXPECT_CALL(*nonswitching_app_ptr, policy_app_id()) + .WillRepeatedly(Return(policy_app_id_nonswitch)); + + const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED; + EXPECT_CALL(*nonswitching_app_ptr, hmi_level()) + .WillRepeatedly(Return(hmi_level_nonswitching_app)); + + // Act + const connection_handler::DeviceHandle switching_handle = 1; + const connection_handler::Device switching_device( + switching_handle, "switching_device", switching_device_id, "BLUETOOTH"); + + const connection_handler::DeviceHandle non_switching_handle = 2; + const connection_handler::Device non_switching_device(non_switching_handle, + "non_switching_device", + nonswitching_device_id, + "USB"); + + EXPECT_CALL(*mock_message_helper_, CreateDeviceListSO(_, _, _)) + .WillOnce(Return(smart_objects::SmartObjectSPtr())); + app_manager_impl_->OnDeviceSwitchingStart(switching_device, + non_switching_device); + EXPECT_TRUE(app_manager_impl_->IsAppInReconnectMode(policy_app_id_switch)); + EXPECT_FALSE( + app_manager_impl_->IsAppInReconnectMode(policy_app_id_nonswitch)); +} + +TEST_F(ApplicationManagerImplTest, + OnDeviceSwitchingFinish_ExpectUnregisterAppsInWaitList) { + utils::SharedPtr<MockApplication> switching_app_ptr = + utils::MakeShared<MockApplication>(); + + const std::string switching_device_id = "switching"; + const std::string switching_device_id_hash = + encryption::MakeHash(switching_device_id); + app_manager_impl_->AddMockApplication(switching_app_ptr); + EXPECT_CALL(*switching_app_ptr, mac_address()) + .WillRepeatedly(ReturnRef(switching_device_id_hash)); + + const std::string policy_app_id_switch = "abc"; + EXPECT_CALL(*switching_app_ptr, policy_app_id()) + .WillRepeatedly(Return(policy_app_id_switch)); + + const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL; + EXPECT_CALL(*switching_app_ptr, hmi_level()) + .WillRepeatedly(Return(hmi_level_switching_app)); + + utils::SharedPtr<MockApplication> nonswitching_app_ptr = + utils::MakeShared<MockApplication>(); + + const std::string nonswitching_device_id = "nonswitching"; + const std::string nonswitching_device_id_hash = + encryption::MakeHash(nonswitching_device_id); + app_manager_impl_->AddMockApplication(nonswitching_app_ptr); + EXPECT_CALL(*nonswitching_app_ptr, mac_address()) + .WillRepeatedly(ReturnRef(nonswitching_device_id_hash)); + + const std::string policy_app_id_nonswitch = "efg"; + EXPECT_CALL(*nonswitching_app_ptr, policy_app_id()) + .WillRepeatedly(Return(policy_app_id_nonswitch)); + + const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED; + EXPECT_CALL(*nonswitching_app_ptr, hmi_level()) + .WillRepeatedly(Return(hmi_level_nonswitching_app)); + + // Act + const connection_handler::DeviceHandle switching_handle = 1; + const connection_handler::Device switching_device( + switching_handle, "switching_device", switching_device_id, "BLUETOOTH"); + + const connection_handler::DeviceHandle non_switching_handle = 2; + const connection_handler::Device non_switching_device(non_switching_handle, + "non_switching_device", + nonswitching_device_id, + "USB"); + + EXPECT_CALL(*mock_message_helper_, CreateDeviceListSO(_, _, _)) + .WillOnce(Return(smart_objects::SmartObjectSPtr())); + + app_manager_impl_->OnDeviceSwitchingStart(switching_device, + non_switching_device); + + EXPECT_TRUE(app_manager_impl_->IsAppInReconnectMode(policy_app_id_switch)); + + app_manager_impl_->OnDeviceSwitchingFinish(switching_device_id); + EXPECT_FALSE( + app_manager_impl_->application_by_policy_id(policy_app_id_switch)); +} + +TEST_F(ApplicationManagerImplTest, + ProcessReconnection_ExpectChangeAppIdDeviceId) { + const uint32_t application_id = 1; + const std::string policy_app_id = "p_app_id"; + const std::string mac_address = "MA:CA:DD:RE:SS"; + const connection_handler::DeviceHandle device_id = 1; + const custom_str::CustomString app_name(""); + + utils::SharedPtr<ApplicationImpl> app_impl = new ApplicationImpl( + application_id, + policy_app_id, + mac_address, + device_id, + app_name, + utils::SharedPtr<usage_statistics::StatisticsManager>( + new usage_statistics_test::MockStatisticsManager()), + *app_manager_impl_); + + app_manager_impl_->AddMockApplication(app_impl); + + const connection_handler::DeviceHandle new_device_id = 2; + const uint32_t new_application_id = 2; + SetCommonExpectationOnAppReconnection( + new_device_id, new_application_id, mac_address); + + // Act + app_manager_impl_->ProcessReconnection(app_impl, new_application_id); + EXPECT_EQ(new_device_id, app_impl->device()); + EXPECT_EQ(new_application_id, app_impl->app_id()); +} + } // application_manager_test } // namespace components } // namespace test diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc index 7bc34966b4..33f23022f0 100644 --- a/src/components/application_manager/test/application_state_test.cc +++ b/src/components/application_manager/test/application_state_test.cc @@ -34,6 +34,7 @@ #include "gtest/gtest.h" #include "application_manager/hmi_state.h" #include "application_manager/mock_application_manager.h" +#include "application_manager/mock_application.h" #include "application_manager/event_engine/event_dispatcher.h" #include "resumption/last_state.h" #include "application_manager/policies/policy_handler.h" @@ -64,12 +65,17 @@ std::vector<StateID> GenerateCurrentStates() { } class ApplicationStateTest : public ::testing::Test { + public: + void SetUp() OVERRIDE { + mock_app_.reset(new MockApplication); + } + protected: static std::vector<StateID> added_states_; ApplicationState app_state; const StateID current_id = StateID::STATE_ID_CURRENT; const StateID postponed_id = StateID::STATE_ID_POSTPONED; - const uint32_t app_id = 10; + utils::SharedPtr<MockApplication> mock_app_; MockApplicationManager app_mngr_; }; @@ -79,8 +85,10 @@ std::vector<StateID> ApplicationStateTest::added_states_ = TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) { std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); EXPECT_EQ(state, app_state.GetState(current_id)); } @@ -89,8 +97,10 @@ TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) { TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) { std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); HmiStatePtr curr_state = app_state.GetState(current_id); @@ -110,16 +120,20 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) { // Added some states std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); } // Postponed state wasn't added HmiStatePtr get_postponed_id = app_state.GetState(postponed_id); EXPECT_EQ(NULL, get_postponed_id); // Add posponed state - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, postponed_id); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Postponed state exists get_postponed_id = app_state.GetState(postponed_id); @@ -129,14 +143,19 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) { TEST_F(ApplicationStateTest, AddStates_GetRegularState) { // Add state std::vector<StateID>::iterator new_state = added_states_.begin(); - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); state->set_hmi_level(HMILevel::HMI_FULL); app_state.AddState(state); ++new_state; // Add some other for (; new_state != added_states_.end(); ++new_state) { - state = utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); state->set_hmi_level(HMILevel::HMI_LIMITED); } @@ -150,13 +169,18 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) { TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { std::vector<StateID>::iterator new_state = added_states_.begin(); - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); ++new_state; // Add postponed state - state = utils::MakeShared<HmiState>(app_id, app_mngr_, postponed_id); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Make sure that the state was added @@ -164,7 +188,10 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { ASSERT_EQ(state, post_state); for (; new_state != added_states_.end(); ++new_state) { - state = utils::MakeShared<HmiState>(app_id, app_mngr_, *new_state); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + *new_state); app_state.AddState(state); } @@ -184,22 +211,32 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) { // Add some state StateID first_state = StateID::STATE_ID_PHONE_CALL; - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, first_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + first_state); app_state.AddState(state); // Add postponed state - state = utils::MakeShared<HmiState>(app_id, app_mngr_, postponed_id); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Add new postponed state - const uint32_t app_id2 = 10; - state = utils::MakeShared<HmiState>(app_id2, app_mngr_, postponed_id); + utils::SharedPtr<MockApplication> mock_app_2(new MockApplication); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Add regular state - state = - utils::MakeShared<HmiState>(app_id, app_mngr_, StateID::STATE_ID_REGULAR); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + StateID::STATE_ID_REGULAR); app_state.AddState(state); // Postponed state is the first @@ -213,8 +250,10 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) { TEST_F(ApplicationStateTest, InitState_GetRegularState) { StateID init_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, init_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + init_state); app_state.InitState(state); @@ -228,14 +267,19 @@ TEST_F(ApplicationStateTest, InitState_GetRegularState) { TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) { // Precondition StateID init_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = - utils::MakeShared<HmiState>(app_id, app_mngr_, init_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + init_state); state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL); app_state.InitState(state); // Add postponed state - state = utils::MakeShared<HmiState>(app_id, app_mngr_, postponed_id); + state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + postponed_id); app_state.AddState(state); // Make sure that state was added @@ -252,7 +296,10 @@ TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) { TEST_F(ApplicationStateTest, AddRegularState_RemoveRegularState_RegularStateNotDeleted) { StateID reg_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = utils::MakeShared<HmiState>(app_id, app_mngr_, reg_state); + HmiStatePtr state = utils::MakeShared<HmiState>( + static_cast<utils::SharedPtr<Application> >(mock_app_), + app_mngr_, + reg_state); app_state.InitState(state); // Try deleting regular state diff --git a/src/components/application_manager/test/command_holder_test.cc b/src/components/application_manager/test/command_holder_test.cc new file mode 100644 index 0000000000..e10cd5d008 --- /dev/null +++ b/src/components/application_manager/test/command_holder_test.cc @@ -0,0 +1,173 @@ +/* + * 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. + */ + +#include <gmock/gmock.h> + +#include "application_manager/command_holder_impl.h" +#include "application_manager/commands/command.h" +#include "smart_objects/smart_object.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" + +#include "application_manager/mock_application_manager.h" +#include "application_manager/mock_application.h" + +namespace test { +namespace components { +namespace application_manager_test { + +using testing::_; +using testing::Return; + +namespace am = application_manager; + +class CommandHolderImplTest : public testing::Test { + public: + CommandHolderImplTest() + : kPolicyAppId_("p_app_id") + , kHmiApplicationId_(123) + , kConnectionKey_(56789) + , cmd_ptr_(new smart_objects::SmartObject) + , mock_app_ptr_(new MockApplication) {} + + void SetUp() OVERRIDE { + ON_CALL(*mock_app_ptr_, app_id()).WillByDefault(Return(kConnectionKey_)); + ON_CALL(*mock_app_ptr_, hmi_app_id()) + .WillByDefault(Return(kHmiApplicationId_)); + ON_CALL(*mock_app_ptr_, policy_app_id()) + .WillByDefault(Return(kPolicyAppId_)); + } + + MockApplicationManager mock_app_manager_; + const std::string kPolicyAppId_; + const uint32_t kHmiApplicationId_; + const uint32_t kConnectionKey_; + utils::SharedPtr<smart_objects::SmartObject> cmd_ptr_; + utils::SharedPtr<MockApplication> mock_app_ptr_; +}; + +TEST_F(CommandHolderImplTest, HoldOne_ExpectReleaseOne) { + am::CommandHolderImpl cmd_holder(mock_app_manager_); + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); + + // Act + EXPECT_CALL(mock_app_manager_, ManageHMICommand(cmd_ptr_)); + cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand); +} + +TEST_F(CommandHolderImplTest, HoldMany_ExpectReleaseSame) { + am::CommandHolderImpl cmd_holder(mock_app_manager_); + + int32_t iterations = 0; + do { + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); + ++iterations; + } while (iterations < 5); + + // Act + EXPECT_CALL(mock_app_manager_, ManageHMICommand(cmd_ptr_)).Times(iterations); + cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand); +} + +TEST_F(CommandHolderImplTest, Hold_Drop_ExpectNoReleased) { + am::CommandHolderImpl cmd_holder(mock_app_manager_); + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); + + // Act + cmd_holder.Clear(mock_app_ptr_); + EXPECT_CALL(mock_app_manager_, ManageHMICommand(cmd_ptr_)).Times(0); + cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand); +} + +TEST_F(CommandHolderImplTest, Hold_ReleaseAnotherId_ExpectNoReleased) { + am::CommandHolderImpl cmd_holder(mock_app_manager_); + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); + + // Act + utils::SharedPtr<MockApplication> another_app = + utils::MakeShared<MockApplication>(); + + EXPECT_CALL(mock_app_manager_, ManageHMICommand(cmd_ptr_)).Times(0); + cmd_holder.Resume(another_app, am::CommandHolder::CommandType::kHmiCommand); +} + +TEST_F(CommandHolderImplTest, Hold_DropAnotherId_ExpectReleased) { + am::CommandHolderImpl cmd_holder(mock_app_manager_); + + int32_t iterations = 0; + do { + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); + ++iterations; + } while (iterations < 3); + + // Act + utils::SharedPtr<MockApplication> another_app = + utils::MakeShared<MockApplication>(); + cmd_holder.Clear(another_app); + + EXPECT_CALL(mock_app_manager_, ManageHMICommand(cmd_ptr_)).Times(iterations); + cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand); +} + +TEST_F(CommandHolderImplTest, Hold_Mobile_and_HMI_commands_ExpectReleased) { + am::CommandHolderImpl cmd_holder(mock_app_manager_); + + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); + + cmd_holder.Suspend( + mock_app_ptr_, am::CommandHolder::CommandType::kMobileCommand, cmd_ptr_); + + // Act + EXPECT_CALL(mock_app_manager_, ManageHMICommand(cmd_ptr_)); + cmd_holder.Resume(mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand); + + EXPECT_CALL( + mock_app_manager_, + ManageMobileCommand(cmd_ptr_, + am::commands::Command::CommandOrigin::ORIGIN_MOBILE)); + cmd_holder.Resume(mock_app_ptr_, + am::CommandHolder::CommandType::kMobileCommand); +} + +} // application_manager_test +} // components +} // test diff --git a/src/components/application_manager/test/commands/CMakeLists.txt b/src/components/application_manager/test/commands/CMakeLists.txt index cc16e4d87b..8dafc16471 100644 --- a/src/components/application_manager/test/commands/CMakeLists.txt +++ b/src/components/application_manager/test/commands/CMakeLists.txt @@ -46,6 +46,7 @@ set(COMMANDS_TEST_DIR ${AM_TEST_DIR}/commands) file(GLOB SOURCES ${COMMANDS_TEST_DIR}/* ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc + ${COMPONENTS_DIR}/application_manager/test/mock_application_helper.cc ${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc ${COMPONENTS_DIR}/application_manager/src/message.cc ${COMMANDS_TEST_DIR}/hmi/* @@ -57,13 +58,13 @@ set(LIBRARIES gmock Utils SmartObjects - jsoncpp HMI_API MOBILE_API ApplicationManager AMHMICommandsLibrary AMMobileCommandsLibrary connectionHandler + jsoncpp ) create_cotired_test("commands_test" "${SOURCES}" "${LIBRARIES}" ) diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc index fd660af210..ff9634cbb1 100644 --- a/src/components/application_manager/test/commands/command_impl_test.cc +++ b/src/components/application_manager/test/commands/command_impl_test.cc @@ -83,8 +83,8 @@ class CommandImplTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: class UnwrappedCommandImpl : CommandImpl { public: - using CommandImpl::ReplaceMobileByHMIAppId; - using CommandImpl::ReplaceHMIByMobileAppId; + using CommandImpl::ReplaceMobileWithHMIAppId; + using CommandImpl::ReplaceHMIWithMobileAppId; UnwrappedCommandImpl(const MessageSharedPtr& message, ApplicationManager& application_manager) @@ -151,16 +151,16 @@ TEST_F(CommandImplTest, GetMethods_SUCCESS) { EXPECT_NO_THROW(command->onTimeOut()); } -TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_NoAppIdInMessage_UNSUCCESS) { +TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_NoAppIdInMessage_UNSUCCESS) { MessageSharedPtr msg; UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); EXPECT_CALL(app_mngr_, application(_)).Times(0); - command->ReplaceMobileByHMIAppId(*msg); + command->ReplaceMobileWithHMIAppId(*msg); } -TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_SUCCESS) { +TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::app_id] = kAppId1; @@ -171,12 +171,12 @@ TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_SUCCESS) { EXPECT_CALL(app_mngr_, application(kAppId1)).WillOnce(Return(app)); ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceMobileByHMIAppId(*msg); + command->ReplaceMobileWithHMIAppId(*msg); EXPECT_EQ(kAppId2, (*msg)[strings::app_id].asUInt()); } -TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Array_SUCCESS) { +TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_Array_SUCCESS) { MessageSharedPtr msg = CreateArrayMessage(kDefaultMsgCount); UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); @@ -187,14 +187,14 @@ TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Array_SUCCESS) { .WillRepeatedly(Return(app)); ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceMobileByHMIAppId(*msg); + command->ReplaceMobileWithHMIAppId(*msg); EXPECT_TRUE(msg->asArray()); std::for_each( msg->asArray()->begin(), msg->asArray()->end(), ExpectEqualAppId); } -TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Map_SUCCESS) { +TEST_F(CommandImplTest, ReplaceMobileWithHMIAppId_Map_SUCCESS) { MessageSharedPtr msg = CreateMapMessage(kDefaultMsgCount); UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); @@ -205,7 +205,7 @@ TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Map_SUCCESS) { .WillRepeatedly(Return(app)); ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceMobileByHMIAppId(*msg); + command->ReplaceMobileWithHMIAppId(*msg); std::set<std::string> keys(msg->enumerate()); std::for_each(keys.begin(), @@ -213,16 +213,17 @@ TEST_F(CommandImplTest, ReplaceMobileByHMIAppId_Map_SUCCESS) { std::bind2nd(std::ptr_fun(&ExpectEqualKeyAppId), msg)); } -TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_NoHMIAppIdInMessage_UNSUCCESS) { +TEST_F(CommandImplTest, + ReplaceHMIWithMobileAppId_NoHMIAppIdInMessage_UNSUCCESS) { MessageSharedPtr msg; UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); EXPECT_CALL(app_mngr_, application_by_hmi_app(_)).Times(0); - command->ReplaceHMIByMobileAppId(*msg); + command->ReplaceHMIWithMobileAppId(*msg); } -TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_SUCCESS) { +TEST_F(CommandImplTest, ReplaceHMIWithMobileAppId_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::app_id] = kAppId1; @@ -233,12 +234,12 @@ TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_SUCCESS) { EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppId1)).WillOnce(Return(app)); ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceHMIByMobileAppId(*msg); + command->ReplaceHMIWithMobileAppId(*msg); EXPECT_EQ(kAppId2, (*msg)[strings::app_id].asUInt()); } -TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Array_SUCCESS) { +TEST_F(CommandImplTest, ReplaceHMIWithMobileAppId_Array_SUCCESS) { MessageSharedPtr msg = CreateArrayMessage(kDefaultMsgCount); UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); @@ -249,14 +250,14 @@ TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Array_SUCCESS) { .WillRepeatedly(Return(app)); ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceHMIByMobileAppId(*msg); + command->ReplaceHMIWithMobileAppId(*msg); EXPECT_TRUE(msg->asArray()); std::for_each( msg->asArray()->begin(), msg->asArray()->end(), ExpectEqualAppId); } -TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Map_SUCCESS) { +TEST_F(CommandImplTest, ReplaceHMIWithMobileAppId_Map_SUCCESS) { MessageSharedPtr msg = CreateMapMessage(kDefaultMsgCount); UCommandImplPtr command = CreateCommand<UCommandImpl>(msg); @@ -267,7 +268,7 @@ TEST_F(CommandImplTest, ReplaceHMIByMobileAppId_Map_SUCCESS) { .WillRepeatedly(Return(app)); ON_CALL(*app, app_id()).WillByDefault(Return(kAppId2)); - command->ReplaceHMIByMobileAppId(*msg); + command->ReplaceHMIWithMobileAppId(*msg); std::set<std::string> keys = msg->enumerate(); std::for_each(keys.begin(), diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc index 1948608b9f..4493c54d3c 100644 --- a/src/components/application_manager/test/commands/command_request_impl_test.cc +++ b/src/components/application_manager/test/commands/command_request_impl_test.cc @@ -64,7 +64,6 @@ using ::testing::_; using ::testing::Return; using ::testing::SaveArg; using ::testing::DoAll; -using ::testing::Mock; using ::utils::SharedPtr; using am::commands::MessageSharedPtr; @@ -128,14 +127,6 @@ class CommandRequestImplTest } }; - CommandRequestImplTest() - : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - ~CommandRequestImplTest() { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) { app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set); MockAppPtr app(CreateMockApp()); @@ -147,7 +138,6 @@ class CommandRequestImplTest } sync_primitives::Lock app_set_lock_; - am::MockMessageHelper& mock_message_helper_; }; typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl; @@ -308,8 +298,8 @@ TEST_F(CommandRequestImplTest, SendHMIRequest_UseEvent_SUCCESS) { TEST_F(CommandRequestImplTest, RemoveDisallowedParameters_SUCCESS) { am::VehicleData vehicle_data; - vehicle_data.insert( - am::VehicleData::value_type(kMissedParam, am::VehicleDataType::MYKEY)); + vehicle_data.insert(am::VehicleData::value_type( + kMissedParam, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); @@ -425,8 +415,8 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) { TEST_F(CommandRequestImplTest, AddDisallowedParameters_SUCCESS) { am::VehicleData vehicle_data; - vehicle_data.insert(am::VehicleData::value_type(kDisallowedParam1, - am::VehicleDataType::MYKEY)); + vehicle_data.insert(am::VehicleData::value_type( + kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); @@ -477,8 +467,8 @@ TEST_F(CommandRequestImplTest, SendResponse_SUCCESS) { TEST_F(CommandRequestImplTest, SendResponse_AddDisallowedParametersToInfo_SUCCESS) { am::VehicleData vehicle_data; - vehicle_data.insert(am::VehicleData::value_type(kDisallowedParam1, - am::VehicleDataType::MYKEY)); + vehicle_data.insert(am::VehicleData::value_type( + kDisallowedParam1, mobile_apis::VehicleDataType::VEHICLEDATA_MYKEY)); EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); diff --git a/src/components/application_manager/test/commands/hmi/activate_app_request_test.cc b/src/components/application_manager/test/commands/hmi/activate_app_request_test.cc index 771d13924c..7f7911a01d 100644 --- a/src/components/application_manager/test/commands/hmi/activate_app_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/activate_app_request_test.cc @@ -34,9 +34,9 @@ #include "application_manager/commands/hmi/activate_app_request.h" #include "utils/shared_ptr.h" #include "smart_objects/smart_object.h" -#include "application_manager/mock_application.h" #include "application_manager/commands/command_impl.h" #include "commands/commands_test.h" +#include "application_manager/mock_application.h" namespace test { namespace components { @@ -45,12 +45,16 @@ namespace hmi_commands_test { namespace activate_app_request { using ::testing::_; +using ::utils::SharedPtr; namespace am = ::application_manager; namespace strings = ::application_manager::strings; using am::commands::MessageSharedPtr; using am::commands::ActivateAppRequest; using am::commands::CommandImpl; +using ::test::components::application_manager_test::MockApplication; + +typedef SharedPtr<MockApplication> MockAppPtr; typedef ::utils::SharedPtr<ActivateAppRequest> ActivateAppRequestPtr; MATCHER_P(CheckMessage, level, "") { @@ -83,10 +87,13 @@ class ActivateAppRequestTest : public CommandsTest<CommandsTestMocks::kIsNice> { TEST_F(ActivateAppRequestTest, Run_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); + MockAppPtr app = CreateMockApp(); + + EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app)); + + ON_CALL(*app, hmi_app_id()).WillByDefault(Return(kAppId)); - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, application(kAppId)).WillOnce(Return(mock_app)); -// TODO(OKozlov) Invastigate and fix issue with using log +// TODO(OKozlov) Investigate and fix issue with using log #ifdef ENABLE_LOG (*msg)[strings::msg_params][strings::activate_app_hmi_level] = mobile_apis::HMILevel::HMI_FULL; diff --git a/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc b/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc index 0fe76ae16d..980b6e0e9d 100644 --- a/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc +++ b/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc @@ -90,12 +90,6 @@ class GetSystemInfoResponseTest return command_msg; } - void SetUp() OVERRIDE { - message_helper_mock_ = - application_manager::MockMessageHelper::message_helper_mock(); - } - - am::MockMessageHelper* message_helper_mock_; MockHMICapabilities mock_hmi_capabilities_; SmartObject capabilities_; }; @@ -114,7 +108,7 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_SUCCESS) { .WillOnce(ReturnRef(mock_hmi_capabilities_)); std::string language; - EXPECT_CALL(*message_helper_mock_, + EXPECT_CALL(mock_message_helper_, CommonLanguageToString( static_cast<hmi_apis::Common_Language::eType>(lang_code))) .WillOnce(Return(language)); @@ -140,7 +134,7 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UNSUCCESS) { EXPECT_CALL(app_mngr_, hmi_capabilities()).Times(0); - EXPECT_CALL(*message_helper_mock_, + EXPECT_CALL(mock_message_helper_, CommonLanguageToString( static_cast<hmi_apis::Common_Language::eType>(lang_code))) .Times(0); diff --git a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc index 9af72a7925..5a40a4e582 100644 --- a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc +++ b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc @@ -130,14 +130,14 @@ #include "application_manager/policies/mock_policy_handler_interface.h" #include "application_manager/mock_message_helper.h" #include "protocol_handler/mock_session_observer.h" +#include "application_manager/mock_resume_ctrl.h" + #ifdef SDL_REMOTE_CONTROL #include "functional_module/plugin_manager.h" #endif // SDL_REMOTE_CONTROL namespace am = application_manager; -static am::MockMessageHelper* message_helper_mock_; - namespace test { namespace components { namespace commands_test { @@ -150,7 +150,6 @@ using ::testing::Types; using ::testing::Return; using ::testing::ReturnRef; using ::testing::NiceMock; -using ::testing::Mock; using ::testing::InSequence; using ::utils::SharedPtr; using ::smart_objects::SmartObject; @@ -223,16 +222,11 @@ class HMICommandsNotificationsTest CommandsTestMocks::kIsNice> { public: HMICommandsNotificationsTest() - : applications_(application_set_, applications_lock_), app_ptr_(NULL) { - message_helper_mock_ = - application_manager::MockMessageHelper::message_helper_mock(); - Mock::VerifyAndClearExpectations(message_helper_mock_); - } + : applications_(application_set_, applications_lock_), app_ptr_(NULL) {} ~HMICommandsNotificationsTest() { // Fix DataAccessor release and WinQt crash Mock::VerifyAndClearExpectations(&app_mngr_); - Mock::VerifyAndClearExpectations(message_helper_mock_); } typedef Command CommandType; @@ -842,7 +836,7 @@ TEST_F(HMICommandsNotificationsTest, utils::SharedPtr<Command> command = CreateCommand<OnSystemInfoChangedNotification>(message); - EXPECT_CALL(*message_helper_mock_, CommonLanguageToString(_)); + EXPECT_CALL(mock_message_helper_, CommonLanguageToString(_)); EXPECT_CALL(app_mngr_, GetPolicyHandler()); EXPECT_CALL(policy_interface_, OnSystemInfoChanged(_)); command->Run(); @@ -1037,10 +1031,16 @@ TEST_F(HMICommandsNotificationsTest, kCorrelationId_; MessageSharedPtr temp_message = CreateMessage(); + resumprion_test::MockResumeCtrl mock_resume_ctrl; + EXPECT_CALL(app_mngr_, resume_controller()) + .WillOnce(ReturnRef(mock_resume_ctrl)); + EXPECT_CALL(mock_resume_ctrl, OnSuspend()); + EXPECT_CALL(app_mngr_, GetNextHMICorrelationID()) .WillOnce(Return(kCorrelationId_)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)) .WillOnce(GetMessage(temp_message)); + command->Run(); EXPECT_EQ( static_cast<uint32_t>( @@ -1116,7 +1116,7 @@ TEST_F(HMICommandsNotificationsTest, #endif // SDL_REMOTE_CONTROL EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_)); - EXPECT_CALL(*message_helper_mock_, + EXPECT_CALL(mock_message_helper_, GetOnAppInterfaceUnregisteredNotificationToMobile( kAppId_, *it_mobile_reason)).WillOnce(Return(notification)); EXPECT_CALL(app_mngr_, @@ -1441,7 +1441,7 @@ TEST_F(HMICommandsNotificationsTest, .WillOnce(ReturnRef(mock_state_controller_)); EXPECT_CALL(mock_state_controller_, SetRegularState(app_, mobile_apis::HMILevel::HMI_NONE, false)); - EXPECT_CALL(*message_helper_mock_, + EXPECT_CALL(mock_message_helper_, GetOnAppInterfaceUnregisteredNotificationToMobile( kAppId_, mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE)) @@ -1595,7 +1595,10 @@ TEST_F(HMICommandsNotificationsTest, ON_CALL(mock_connection_handler_, get_session_observer()) .WillByDefault(ReturnRef(mock_session_observer_)); const int32_t device_id = 1; - ON_CALL(mock_session_observer_, GetDataOnDeviceID(_, NULL, NULL, _, NULL)) + ON_CALL( + mock_session_observer_, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), NULL, NULL, _, NULL)) .WillByDefault(Return(device_id)); EXPECT_CALL(policy_interface_, GetUserConsentForDevice(_)) @@ -1645,7 +1648,10 @@ TEST_F(HMICommandsNotificationsTest, ON_CALL(mock_connection_handler_, get_session_observer()) .WillByDefault(ReturnRef(mock_session_observer_)); const int32_t device_id = 1; - ON_CALL(mock_session_observer_, GetDataOnDeviceID(_, NULL, NULL, _, NULL)) + ON_CALL( + mock_session_observer_, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), NULL, NULL, _, NULL)) .WillByDefault(Return(device_id)); EXPECT_CALL(policy_interface_, GetUserConsentForDevice(_)) @@ -1764,7 +1770,7 @@ TEST_F(HMICommandsNotificationsTest, ManageMobileCommand(_, Command::CommandOrigin::ORIGIN_SDL)); EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_)); EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang)); - EXPECT_CALL(*message_helper_mock_, + EXPECT_CALL(mock_message_helper_, GetOnAppInterfaceUnregisteredNotificationToMobile( kAppId_, mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE)) @@ -1872,7 +1878,7 @@ TEST_F(HMICommandsNotificationsTest, ManageMobileCommand(_, Command::CommandOrigin::ORIGIN_SDL)); EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_)); EXPECT_CALL(*app_ptr_, ui_language()).WillRepeatedly(ReturnRef(kLang)); - EXPECT_CALL(*message_helper_mock_, + EXPECT_CALL(mock_message_helper_, GetOnAppInterfaceUnregisteredNotificationToMobile( kAppId_, mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE)) diff --git a/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc index 27a77ba990..73a43342f1 100644 --- a/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc @@ -55,7 +55,6 @@ using ::testing::ReturnRef; namespace am = ::application_manager; using am::commands::MessageSharedPtr; using am::commands::RCIsReadyRequest; -using am::MockMessageHelper; using am::event_engine::Event; typedef SharedPtr<RCIsReadyRequest> RCIsReadyRequestPtr; @@ -102,7 +101,7 @@ class RCIsReadyRequestTest void ExpectSendMessagesToHMI() { smart_objects::SmartObjectSPtr capabilities( new smart_objects::SmartObject(smart_objects::SmartType_Map)); - EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), + EXPECT_CALL(mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::RC_GetCapabilities, _)) .WillOnce(Return(capabilities)); EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities)); diff --git a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc index 3805df5834..d36b55ee25 100644 --- a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc @@ -62,7 +62,6 @@ using testing::Return; using testing::ReturnRef; using testing::Mock; using ::testing::NiceMock; -using am::MockMessageHelper; using policy_test::MockPolicyHandlerInterface; using am::event_engine::Event; @@ -102,15 +101,9 @@ MATCHER_P2(CheckMsgParams, result, corr_id, "") { class SDLActivateAppRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { protected: - SDLActivateAppRequestTest() - : message_helper_mock_(am::MockMessageHelper::message_helper_mock()) { - Mock::VerifyAndClearExpectations(message_helper_mock_); - } - ~SDLActivateAppRequestTest() { // Fix DataAccessor release and WinQt crash Mock::VerifyAndClearExpectations(&app_mngr_); - Mock::VerifyAndClearExpectations(message_helper_mock_); } void InitCommand(const uint32_t& timeout) OVERRIDE { @@ -127,7 +120,6 @@ class SDLActivateAppRequestTest ApplicationSet app_list_; ::sync_primitives::Lock lock_; - am::MockMessageHelper* message_helper_mock_; policy_test::MockPolicyHandlerInterface policy_handler_; application_manager_test::MockStateController mock_state_controller_; NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_; @@ -220,7 +212,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) { const std::string package = "package"; ON_CALL(*mock_app_first, PackageName()).WillByDefault(Return(package)); - EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _)); + EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _)); command->Run(); } @@ -299,7 +291,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) { ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle)); EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true)); - EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _)); + EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _)); command->Run(); } @@ -328,7 +320,6 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotActive_SUCCESS) { } TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) { - Mock::VerifyAndClearExpectations(&message_helper_mock_); MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); @@ -363,10 +354,9 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) { ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle)); EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(true)); - EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, schema, package_name, _)); + EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, schema, package_name, _)); command->Run(); - Mock::VerifyAndClearExpectations(&message_helper_mock_); } TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) { @@ -397,7 +387,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) { Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(false)); - EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _)); + EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _)); command->Run(); } @@ -432,7 +422,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) { Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5)); EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true)); - EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _)); + EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _)); command->Run(); } diff --git a/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc b/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc index 5ef54f7be5..66fedda3ca 100644 --- a/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc @@ -73,10 +73,6 @@ namespace strings = ::application_manager::strings; class SDLGetUserFriendlyMessageRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { - public: - SDLGetUserFriendlyMessageRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {} - protected: void SetUp() OVERRIDE { mock_app_ = CreateMockApp(); @@ -90,7 +86,6 @@ class SDLGetUserFriendlyMessageRequestTest } MockAppPtr mock_app_; MockPolicyHandlerInterface mock_policy_handler_; - MockMessageHelper& mock_message_helper_; }; TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_LanguageSet_SUCCESS) { diff --git a/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc index 23146eec9a..66b1317870 100644 --- a/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc @@ -54,12 +54,10 @@ namespace ui_is_ready_request { namespace am = ::application_manager; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; using am::commands::MessageSharedPtr; using am::commands::UIIsReadyRequest; -using am::MockMessageHelper; using am::event_engine::Event; typedef SharedPtr<UIIsReadyRequest> UIIsReadyRequestPtr; @@ -67,14 +65,11 @@ typedef SharedPtr<UIIsReadyRequest> UIIsReadyRequestPtr; class UIIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - UIIsReadyRequestTest() - : command_(CreateCommand<UIIsReadyRequest>()) - , mock_message_helper_(*MockMessageHelper::message_helper_mock()) {} + UIIsReadyRequestTest() : command_(CreateCommand<UIIsReadyRequest>()) {} void SetUp() OVERRIDE { ON_CALL(app_mngr_, hmi_capabilities()) .WillByDefault(ReturnRef(mock_hmi_capabilities_)); - Mock::VerifyAndClearExpectations(&mock_message_helper_); } void SetUpExpectations(bool is_ui_cooperating_available, bool is_send_message_to_hmi, @@ -151,7 +146,6 @@ class UIIsReadyRequestTest } UIIsReadyRequestPtr command_; - MockMessageHelper& mock_message_helper_; application_manager_test::MockHMICapabilities mock_hmi_capabilities_; policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_; }; diff --git a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc index 1e15d4ab60..557afa98d0 100644 --- a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc @@ -57,7 +57,6 @@ using ::testing::Return; namespace am = ::application_manager; using am::commands::MessageSharedPtr; using am::commands::VIIsReadyRequest; -using am::MockMessageHelper; using am::event_engine::Event; typedef SharedPtr<VIIsReadyRequest> VIIsReadyRequestPtr; @@ -103,7 +102,7 @@ class VIIsReadyRequestTest void ExpectSendMessagesToHMI() { smart_objects::SmartObjectSPtr ivi_type; EXPECT_CALL( - *(MockMessageHelper::message_helper_mock()), + mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _)) .WillOnce(Return(ivi_type)); EXPECT_CALL(app_mngr_, ManageHMICommand(ivi_type)); diff --git a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc index 64735a77e2..c9403b2f0e 100644 --- a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc +++ b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc @@ -55,7 +55,6 @@ using ::testing::ReturnRef; namespace am = ::application_manager; using am::commands::MessageSharedPtr; using am::commands::VRIsReadyRequest; -using am::MockMessageHelper; using am::event_engine::Event; typedef SharedPtr<VRIsReadyRequest> VRIsReadyRequestPtr; @@ -105,7 +104,7 @@ class VRIsReadyRequestTest smart_objects::SmartObjectSPtr language( new smart_objects::SmartObject(smart_objects::SmartType_Map)); - EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), + EXPECT_CALL(mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _)) .WillOnce(Return(language)); EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language)); @@ -114,14 +113,14 @@ class VRIsReadyRequestTest smart_objects::SmartObjectSPtr support_language( new smart_objects::SmartObject(smart_objects::SmartType_Map)); EXPECT_CALL( - *(MockMessageHelper::message_helper_mock()), + mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, _)) .WillOnce(Return(support_language)); EXPECT_CALL(app_mngr_, ManageHMICommand(support_language)); smart_objects::SmartObjectSPtr capabilities( new smart_objects::SmartObject(smart_objects::SmartType_Map)); - EXPECT_CALL(*(MockMessageHelper::message_helper_mock()), + EXPECT_CALL(mock_message_helper_, CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _)) .WillOnce(Return(capabilities)); EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities)); diff --git a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc index dec0ffe7ad..471f0763de 100644 --- a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc @@ -61,11 +61,9 @@ using am::commands::CommandImpl; using am::ApplicationManager; using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; -using am::MockMessageHelper; using ::testing::_; using ::utils::SharedPtr; using ::testing::Return; -using ::testing::Mock; using ::testing::InSequence; using am::commands::AddCommandRequest; using NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr; @@ -105,19 +103,13 @@ class AddCommandRequestTest AddCommandRequestTest() : msg_(CreateMessage()) , default_app_name_("test_default_app_name_") - , mock_message_helper_(*MockMessageHelper::message_helper_mock()) , mock_app_(CreateMockApp()) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillRepeatedly(Return(mock_app_)); InitGetters(); InitBasicMessage(); } - ~AddCommandRequestTest() { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - protected: void InitBasicMessage() { (*msg_)[params][connection_key] = kConnectionKey; @@ -209,7 +201,8 @@ class AddCommandRequestTest EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); EXPECT_CALL(app_mngr_, ManageHMICommand(HMIResultCodeIs(cmd_to_delete))) .WillOnce(Return(true)); - SmartObjectSPtr response; + SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map); + (*response)[strings::msg_params][strings::info] = "info"; EXPECT_CALL( mock_message_helper_, CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR)) @@ -226,7 +219,6 @@ class AddCommandRequestTest MessageSharedPtr msg_; SmartObjectSPtr so_ptr_; const utils::custom_string::CustomString default_app_name_; - am::MockMessageHelper& mock_message_helper_; sync_primitives::Lock lock_; MockAppPtr mock_app_; }; @@ -516,9 +508,6 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) { utils::SharedPtr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); request_ptr->on_event(event); } @@ -530,9 +519,6 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) { Event event(hmi_apis::FunctionID::VR_AddCommand); event.set_smart_object(*msg); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(*mock_app_, AddCommand(kCmdId, (*msg_)[msg_params])); am::CommandsMap commands_map; @@ -619,9 +605,6 @@ TEST_F(AddCommandRequestTest, utils::SharedPtr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::REJECTED)) - .WillOnce(Return(mobile_apis::Result::REJECTED)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); EXPECT_CALL(app_mngr_, ManageMobileCommand( @@ -695,9 +678,6 @@ TEST_F( .WillOnce(Return(true)); } - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::GENERIC_ERROR)) - .WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); utils::SharedPtr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); @@ -742,9 +722,6 @@ TEST_F( .WillOnce(Return(true)); } - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::GENERIC_ERROR)) - .WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR)); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); utils::SharedPtr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); @@ -973,9 +950,6 @@ TEST_F(AddCommandRequestTest, event_ui.set_smart_object(*msg_ui); Event event_vr(hmi_apis::FunctionID::VR_AddCommand); event_vr.set_smart_object(*msg_); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::ABORTED)) - .WillOnce(Return(mobile_apis::Result::ABORTED)); EXPECT_CALL( app_mngr_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand))) @@ -1015,9 +989,6 @@ TEST_F(AddCommandRequestTest, utils::SharedPtr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::ABORTED)) - .WillOnce(Return(mobile_apis::Result::ABORTED)); Event event_ui(hmi_apis::FunctionID::UI_AddCommand); event_ui.set_smart_object(*msg_); @@ -1042,7 +1013,8 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(ApplicationSharedPtr())); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0); - SmartObjectSPtr response; + SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map); + (*response)[strings::msg_params][strings::info] = "info"; EXPECT_CALL( mock_message_helper_, CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR)) @@ -1091,7 +1063,8 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); - SmartObjectSPtr response; + SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map); + (*response)[strings::msg_params][strings::info] = "info"; EXPECT_CALL( mock_message_helper_, CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR)) diff --git a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc index 9617f91016..f5bb7888d8 100644 --- a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc @@ -54,9 +54,7 @@ namespace am = ::application_manager; using am::commands::AddSubMenuRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; -using am::MockMessageHelper; using ::testing::_; -using ::testing::Mock; using ::testing::Return; typedef SharedPtr<AddSubMenuRequest> AddSubMenuPtr; @@ -66,12 +64,7 @@ const uint32_t kConnectionKey = 2u; } // namespace class AddSubMenuRequestTest - : public CommandRequestTest<CommandsTestMocks::kIsNice> { - public: - AddSubMenuRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {} - MockMessageHelper& mock_message_helper_; -}; + : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { const uint32_t menu_id = 10u; @@ -97,10 +90,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { Event event(hmi_apis::FunctionID::UI_AddSubMenu); event.set_smart_object(*ev_msg); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MessageSharedPtr ui_command_result; EXPECT_CALL( app_mngr_, @@ -123,7 +112,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { .asString() .empty()); } - Mock::VerifyAndClearExpectations(&mock_message_helper_); } } // namespace add_sub_menu_request diff --git a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc index ee0662e5c6..90c6409fa8 100644 --- a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc @@ -63,7 +63,6 @@ namespace am = ::application_manager; using am::commands::AlertManeuverRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; -using am::MockMessageHelper; typedef SharedPtr<AlertManeuverRequest> CommandPtr; @@ -87,11 +86,6 @@ class AlertManeuverRequestTest MockAppPtr mock_app(CreateMockApp()); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); - MockMessageHelper* mock_message_helper = - MockMessageHelper::message_helper_mock(); - EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(state)); @@ -145,7 +139,8 @@ TEST_F(AlertManeuverRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) { TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_UNSUCCESS) { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); - (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0; + (*msg)[am::strings::msg_params][am::strings::soft_buttons][0] + [am::strings::text] = "text"; CommandPtr command(CreateCommand<AlertManeuverRequest>(msg)); @@ -158,8 +153,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_UNSUCCESS) { const mobile_apis::Result::eType kProcessingResult = mobile_apis::Result::ABORTED; - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), - ProcessSoftButtons(_, _, _, _)) + EXPECT_CALL(mock_message_helper_, ProcessSoftButtons(_, _, _, _)) .WillOnce(Return(kProcessingResult)); MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command))); @@ -195,7 +189,8 @@ TEST_F(AlertManeuverRequestTest, Run_IsWhiteSpaceExist_UNSUCCESS) { TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); - (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0; + (*msg)[am::strings::msg_params][am::strings::soft_buttons][0] + [am::strings::text] = "text"; CommandPtr command(CreateCommand<AlertManeuverRequest>(msg)); @@ -205,8 +200,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) { ON_CALL(app_mngr_, GetPolicyHandler()) .WillByDefault(ReturnRef(policy_interface_)); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), - ProcessSoftButtons(_, _, _, _)) + EXPECT_CALL(mock_message_helper_, ProcessSoftButtons(_, _, _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) @@ -215,8 +209,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) { EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), - SubscribeApplicationToSoftButton(_, _, _)); + EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _)); MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command))); EXPECT_EQ(hmi_apis::FunctionID::Navigation_AlertManeuver, @@ -237,30 +230,30 @@ TEST_F(AlertManeuverRequestTest, OnEvent_ReceivedUnknownEvent_UNSUCCESS) { .asInt())); } -TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case1) { +TEST_F(AlertManeuverRequestTest, OnEvent_SUCCESS) { CheckExpectations(hmi_apis::Common_Result::SUCCESS, - mobile_apis::Result::UNSUPPORTED_RESOURCE, + mobile_apis::Result::SUCCESS, am::HmiInterfaces::STATE_AVAILABLE, true); } -TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case2) { - CheckExpectations(hmi_apis::Common_Result::SUCCESS, +TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE) { + CheckExpectations(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, mobile_apis::Result::UNSUPPORTED_RESOURCE, - am::HmiInterfaces::STATE_NOT_AVAILABLE, - true); + am::HmiInterfaces::STATE_AVAILABLE, + false); } -TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case3) { - CheckExpectations(hmi_apis::Common_Result::SUCCESS, - mobile_apis::Result::UNSUPPORTED_RESOURCE, +TEST_F(AlertManeuverRequestTest, OnEvent_WARNINGS) { + CheckExpectations(hmi_apis::Common_Result::WARNINGS, + mobile_apis::Result::WARNINGS, am::HmiInterfaces::STATE_NOT_RESPONSE, true); } -TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case4) { +TEST_F(AlertManeuverRequestTest, OnEvent_GENERIC_ERROR) { CheckExpectations(hmi_apis::Common_Result::GENERIC_ERROR, - mobile_apis::Result::UNSUPPORTED_RESOURCE, + mobile_apis::Result::GENERIC_ERROR, am::HmiInterfaces::STATE_NOT_RESPONSE, false); } diff --git a/src/components/application_manager/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_request_test.cc index f83a40843c..5d9e507511 100644 --- a/src/components/application_manager/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/alert_request_test.cc @@ -60,7 +60,6 @@ using ::utils::SharedPtr; using am::event_engine::Event; using policy_test::MockPolicyHandlerInterface; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -79,10 +78,7 @@ const mobile_apis::FunctionID::eType kFunctionId = class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - AlertRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) - , msg_(CreateMessage()) {} + AlertRequestTest() : mock_app_(CreateMockApp()), msg_(CreateMessage()) {} protected: MessageSharedPtr CreateFullParamsUISO() { @@ -116,10 +112,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { info); } - void SetUp() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - void PreConditions() { ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); @@ -128,12 +120,12 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault( - Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE)); + Return(am::HmiInterfaces::InterfaceState::STATE_AVAILABLE)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault( - Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE)); + Return(am::HmiInterfaces::InterfaceState::STATE_AVAILABLE)); } void Expectations() { @@ -155,9 +147,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } void AddAlertTextsToMsg() { (*msg_)[am::strings::msg_params][am::strings::alert_text1] = "alert_text1"; (*msg_)[am::strings::msg_params][am::strings::alert_text2] = "alert_text2"; @@ -192,7 +181,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { } sync_primitives::Lock lock_; - MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; MessageSharedPtr msg_; MockPolicyHandlerInterface mock_policy_handler_; @@ -248,9 +236,6 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) { (*msg)[am::strings::msg_params][am::strings::info] = "UI is not supported by system"; - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); - MessageSharedPtr msg_tts = CreateMessage(); (*msg_tts)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::SUCCESS; @@ -263,9 +248,6 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) { event.set_smart_object(*msg); MessageSharedPtr ui_command_result; - ON_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillByDefault(Return(am::mobile_api::Result::UNSUPPORTED_RESOURCE)); EXPECT_CALL( app_mngr_, ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) @@ -302,14 +284,6 @@ TEST_F(AlertRequestTest, Init_DurationNotExists_SUCCESS) { EXPECT_TRUE(command->Init()); } -TEST_F(AlertRequestTest, OnTimeOut_UNSUCCESS) { - Expectations(); - (*msg_)[am::strings::msg_params][am::strings::soft_buttons] = 0; - CommandPtr command(CreateCommand<AlertRequest>(msg_)); - command->onTimeOut(); - EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0); -} - TEST_F(AlertRequestTest, OnTimeOut_SUCCESS) { Expectations(); MessageSharedPtr result_msg(CreateMessage(smart_objects::SmartType_Null)); @@ -442,8 +416,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_UI_OnResetTimeout_SUCCESS) { Event event(hmi_apis::FunctionID::UI_OnResetTimeout); event.set_smart_object(*msg_); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); command->on_event(event); } @@ -504,8 +476,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) { Event event(hmi_apis::FunctionID::TTS_Speak); event.set_smart_object(*msg_); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); command->on_event(event); } @@ -574,16 +544,12 @@ TEST_F(AlertRequestTest, Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking); tts_stop_event.set_smart_object(*msg_); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); command->on_event(tts_stop_event); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::WARNINGS); Event event(hmi_apis::FunctionID::TTS_Speak); event.set_smart_object(*msg_); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); command->on_event(event); } @@ -711,8 +677,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) { Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking); tts_stop_event.set_smart_object(*msg_); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); command->on_event(tts_stop_event); (*msg_)[am::strings::params][am::hmi_response::code] = @@ -722,8 +686,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) { Event event(hmi_apis::FunctionID::TTS_Speak); event.set_smart_object(*msg_); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); command->on_event(event); } @@ -750,8 +712,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) { Event ui_event(hmi_apis::FunctionID::UI_Alert); ui_event.set_smart_object(*msg_); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); command->on_event(ui_event); Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking); @@ -762,8 +722,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) { Event event(hmi_apis::FunctionID::TTS_Speak); event.set_smart_object(*msg_); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); command->on_event(event); } diff --git a/src/components/application_manager/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/test/commands/mobile/change_registration_test.cc index 2fd43a6353..3d7671015c 100644 --- a/src/components/application_manager/test/commands/mobile/change_registration_test.cc +++ b/src/components/application_manager/test/commands/mobile/change_registration_test.cc @@ -66,7 +66,6 @@ using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; using ::testing::_; -using ::testing::Mock; using ::utils::SharedPtr; using ::testing::Return; using ::testing::ReturnRef; @@ -80,7 +79,6 @@ namespace strings = ::application_manager::strings; namespace hmi_response = ::application_manager::hmi_response; namespace { -const int32_t kCommandId = 1; const uint32_t kAppId = 1u; const uint32_t kCmdId = 1u; const uint32_t kConnectionKey = 2u; @@ -90,8 +88,7 @@ class ChangeRegistrationRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: ChangeRegistrationRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) + : mock_app_(CreateMockApp()) , supported_languages_(CreateMessage(smart_objects::SmartType_Array)) {} MessageSharedPtr CreateMsgFromMobile() { @@ -121,26 +118,26 @@ class ChangeRegistrationRequestTest EXPECT_CALL( mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration)) - .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); + .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL( mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration)) - .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); + .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL( mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration)) - .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); + .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) - .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); } void CheckExpectations(const hmi_apis::Common_Result::eType hmi_response, @@ -148,14 +145,11 @@ class ChangeRegistrationRequestTest const am::HmiInterfaces::InterfaceState state, const bool success, const hmi_apis::Common_Result::eType ui_hmi_response = - hmi_apis::Common_Result::WARNINGS, + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, const hmi_apis::Common_Result::eType vr_hmi_response = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_from_mobile = CreateMsgFromMobile(); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_response)); - utils::SharedPtr<ChangeRegistrationRequest> command = CreateCommand<ChangeRegistrationRequest>(msg_from_mobile); MockAppPtr mock_app = CreateMockApp(); @@ -173,6 +167,8 @@ class ChangeRegistrationRequestTest EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); EXPECT_CALL(*app, name()).WillOnce(ReturnRef(name)); PrepareExpectationBeforeRun(); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) + .WillRepeatedly(Return(state)); command->Run(); MessageSharedPtr ui_response = CreateMessage(smart_objects::SmartType_Map); @@ -184,9 +180,6 @@ class ChangeRegistrationRequestTest (*tts_response)[strings::params][hmi_response::code] = hmi_response; (*tts_response)[strings::msg_params] = 0; - EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) - .WillRepeatedly(Return(state)); - am::event_engine::Event event_ui( hmi_apis::FunctionID::UI_ChangeRegistration); event_ui.set_smart_object(*ui_response); @@ -251,10 +244,6 @@ class ChangeRegistrationRequestTest .WillByDefault(ReturnRef(hmi_capabilities_)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - void ExpectationsHmiCapabilities( smart_objects::SmartObjectSPtr supported_languages) { EXPECT_CALL(hmi_capabilities_, ui_supported_languages()) @@ -282,7 +271,6 @@ class ChangeRegistrationRequestTest MockHMICapabilities; sync_primitives::Lock app_set_lock_; MockHMICapabilities hmi_capabilities_; - MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; MessageSharedPtr supported_languages_; MockPolicyHandlerInterface mock_policy_handler_; @@ -379,11 +367,52 @@ TEST_F(ChangeRegistrationRequestTest, } TEST_F(ChangeRegistrationRequestTest, - OnEvent_TTS_UNSUPPORTED_RESOURCE_STATE_NOT_AVAILABLE_Expect_true) { - CheckExpectations(hmi_apis::Common_Result::SUCCESS, - mobile_apis::Result::UNSUPPORTED_RESOURCE, - am::HmiInterfaces::STATE_NOT_AVAILABLE, - true); + OnEvent_TTS_UNSUPPORTED_RESOURCE_STATE_NOT_AVAILABLE_Expect_false) { + MessageSharedPtr msg_from_mobile = CreateMsgFromMobile(); + utils::SharedPtr<ChangeRegistrationRequest> command = + CreateCommand<ChangeRegistrationRequest>(msg_from_mobile); + MockAppPtr mock_app = CreateMockApp(); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + ON_CALL(*mock_app, app_id()).WillByDefault(Return(1)); + am::ApplicationSet application_set; + const utils::custom_string::CustomString name("name"); + MockAppPtr app = CreateMockApp(); + app->set_name(name); + DataAccessor<am::ApplicationSet> accessor(application_set, app_set_lock_); + application_set.insert(app); + EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); + EXPECT_CALL(*app, name()).WillOnce(ReturnRef(name)); + + ON_CALL(app_mngr_, hmi_capabilities()) + .WillByDefault(ReturnRef(hmi_capabilities_)); + (*supported_languages_)[0] = + static_cast<int32_t>(mobile_apis::Language::EN_US); + EXPECT_CALL(hmi_capabilities_, ui_supported_languages()) + .WillOnce(Return(supported_languages_.get())); + EXPECT_CALL(hmi_capabilities_, vr_supported_languages()) + .WillOnce(Return(supported_languages_.get())); + EXPECT_CALL(hmi_capabilities_, tts_supported_languages()) + .WillOnce(Return(supported_languages_.get())); + + EXPECT_CALL(app_mngr_, hmi_interfaces()) + .WillRepeatedly(ReturnRef(mock_hmi_interfaces_)); + + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) + .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + + MessageSharedPtr response_to_mobile; + EXPECT_CALL( + app_mngr_, + ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) + .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); + command->Run(); + + EXPECT_EQ( + (*response_to_mobile)[strings::msg_params][strings::success].asBool(), + false); + EXPECT_EQ( + (*response_to_mobile)[strings::msg_params][strings::result_code].asInt(), + static_cast<int32_t>(mobile_apis::Result::UNSUPPORTED_RESOURCE)); } TEST_F(ChangeRegistrationRequestTest, @@ -403,17 +432,17 @@ TEST_F(ChangeRegistrationRequestTest, } TEST_F(ChangeRegistrationRequestTest, - OnEvent_TTS_UNSUPPORTED_RESOURCE_SUCCESS_STATE_AVAILABLE_Expect_false) { + OnEvent_TTS_UNSUPPORTED_RESOURCE_SUCCESS_STATE_AVAILABLE_Expect_true) { CheckExpectations(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, mobile_apis::Result::UNSUPPORTED_RESOURCE, am::HmiInterfaces::STATE_AVAILABLE, - false, + true, hmi_apis::Common_Result::SUCCESS, hmi_apis::Common_Result::SUCCESS); } TEST_F(ChangeRegistrationRequestTest, - OnEvent_TTS_SUCCESS_STATE_AVAILABLE_Expect_false) { + OnEvent_TTS_SUCCESS_STATE_AVAILABLE_Expect_true) { CheckExpectations(hmi_apis::Common_Result::SUCCESS, mobile_apis::Result::SUCCESS, am::HmiInterfaces::STATE_AVAILABLE, @@ -425,7 +454,7 @@ TEST_F(ChangeRegistrationRequestTest, TEST_F(ChangeRegistrationRequestTest, OnEvent_TTS_WRONG_LANGUAGE_STATE_AVAILABLE_Expect_true) { CheckExpectations(hmi_apis::Common_Result::WRONG_LANGUAGE, - mobile_apis::Result::SUCCESS, + mobile_apis::Result::WRONG_LANGUAGE, am::HmiInterfaces::STATE_AVAILABLE, true, hmi_apis::Common_Result::SUCCESS, @@ -435,7 +464,7 @@ TEST_F(ChangeRegistrationRequestTest, TEST_F(ChangeRegistrationRequestTest, OnEvent_TTS_INVALID_DATA_STATE_AVAILABLE_Expect_false) { CheckExpectations(hmi_apis::Common_Result::INVALID_DATA, - mobile_apis::Result::SUCCESS, + mobile_apis::Result::INVALID_DATA, am::HmiInterfaces::STATE_AVAILABLE, false, hmi_apis::Common_Result::SUCCESS, @@ -473,14 +502,14 @@ TEST_F(ChangeRegistrationRequestTest, .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL( mock_hmi_interfaces_, @@ -488,7 +517,7 @@ TEST_F(ChangeRegistrationRequestTest, .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); command->Run(); diff --git a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc index a627740588..c3513d2acb 100644 --- a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc @@ -65,7 +65,6 @@ using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; using ::testing::_; -using ::testing::Mock; using ::utils::SharedPtr; using ::testing::Return; using ::testing::ReturnRef; @@ -112,15 +111,9 @@ class CreateInteractionChoiceSetRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: CreateInteractionChoiceSetRequestTest() - : message_helper_mock_(*am::MockMessageHelper::message_helper_mock()) - , message_(CreateMessage()) + : message_(CreateMessage()) , command_(CreateCommand<CreateInteractionChoiceSetRequest>(message_)) - , mock_app_(CreateMockApp()) { - Mock::VerifyAndClearExpectations(&message_helper_mock_); - } - ~CreateInteractionChoiceSetRequestTest() { - Mock::VerifyAndClearExpectations(&message_helper_mock_); - } + , mock_app_(CreateMockApp()) {} MessageSharedPtr CreateFullParamsVRSO() { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); @@ -162,7 +155,6 @@ class CreateInteractionChoiceSetRequestTest [am::strings::interaction_choice_set_id] = kChoiceSetId; } - MockMessageHelper& message_helper_mock_; MessageSharedPtr message_; CreateInteractionChoiceSetRequestPtr command_; MockAppPtr mock_app_; @@ -230,9 +222,6 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { ON_CALL(*mock_app_, FindCommand(kCmdId)).WillByDefault(Return(ptr)); EXPECT_EQ(NULL, ptr); - ON_CALL(message_helper_mock_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); - am::CommandsMap commands_map; ON_CALL(*mock_app_, commands_map()) .WillByDefault( @@ -282,7 +271,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_VerifyImageFail_UNSUCCESS) { [am::strings::secondary_image] = kSecondImage; EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::INVALID_DATA)); EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0); @@ -298,7 +287,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_FindChoiceSetFail_UNSUCCESS) { kChoiceSetId; EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* invalid_choice_set_id = @@ -333,7 +322,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -370,7 +359,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, .WillRepeatedly(Return(choice_set_id)); EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); if ((*message_)[am::strings::msg_params][am::strings::choice_set][0] @@ -439,7 +428,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, FillMessageFieldsItem2(message_); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -478,7 +467,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -524,7 +513,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) { EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -557,7 +546,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, FillMessageFieldsItem2(message_); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -591,7 +580,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, kChoiceSetId; ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -638,7 +627,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -678,7 +667,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) { EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -718,7 +707,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] = kChoiceSetId; - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); smart_objects::SmartObject* choice_set_id = NULL; @@ -791,7 +780,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) { kChoiceSetId; ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); - EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _)) + EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR)); smart_objects::SmartObject* choice_set_id = NULL; diff --git a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc index efa889a2c1..c92ec81a1f 100644 --- a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc @@ -53,7 +53,6 @@ namespace mobile_commands_test { namespace delete_command_request { using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; namespace am = ::application_manager; @@ -61,6 +60,7 @@ using am::commands::DeleteCommandRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; using am::MockMessageHelper; +using am::MockHmiInterfaces; typedef SharedPtr<DeleteCommandRequest> DeleteCommandPtr; @@ -74,9 +74,7 @@ const uint32_t kConnectionKey = 2u; class DeleteCommandRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - DeleteCommandRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) {} + DeleteCommandRequestTest() : mock_app_(CreateMockApp()) {} MessageSharedPtr CreateFullParamsUISO() { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; @@ -129,13 +127,11 @@ class DeleteCommandRequestTest ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); + ON_CALL(app_mngr_, hmi_interfaces()) + .WillByDefault(ReturnRef(hmi_interfaces_)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - MockMessageHelper& mock_message_helper_; + NiceMock<MockHmiInterfaces> hmi_interfaces_; MockAppPtr mock_app_; }; @@ -154,14 +150,14 @@ TEST_F(DeleteCommandRequestTest, (*test_msg)[am::strings::vr_commands] = 0; (*test_msg)[am::strings::menu_params] = 0; - ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) + ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR)); - ON_CALL(mock_hmi_interfaces_, + ON_CALL(hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(mock_hmi_interfaces_, + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); + ON_CALL(hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL(*mock_app_, FindCommand(kCommandId)) .WillByDefault(Return(test_msg.get())); ON_CALL(*mock_app_, get_grammar_id()).WillByDefault(Return(kConnectionKey)); @@ -171,7 +167,7 @@ TEST_F(DeleteCommandRequestTest, hmi_apis::Common_Result::SUCCESS; Event event_ui(hmi_apis::FunctionID::UI_DeleteCommand); event_ui.set_smart_object(*msg); - + command->Init(); command->Run(); command->on_event(event_ui); @@ -185,6 +181,8 @@ TEST_F(DeleteCommandRequestTest, EXPECT_CALL(*mock_app_, RemoveCommand(kCommandId)); + EXPECT_CALL(*mock_app_, UpdateHash()); + MessageSharedPtr vr_command_result; EXPECT_CALL( app_mngr_, @@ -212,14 +210,14 @@ TEST_F(DeleteCommandRequestTest, (*test_msg)[am::strings::vr_commands] = 0; (*test_msg)[am::strings::menu_params] = 0; - ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) + ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(mock_hmi_interfaces_, + ON_CALL(hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(mock_hmi_interfaces_, + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); + ON_CALL(hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL(*app, FindCommand(kCommandId)).WillByDefault(Return(test_msg.get())); ON_CALL(*app, get_grammar_id()).WillByDefault(Return(kConnectionKey)); @@ -229,6 +227,7 @@ TEST_F(DeleteCommandRequestTest, Event event_vr(hmi_apis::FunctionID::VR_DeleteCommand); event_vr.set_smart_object(*msg); + command->Init(); command->Run(); command->on_event(event_vr); @@ -242,6 +241,8 @@ TEST_F(DeleteCommandRequestTest, EXPECT_CALL(*app, RemoveCommand(kCommandId)); + EXPECT_CALL(*app, UpdateHash()); + MessageSharedPtr result_msg( CatchMobileCommandResult(CallOnEvent(*command, event_ui))); diff --git a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc index a6d9d8f50a..192cad12b0 100644 --- a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc +++ b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc @@ -53,7 +53,6 @@ namespace mobile_commands_test { namespace delete_interaction_choice_set { using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::InSequence; diff --git a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc index beff4c3584..cc21e5366e 100644 --- a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc +++ b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc @@ -51,7 +51,6 @@ namespace mobile_commands_test { namespace delete_sub_menu_request { using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; using ::testing::InSequence; @@ -97,22 +96,14 @@ class DeleteSubMenuRequestTest public: DeleteSubMenuRequestTest() : accessor_(commands_map_, commands_lock_) - , mock_message_helper_(*MockMessageHelper::message_helper_mock()) , message_(CreateMessage()) , command_(CreateCommand<DeleteSubMenuRequest>(message_)) - , app_(CreateMockApp()) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - ~DeleteSubMenuRequestTest() { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } + , app_(CreateMockApp()) {} am::CommandsMap commands_map_; mutable sync_primitives::Lock commands_lock_; DataAccessor<am::CommandsMap> accessor_; - MockMessageHelper& mock_message_helper_; MessageSharedPtr message_; DeleteSubMenuRequestPtr command_; MockAppPtr app_; @@ -149,10 +140,6 @@ TEST_F(DeleteSubMenuRequestTest, DISABLED_OnEvent_UI_UNSUPPORTED_RESOURCE) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - am::CommandsMap commands_map; smart_objects::SmartObject commands_msg(smart_objects::SmartType_Map); commands_map.insert(std::pair<uint32_t, SmartObject*>(1u, &commands_msg)); @@ -243,9 +230,6 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_InvalidApp_UNSUCCESS) { (*message_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::eType::SUCCESS; event.set_smart_object(*message_); - ON_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS)) - .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); MockAppPtr invalid_app; EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(invalid_app)); EXPECT_CALL(*app_, RemoveSubMenu(_)).Times(0); @@ -265,8 +249,6 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { const hmi_apis::Common_Result::eType result_code = hmi_apis::Common_Result::SUCCESS; (*message_)[am::strings::params][am::hmi_response::code] = result_code; - ON_CALL(mock_message_helper_, HMIToMobileResult(result_code)) - .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); event.set_smart_object(*message_); commands_map_.insert( @@ -318,10 +300,6 @@ TEST_F(DeleteSubMenuRequestTest, commands_map_.insert( std::make_pair(0, &((*message_)[am::strings::msg_params]))); - ON_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0); EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); @@ -345,9 +323,6 @@ TEST_F(DeleteSubMenuRequestTest, commands_map_.insert( std::make_pair(0, &((*message_)[am::strings::msg_params]))); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillRepeatedly(Return(am::mobile_api::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0); EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_)); diff --git a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc index 60697446f2..4f46a6f715 100644 --- a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc @@ -71,17 +71,7 @@ const uint32_t kDiagnosticMode = 5u; } // namespace class DiagnosticMessageRequestTest - : public CommandRequestTest<CommandsTestMocks::kIsNice> { - public: - DiagnosticMessageRequestTest() - : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) { - testing::Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - ~DiagnosticMessageRequestTest() { - testing::Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - am::MockMessageHelper& mock_message_helper_; -}; + : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; TEST_F(DiagnosticMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) { MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); @@ -181,10 +171,6 @@ TEST_F(DiagnosticMessageRequestTest, OnEvent_SUCCESS) { DiagnosticMessageRequestPtr command( CreateCommand<DiagnosticMessageRequest>()); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); diff --git a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc index b8c0ed23f3..33733f63ed 100644 --- a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc @@ -53,7 +53,6 @@ namespace end_audio_pass_thru_request { namespace am = ::application_manager; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; using am::commands::MessageSharedPtr; @@ -64,12 +63,7 @@ using am::MockMessageHelper; typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr; class EndAudioPassThruRequestTest - : public CommandRequestTest<CommandsTestMocks::kIsNice> { - public: - EndAudioPassThruRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {} - MockMessageHelper& mock_message_helper_; -}; + : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) { const uint32_t kConnectionKey = 2u; @@ -89,10 +83,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) { Event event(hmi_apis::FunctionID::UI_EndAudioPassThru); event.set_smart_object(*event_msg); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(false)); MessageSharedPtr ui_command_result; @@ -120,7 +110,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) { .asString() .empty()); } - Mock::VerifyAndClearExpectations(&mock_message_helper_); } } // namespace end_audio_pass_thru_request diff --git a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc index dfa38a758b..106a59803b 100644 --- a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc @@ -69,9 +69,7 @@ typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr; class GetDTCsRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() { - Mock::VerifyAndClearExpectations(message_helper_mock_); - } + GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {} }; TEST_F(GetDTCsRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) { @@ -125,11 +123,7 @@ TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) { Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs); event.set_smart_object(*event_msg); - MockMessageHelper& mock_message_helper = - *MockMessageHelper::message_helper_mock(); - ON_CALL(mock_message_helper, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _)); diff --git a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc index a851a72f8e..52aed6feb8 100644 --- a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc @@ -70,19 +70,7 @@ const uint32_t kConnectionKey = 2u; } // namespace class GetVehicleDataRequestTest - : public CommandRequestTest<CommandsTestMocks::kIsNice> { - public: - GetVehicleDataRequestTest() - : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) { - testing::Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - ~GetVehicleDataRequestTest() { - testing::Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - am::MockMessageHelper& mock_message_helper_; -}; + : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; class UnwrappedGetVehicleDataRequest : public GetVehicleDataRequest { public: @@ -201,8 +189,8 @@ TEST_F(GetVehicleDataRequestTest, Run_SUCCESS) { CreateCommand<GetVehicleDataRequest>(command_msg)); am::VehicleData vehicle_data; - vehicle_data.insert( - am::VehicleData::value_type(kMsgParamKey, am::VehicleDataType::SPEED)); + vehicle_data.insert(am::VehicleData::value_type( + kMsgParamKey, mobile_apis::VehicleDataType::VEHICLEDATA_SPEED)); EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); @@ -235,7 +223,7 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) { const hmi_apis::Common_Result::eType hmi_response_code = hmi_apis::Common_Result::DATA_NOT_AVAILABLE; const mobile_result::eType mobile_response_code = - mobile_result::VEHICLE_DATA_NOT_AVAILABLE; + mobile_result::DATA_NOT_AVAILABLE; MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); (*command_msg)[am::strings::params][am::strings::connection_key] = @@ -251,10 +239,6 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) { Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData); event.set_smart_object(*event_msg); - - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code)) - .WillOnce(Return(mobile_response_code)); - EXPECT_CALL(app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _)); diff --git a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc index d886a2b1bd..979fb0cc83 100644 --- a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc @@ -53,7 +53,6 @@ namespace get_way_points_request { using namespace mobile_apis::Result; using ::testing::Return; -using ::testing::Mock; using ::testing::_; using application_manager::commands::GetWayPointsRequest; using application_manager::MockMessageHelper; @@ -61,6 +60,7 @@ using application_manager::MockHmiInterfaces; typedef SharedPtr<GetWayPointsRequest> CommandPtr; typedef mobile_apis::Result::eType MobileResult; +typedef hmi_apis::Common_Result::eType HmiResult; namespace { const uint32_t kCorrelationId = 2u; @@ -72,14 +72,7 @@ const std::string kMethodName = "Navigation.GetWayPoints"; class GetWayPointsRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - GetWayPointsRequestTest() - : message_helper_mock_(*am::MockMessageHelper::message_helper_mock()) { - Mock::VerifyAndClearExpectations(&message_helper_mock_); - } - - ~GetWayPointsRequestTest() { - Mock::VerifyAndClearExpectations(&message_helper_mock_); - } + GetWayPointsRequestTest() : mock_app_(CreateMockApp()) {} void SetUp() OVERRIDE { message_ = utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map); @@ -89,14 +82,9 @@ class GetWayPointsRequestTest command_sptr_ = CreateCommand<application_manager::commands::GetWayPointsRequest>( message_); - mock_app_ = CreateMockApp(); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); - - ON_CALL(message_helper_mock_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::SUCCESS)); } - MockMessageHelper& message_helper_mock_; MockAppPtr mock_app_; MessageSharedPtr message_; utils::SharedPtr<application_manager::commands::GetWayPointsRequest> @@ -106,17 +94,10 @@ class GetWayPointsRequestTest class GetWayPointsRequestOnEventTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - GetWayPointsRequestOnEventTest() - : message_helper_mock_(*am::MockMessageHelper::message_helper_mock()) - , app_(CreateMockApp()) { - Mock::VerifyAndClearExpectations(&message_helper_mock_); - } - ~GetWayPointsRequestOnEventTest() { - Mock::VerifyAndClearExpectations(&message_helper_mock_); - } + GetWayPointsRequestOnEventTest() : app_(CreateMockApp()) {} void CheckOnEventResponse(const std::string& wayPointsParam, - const MobileResult ResultCode, + const HmiResult ResultCode, const bool success) { Event event(Event::EventID::Navigation_GetWayPoints); CommandPtr command(CreateCommand<GetWayPointsRequest>()); @@ -131,17 +112,13 @@ class GetWayPointsRequestOnEventTest event.set_smart_object(*event_msg); - EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_)) - .WillOnce(Return(ResultCode)); - - MockAppPtr app(CreateMockApp()); - EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app)); + const MobileResult mobile_result = static_cast<MobileResult>(ResultCode); MessageSharedPtr result_msg( CatchMobileCommandResult(CallOnEvent(*command, event))); EXPECT_EQ( - ResultCode, - static_cast<mobile_apis::Result::eType>( + mobile_result, + static_cast<MobileResult>( (*result_msg)[am::strings::msg_params][am::strings::result_code] .asInt())); EXPECT_EQ( @@ -150,7 +127,6 @@ class GetWayPointsRequestOnEventTest } protected: - MockMessageHelper& message_helper_mock_; MockAppPtr app_; MockHmiInterfaces hmi_interfaces_; }; @@ -246,15 +222,15 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_WrongEventId_UNSUCCESS) { } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case1) { - CheckOnEventResponse("0", SUCCESS, true); + CheckOnEventResponse("0", HmiResult::SUCCESS, true); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case2) { - CheckOnEventResponse("", SUCCESS, true); + CheckOnEventResponse("", HmiResult::SUCCESS, true); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case3) { - CheckOnEventResponse("test", SUCCESS, true); + CheckOnEventResponse("test", HmiResult::SUCCESS, true); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case1) { @@ -265,7 +241,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case1) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - CheckOnEventResponse(" ", GENERIC_ERROR, false); + CheckOnEventResponse(" ", HmiResult::GENERIC_ERROR, false); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case2) { @@ -276,7 +252,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case2) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - CheckOnEventResponse("test\t", GENERIC_ERROR, false); + CheckOnEventResponse("test\t", HmiResult::GENERIC_ERROR, false); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case3) { @@ -287,7 +263,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case3) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - CheckOnEventResponse("test\n", GENERIC_ERROR, false); + CheckOnEventResponse("test\n", HmiResult::GENERIC_ERROR, false); } TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case4) { @@ -298,7 +274,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case4) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - CheckOnEventResponse("test\t\n", GENERIC_ERROR, false); + CheckOnEventResponse("test\t\n", HmiResult::GENERIC_ERROR, false); } } // namespace get_way_points_request diff --git a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc index 9ef978d756..6d7ccb1fa0 100644 --- a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc @@ -56,19 +56,7 @@ using testing::ReturnRef; using testing::_; class OnHashChangeNotificationTest - : public CommandsTest<CommandsTestMocks::kIsNice> { - public: - OnHashChangeNotificationTest() - : message_helper_(*MockMessageHelper::message_helper_mock()) {} - void SetUp() OVERRIDE { - Mock::VerifyAndClearExpectations(&message_helper_); - } - - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&message_helper_); - } - MockMessageHelper& message_helper_; -}; + : public CommandsTest<CommandsTestMocks::kIsNice> {}; TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) { const uint32_t kConnectionKey = 1u; @@ -83,7 +71,8 @@ TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app)); EXPECT_CALL(*mock_app, curHash()).WillOnce(ReturnRef(return_string)); - EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false)); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)) + .WillOnce(Return(false)); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)); command->Run(); @@ -112,7 +101,7 @@ TEST_F(OnHashChangeNotificationTest, Run_InvalidApp_NoNotification) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(MockAppPtr())); EXPECT_CALL(*mock_app, curHash()).Times(0); - EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0); command->Run(); diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc index 34f8a010d8..78875ad164 100644 --- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc @@ -235,16 +235,12 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, EXPECT_CALL(*mock_app, is_foreground()).WillOnce(Return(true)); - application_manager::MockMessageHelper& mock_message_helper = - *application_manager::MockMessageHelper::message_helper_mock(); - Mock::VerifyAndClearExpectations(&mock_message_helper); - EXPECT_CALL(mock_message_helper, SendQueryApps(kConnectionKey, _)); + EXPECT_CALL(mock_message_helper_, SendQueryApps(kConnectionKey, _)); command->Run(); ASSERT_EQ(application_manager::MessageType::kNotification, (*msg)[strings::params][strings::message_type].asInt()); - Mock::VerifyAndClearExpectations(&mock_message_helper); } TEST_F(OnHMIStatusNotificationFromMobileTest, diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc index 2da0e60df1..9cb5610621 100644 --- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc @@ -59,9 +59,6 @@ using testing::_; class OnHMIStatusNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: - OnHMIStatusNotificationTest() - : message_helper_(*MockMessageHelper::message_helper_mock()) {} - MessageSharedPtr CreateMsgParams( const mobile_apis::HMILevel::eType kHMIState) { MessageSharedPtr msg = CreateMessage(); @@ -70,13 +67,9 @@ class OnHMIStatusNotificationTest return msg; } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&message_helper_); - } - void SetSendNotificationExpectations(MessageSharedPtr& msg) { - Mock::VerifyAndClearExpectations(&message_helper_); - EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false)); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)) + .WillOnce(Return(false)); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)); } @@ -88,8 +81,6 @@ class OnHMIStatusNotificationTest ASSERT_EQ(CommandImpl::protocol_version_, (*msg)[strings::params][strings::protocol_version].asInt()); } - - MockMessageHelper& message_helper_; }; TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) { @@ -141,7 +132,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndFalseProperties_SUCCESS) { EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(false)); EXPECT_CALL(*mock_app, set_tts_properties_in_none(true)); - EXPECT_CALL(message_helper_, SendTTSGlobalProperties(_, false, _)); + EXPECT_CALL(mock_message_helper_, SendTTSGlobalProperties(_, false, _)); command->Run(); diff --git a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc index d56cd98904..7313f32dca 100644 --- a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc @@ -61,11 +61,9 @@ using testing::_; class OnKeyBoardInputNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: - OnKeyBoardInputNotificationTest() - : message_helper_(*MockMessageHelper::message_helper_mock()) {} - void SetSendNotificationExpectations(MessageSharedPtr msg) { - EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false)); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)) + .WillOnce(Return(false)); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)); } @@ -78,14 +76,6 @@ class OnKeyBoardInputNotificationTest (*msg)[strings::params][strings::protocol_version].asInt()); } - void SetUp() OVERRIDE { - Mock::VerifyAndClearExpectations(&message_helper_); - } - - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&message_helper_); - } - MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) { app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set); MockAppPtr app(CreateMockApp()); @@ -95,7 +85,6 @@ class OnKeyBoardInputNotificationTest return app; } - MockMessageHelper& message_helper_; SharedPtr<ApplicationSet> app_set_; sync_primitives::Lock lock_; }; @@ -162,7 +151,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) { EXPECT_CALL(*mock_app, hmi_level()) .WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND)); - EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0); command->Run(); diff --git a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc index 43f725012d..7840e35cec 100644 --- a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc @@ -64,20 +64,7 @@ const uint32_t kConnectionKey = 1u; } // namespace class OnSystemRequestNotificationTest - : public CommandsTest<CommandsTestMocks::kIsNice> { - public: - OnSystemRequestNotificationTest() - : message_helper_(*MockMessageHelper::message_helper_mock()) {} - - void SetUp() OVERRIDE { - Mock::VerifyAndClearExpectations(&message_helper_); - } - - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&message_helper_); - } - MockMessageHelper& message_helper_; -}; + : public CommandsTest<CommandsTestMocks::kIsNice> {}; TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) { const RequestType::eType kRequestType = RequestType::PROPRIETARY; @@ -107,7 +94,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) { EXPECT_CALL(mock_policy_handler, TimeoutExchangeSec()).WillOnce(Return(5u)); #endif // PROPRIETARY_MODE - EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false)); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)) + .WillOnce(Return(false)); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)); command->Run(); @@ -143,7 +131,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) { EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _)) .WillOnce(Return(true)); - EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false)); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)) + .WillOnce(Return(false)); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)); command->Run(); @@ -176,7 +165,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) { MockPolicyHandlerInterface mock_policy_handler; EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _)).Times(0); - EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0); command->Run(); @@ -203,7 +192,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) { EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _)) .WillOnce(Return(false)); - EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0); + EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0); EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0); ; diff --git a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc index d00e62bcfb..05d97856e4 100644 --- a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc @@ -71,11 +71,9 @@ class OnVehicleDataNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: OnVehicleDataNotificationTest() - : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) - , command_msg_(CreateMessage(smart_objects::SmartType_Map)) + : command_msg_(CreateMessage(smart_objects::SmartType_Map)) , command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {} - am::MockMessageHelper& mock_message_helper_; MessageSharedPtr command_msg_; NotificationPtr command_; }; @@ -113,7 +111,8 @@ TEST_F(OnVehicleDataNotificationTest, Run_NotEmptyListOfAppsSubscribedForEvent_SUCCESS) { am::VehicleData test_vehicle_data; test_vehicle_data.insert(am::VehicleData::value_type( - am::strings::fuel_level, am::VehicleDataType::FUELLEVEL)); + am::strings::fuel_level, + mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL)); EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(test_vehicle_data)); @@ -126,9 +125,10 @@ TEST_F(OnVehicleDataNotificationTest, std::vector<ApplicationSharedPtr> applications; applications.push_back(mock_app); - EXPECT_CALL(app_mngr_, - IviInfoUpdated(am::VehicleDataType::FUELLEVEL, kFuelLevel)) - .WillOnce(Return(applications)); + EXPECT_CALL( + app_mngr_, + IviInfoUpdated(mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL, + kFuelLevel)).WillOnce(Return(applications)); EXPECT_CALL(*mock_app, app_id()).WillRepeatedly(Return(kAppId)); ::utils::custom_string::CustomString dummy_name("test_app"); diff --git a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc index e2adc38f50..6c35a5372a 100644 --- a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -57,7 +57,6 @@ using am::commands::MessageSharedPtr; using am::MockMessageHelper; using ::utils::SharedPtr; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; using ::testing::InSequence; @@ -80,8 +79,7 @@ class PerformAudioPassThruRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: PerformAudioPassThruRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) + : mock_app_(CreateMockApp()) , message_(utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map)) , msg_params_((*message_)[am::strings::msg_params]) {} @@ -137,10 +135,6 @@ class PerformAudioPassThruRequestTest ON_CALL(app_mngr_, application(_)).WillByDefault(Return(application_sptr_)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - void ResultCommandExpectations(MessageSharedPtr msg, const std::string& info) { EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(), @@ -153,7 +147,6 @@ class PerformAudioPassThruRequestTest } sync_primitives::Lock lock_; - MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; MessageSharedPtr message_; ::smart_objects::SmartObject& msg_params_; @@ -192,33 +185,33 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) { (*vr_command_result)[am::strings::msg_params][am::strings::result_code] .asInt(), static_cast<int32_t>(am::mobile_api::Result::GENERIC_ERROR)); - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(PerformAudioPassThruRequestTest, OnEvent_UIHmiSendUnsupportedResource_UNSUPPORTED_RESOURCE) { - MessageSharedPtr msg_ui = CreateFullParamsUISO(); - (*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey; + MessageSharedPtr mobile_request = CreateFullParamsUISO(); + (*mobile_request)[am::strings::params][am::strings::connection_key] = + kConnectionKey; + + smart_objects::SmartObject initial_prompt = + smart_objects::SmartObject(smart_objects::SmartType_Array); + initial_prompt[0] = smart_objects::SmartObject(smart_objects::SmartType_Map); + initial_prompt[0][am::strings::text] = "tts chunk text"; + initial_prompt[0][am::strings::type] = 0; + (*mobile_request)[am::strings::msg_params][am::strings::initial_prompt] = + initial_prompt; + EXPECT_CALL(*application_sptr_, hmi_level()) + .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); utils::SharedPtr<PerformAudioPassThruRequest> command = - CreateCommand<PerformAudioPassThruRequest>(msg_ui); - - MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); - (*msg)[am::strings::params][am::hmi_response::code] = - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - (*msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId; - (*msg)[am::strings::msg_params][am::strings::info] = - "UI is not supported by system"; - - am::event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru); - event.set_smart_object(*msg); + CreateCommand<PerformAudioPassThruRequest>(mobile_request); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); MessageSharedPtr response_msg_tts = CreateMessage(smart_objects::SmartType_Map); @@ -227,21 +220,39 @@ TEST_F(PerformAudioPassThruRequestTest, (*response_msg_tts)[am::strings::msg_params][am::strings::cmd_id] = kCmdId; am::event_engine::Event event_tts(hmi_apis::FunctionID::TTS_Speak); event_tts.set_smart_object(*response_msg_tts); - ON_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); - command->on_event(event_tts); - MessageSharedPtr ui_command_result; + MessageSharedPtr response_ui = CreateMessage(smart_objects::SmartType_Map); + (*response_ui)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; + (*response_ui)[am::strings::msg_params][am::strings::cmd_id] = kCommandId; + (*response_ui)[am::strings::msg_params][am::strings::info] = + "UI is not supported by system"; + am::event_engine::Event event_ui( + hmi_apis::FunctionID::UI_PerformAudioPassThru); + event_ui.set_smart_object(*response_ui); + + MessageSharedPtr response_to_mobile; EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(false)); + EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillRepeatedly(Return(true)); EXPECT_CALL( app_mngr_, ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) - .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); + .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); - command->on_event(event); + command->Run(); + command->on_event(event_tts); + command->on_event(event_ui); - ResultCommandExpectations(ui_command_result, "UI is not supported by system"); + EXPECT_EQ((*response_to_mobile)[am::strings::msg_params][am::strings::success] + .asBool(), + false); + EXPECT_EQ( + (*response_to_mobile)[am::strings::msg_params][am::strings::result_code] + .asInt(), + static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)); + EXPECT_EQ((*response_to_mobile)[am::strings::msg_params][am::strings::info] + .asString(), + "UI is not supported by system"); } TEST_F(PerformAudioPassThruRequestTest, @@ -546,10 +557,6 @@ TEST_F(PerformAudioPassThruRequestTest, OnEvent_UIPAPT_Rejected) { hmi_apis::Common_Result::REJECTED; event.set_smart_object(*message_); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::REJECTED)) - .WillOnce(Return(am::mobile_api::Result::REJECTED)); - CallOnEvent caller(*command_sptr_, event); MessageSharedPtr result_message = CatchMobileCommandResult(caller); @@ -582,15 +589,12 @@ TEST_F(PerformAudioPassThruRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(am::mobile_api::Result::SUCCESS)); - CallOnEvent caller(*command_sptr_, event); caller(); } TEST_F(PerformAudioPassThruRequestTest, - OnEvent_PAPTunsupportedResource_CorrectInfo) { + DISABLED_OnEvent_PAPTunsupportedResource_CorrectInfo) { const std::string return_info = "Unsupported phoneme type sent in a prompt"; am::event_engine::Event event_speak(hmi_apis::FunctionID::TTS_Speak); @@ -646,8 +650,6 @@ TEST_F(PerformAudioPassThruRequestTest, EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); CallOnEvent caller(*command_sptr_, event); caller(); @@ -771,8 +773,6 @@ TEST_F(PerformAudioPassThruRequestTest, app_mngr_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking))) .WillOnce(Return(false)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(am::mobile_api::Result::SUCCESS)); command_sptr_->onTimeOut(); } diff --git a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc index 84a0e0b354..a272234e82 100644 --- a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc +++ b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc @@ -63,7 +63,6 @@ using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; using ::testing::_; -using ::testing::Mock; using ::utils::SharedPtr; using ::testing::Return; using ::testing::ReturnRef; @@ -82,9 +81,7 @@ const uint32_t kConnectionKey = 2u; class PerformInteractionRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - PerformInteractionRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) {} + PerformInteractionRequestTest() : mock_app_(CreateMockApp()) {} void SetUp() OVERRIDE { ON_CALL(app_mngr_, application(kConnectionKey)) @@ -92,10 +89,6 @@ class PerformInteractionRequestTest ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - void ResultCommandExpectations(MessageSharedPtr msg, const std::string& info) { EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(), @@ -108,7 +101,6 @@ class PerformInteractionRequestTest } sync_primitives::Lock lock_; - MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -191,10 +183,10 @@ TEST_F(PerformInteractionRequestTest, EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) - .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE)); MessageSharedPtr response_to_mobile; @@ -222,10 +214,10 @@ TEST_F(PerformInteractionRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); MessageSharedPtr response_msg_vr = CreateMessage(smart_objects::SmartType_Map); diff --git a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc index 7e46f6942f..c88f4626f0 100644 --- a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc @@ -90,11 +90,6 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) { event.set_smart_object(*event_msg); - am::MockMessageHelper& mock_message_helper( - *am::MockMessageHelper::message_helper_mock()); - EXPECT_CALL(mock_message_helper, HMIToMobileResult(hmi_response_code)) - .WillOnce(Return(mobile_response_code)); - EXPECT_CALL(app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _)); @@ -102,8 +97,6 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) { EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app)); command->on_event(event); - - testing::Mock::VerifyAndClearExpectations(&mock_message_helper); } TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) { diff --git a/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc index 844f87d57e..b7a004f199 100644 --- a/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc @@ -43,17 +43,19 @@ #include "application_manager/application.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_application.h" +#include "application_manager/mock_application_helper.h" #include "interfaces/MOBILE_API.h" #include "application_manager/smart_object_keys.h" #include "application_manager/policies/mock_policy_handler_interface.h" -#include "utils/data_accessor.h" #include "protocol_handler/mock_session_observer.h" #include "connection_handler/mock_connection_handler.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_resume_ctrl.h" #include "application_manager/mock_hmi_interface.h" +#include "utils/data_accessor.h" #include "utils/custom_string.h" #include "utils/lock.h" +#include "utils/macro.h" namespace test { namespace components { @@ -90,11 +92,22 @@ class RegisterAppInterfaceRequestTest RegisterAppInterfaceRequestTest() : msg_(CreateMessage()) , command_(CreateCommand<RegisterAppInterfaceRequest>(msg_)) - , app_name_("test_app_name_") { + , app_name_("test_app_name_") + , mock_application_helper_( + application_manager_test::MockApplicationHelper:: + application_helper_mock()) { InitGetters(); InitLanguage(); } + void SetUp() OVERRIDE { + testing::Mock::VerifyAndClearExpectations(&mock_application_helper_); + } + + void TearDown() OVERRIDE { + testing::Mock::VerifyAndClearExpectations(&mock_application_helper_); + } + void InitBasicMessage() { (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey; (*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId; @@ -112,6 +125,7 @@ class RegisterAppInterfaceRequestTest ON_CALL(*mock_app, app_icon_path()).WillByDefault(ReturnRef(kDummyString)); ON_CALL(*mock_app, language()).WillByDefault(ReturnRef(kMobileLanguage)); ON_CALL(*mock_app, ui_language()).WillByDefault(ReturnRef(kMobileLanguage)); + ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId)); return mock_app; } @@ -151,6 +165,9 @@ class RegisterAppInterfaceRequestTest .WillByDefault(Return(policy::DeviceConsent::kDeviceAllowed)); ON_CALL(app_mngr_, GetDeviceTransportType(_)) .WillByDefault(Return(hmi_apis::Common_TransportType::WIFI)); + ON_CALL(app_mngr_, IsAppInReconnectMode(_)).WillByDefault(Return(false)); + ON_CALL(app_mngr_, application_by_policy_id(_)) + .WillByDefault(Return(ApplicationSharedPtr())); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); ON_CALL( @@ -167,6 +184,43 @@ class RegisterAppInterfaceRequestTest .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); } + void SetCommonExpectionsOnSwitchedApplication( + MockAppPtr mock_app, mobile_apis::Result::eType response_result_code) { + EXPECT_CALL(mock_policy_handler_, AddApplication(_, _)).Times(0); + + EXPECT_CALL( + app_mngr_, + ManageMobileCommand(MobileResultCodeIs(response_result_code), _)); + + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::BasicCommunication_OnAppRegistered))) + .Times(0); + + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::Buttons_OnButtonSubscription))) + .Times(0); + + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::UI_ChangeRegistration))).Times(0); + + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::TTS_ChangeRegistration))).Times(0); + + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::VR_ChangeRegistration))).Times(0); + + EXPECT_CALL( + app_mngr_, + OnApplicationSwitched( + MockAppPtr::static_pointer_cast<application_manager::Application>( + mock_app))); + } + MessageSharedPtr msg_; SharedPtr<RegisterAppInterfaceRequest> command_; @@ -194,6 +248,7 @@ class RegisterAppInterfaceRequestTest MockConnectionHandler mock_connection_handler_; MockSessionObserver mock_session_observer_; MockHMICapabilities mock_hmi_capabilities_; + application_manager_test::MockApplicationHelper& mock_application_helper_; }; TEST_F(RegisterAppInterfaceRequestTest, Init_SUCCESS) { @@ -353,6 +408,113 @@ TEST_F(RegisterAppInterfaceRequestTest, command_->Run(); } +TEST_F(RegisterAppInterfaceRequestTest, + SwitchApplication_CorrectHash_ExpectNoCleanupSuccess) { + InitBasicMessage(); + + const std::string request_hash_id = "abc123"; + (*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id; + + MockAppPtr mock_app = CreateBasicMockedApp(); + EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId)) + .WillRepeatedly(Return(mock_app)); + + EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true)); + + EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey)); + + EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0); + + EXPECT_CALL( + mock_resume_crt_, + CheckApplicationHash( + MockAppPtr::static_pointer_cast<application_manager::Application>( + mock_app), + request_hash_id)).WillOnce(Return(true)); + + EXPECT_CALL(mock_resume_crt_, RemoveApplicationFromSaved(_)).Times(0); + + EXPECT_CALL(mock_application_helper_, RecallApplicationData(_, _)).Times(0); + + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillRepeatedly(Return(mock_app)); + + SetCommonExpectionsOnSwitchedApplication(mock_app, + mobile_apis::Result::SUCCESS); + + command_->Run(); +} + +TEST_F(RegisterAppInterfaceRequestTest, + SwitchApplication_WrongHash_ExpectCleanupResumeFailed) { + InitBasicMessage(); + + const std::string request_hash_id = "abc123"; + (*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id; + + MockAppPtr mock_app = CreateBasicMockedApp(); + EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId)) + .WillRepeatedly(Return(mock_app)); + + EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true)); + + EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey)); + + EXPECT_CALL( + mock_resume_crt_, + CheckApplicationHash( + MockAppPtr::static_pointer_cast<application_manager::Application>( + mock_app), + request_hash_id)).WillOnce(Return(false)); + + EXPECT_CALL( + mock_application_helper_, + RecallApplicationData( + MockAppPtr::static_pointer_cast<application_manager::Application>( + mock_app), + _)); + + EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0); + + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillRepeatedly(Return(mock_app)); + + SetCommonExpectionsOnSwitchedApplication(mock_app, + mobile_apis::Result::RESUME_FAILED); + + command_->Run(); +} + +TEST_F(RegisterAppInterfaceRequestTest, + SwitchApplication_NoHash_ExpectCleanupResumeFailed) { + InitBasicMessage(); + + MockAppPtr mock_app = CreateBasicMockedApp(); + EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId)) + .WillRepeatedly(Return(mock_app)); + + EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true)); + + EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey)); + + EXPECT_CALL( + mock_application_helper_, + RecallApplicationData( + MockAppPtr::static_pointer_cast<application_manager::Application>( + mock_app), + _)); + + EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0); + + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillRepeatedly(Return(mock_app)); + + SetCommonExpectionsOnSwitchedApplication(mock_app, + mobile_apis::Result::RESUME_FAILED); + + command_->Run(); +} + } // namespace register_app_interface_request } // namespace mobile_commands_test } // namespace commands_test diff --git a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc index e133ec9119..69fee02262 100644 --- a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc @@ -58,7 +58,6 @@ namespace mobile_commands_test { namespace reset_global_properties { using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -83,11 +82,7 @@ class ResetGlobalPropertiesRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { protected: ResetGlobalPropertiesRequestTest() - : mock_message_helper_(am::MockMessageHelper::message_helper_mock()) - , msg_(CreateMessage()) - , mock_app_(CreateMockApp()) { - Mock::VerifyAndClearExpectations(mock_message_helper_); - } + : msg_(CreateMessage()), mock_app_(CreateMockApp()) {} void SetUp() OVERRIDE { (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey; @@ -102,10 +97,6 @@ class ResetGlobalPropertiesRequestTest .WillByDefault(Return(kCorrelationId)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(mock_message_helper_); - } - am::MockMessageHelper* mock_message_helper_; MessageSharedPtr msg_; MockAppPtr mock_app_; ResetGlobalPropertiesRequestPtr command_; @@ -177,7 +168,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) { EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); smart_objects::SmartObjectSPtr vr_help; // = NULL; - EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_)) + EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0); @@ -230,7 +221,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) { smart_objects::SmartObjectSPtr vr_help = ::utils::MakeShared<smart_objects::SmartObject>( smart_objects::SmartType_Map); - EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_)) + EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); smart_objects::SmartObject msg_params = @@ -272,8 +263,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, const hmi_apis::Common_Result::eType result_code = hmi_apis::Common_Result::SUCCESS; (*msg_)[am::strings::params][am::hmi_response::code] = result_code; - ON_CALL(*mock_message_helper_, HMIToMobileResult(result_code)) - .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); (*msg_)[am::strings::msg_params][am::strings::properties][0] = mobile_apis::GlobalProperty::VRHELPTITLE; @@ -285,7 +274,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, smart_objects::SmartObjectSPtr vr_help = ::utils::MakeShared<smart_objects::SmartObject>( smart_objects::SmartType_Map); - EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_)) + EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); command_->Run(); @@ -346,16 +335,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, command_->on_event(event); } -TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) { - Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); - event.set_smart_object(*msg_); - - EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0); - EXPECT_CALL(*mock_app_, UpdateHash()).Times(0); - - command_->on_event(event); -} - TEST_F(ResetGlobalPropertiesResponseTest, Run_Sendmsg_SUCCESS) { MessageSharedPtr message(CreateMessage()); ResetGlobalPropertiesResponsePtr command( @@ -380,7 +359,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) { smart_objects::SmartObjectSPtr vr_help = ::utils::MakeShared<smart_objects::SmartObject>( smart_objects::SmartType_Map); - EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_)) + EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); EXPECT_CALL(*mock_app_, UpdateHash()).Times(0); @@ -389,9 +368,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) { CreateCommand<ResetGlobalPropertiesRequest>(msg_); command->Run(); - EXPECT_CALL(*mock_message_helper_, HMIToMobileResult(_)) - .WillRepeatedly(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), @@ -402,6 +378,186 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) { command->on_event(event); } +TEST_F(ResetGlobalPropertiesRequestTest, + Run_WaitTTS_Timeout_GENERIC_ERROR_TTSNotRespond) { + (*msg_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE; + + (*msg_)[am::strings::msg_params][am::strings::properties][0] = + mobile_apis::GlobalProperty::TIMEOUTPROMPT; + (*msg_)[am::strings::msg_params][am::strings::properties][1] = + mobile_apis::GlobalProperty::MENUICON; + + std::vector<std::string> time_out_prompt; + time_out_prompt.push_back("time_out"); + EXPECT_CALL(app_mngr_settings_, time_out_promt()) + .WillOnce(ReturnRef(time_out_prompt)); + + EXPECT_CALL(*mock_app_, set_timeout_prompt(_)); + + smart_objects::SmartObjectSPtr prompt = + utils::MakeShared<smart_objects::SmartObject>(); + *prompt = "prompt"; + + EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get())); + + EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); + + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::UI_SetGlobalProperties))) + .WillOnce(Return(true)); + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::TTS_SetGlobalProperties))) + .WillOnce(Return(true)); + + ResetGlobalPropertiesRequestPtr command = + CreateCommand<ResetGlobalPropertiesRequest>(msg_); + command->Run(); + + // Received response only from UI + MessageSharedPtr ui_msg = CreateMessage(); + (*ui_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId; + (*ui_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::eType::SUCCESS; + (*ui_msg)[am::strings::msg_params] = + SmartObject(smart_objects::SmartType_Map); + Event ui_event(hmi_apis::FunctionID::UI_SetGlobalProperties); + ui_event.set_smart_object(*ui_msg); + command->on_event(ui_event); + + // TTS doesn't respond, so timeout should send generic error + smart_objects::SmartObjectSPtr response = + utils::MakeShared<smart_objects::SmartObject>(); + (*response)[am::strings::msg_params][am::strings::result_code] = + mobile_apis::Result::GENERIC_ERROR; + EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) + .WillOnce(Return(response)); + const std::string info = "TTS component does not respond"; + EXPECT_CALL( + app_mngr_, + ManageMobileCommand( + MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), + am::commands::Command::ORIGIN_SDL)); + command->onTimeOut(); +} + +TEST_F(ResetGlobalPropertiesRequestTest, + Run_WaitUI_Timeout_GENERIC_ERROR_UINotRespond) { + (*msg_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE; + + (*msg_)[am::strings::msg_params][am::strings::properties][0] = + mobile_apis::GlobalProperty::TIMEOUTPROMPT; + (*msg_)[am::strings::msg_params][am::strings::properties][1] = + mobile_apis::GlobalProperty::MENUICON; + + std::vector<std::string> time_out_prompt; + time_out_prompt.push_back("time_out"); + EXPECT_CALL(app_mngr_settings_, time_out_promt()) + .WillOnce(ReturnRef(time_out_prompt)); + + EXPECT_CALL(*mock_app_, set_timeout_prompt(_)); + + smart_objects::SmartObjectSPtr prompt = + utils::MakeShared<smart_objects::SmartObject>(); + *prompt = "prompt"; + + EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get())); + + EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); + + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::UI_SetGlobalProperties))) + .WillOnce(Return(true)); + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::TTS_SetGlobalProperties))) + .WillOnce(Return(true)); + + command_->Run(); + + // Received response only from TTS + MessageSharedPtr tts_msg = CreateMessage(); + (*tts_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId; + (*tts_msg)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::eType::SUCCESS; + + Event tts_event(hmi_apis::FunctionID::TTS_SetGlobalProperties); + tts_event.set_smart_object(*tts_msg); + command_->on_event(tts_event); + + // UI doesn't respond, so timeout should send generic error + smart_objects::SmartObjectSPtr response = + utils::MakeShared<smart_objects::SmartObject>(); + (*response)[am::strings::msg_params][am::strings::result_code] = + mobile_apis::Result::GENERIC_ERROR; + EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) + .WillOnce(Return(response)); + + const std::string info = "UI component does not respond"; + EXPECT_CALL( + app_mngr_, + ManageMobileCommand( + MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), + am::commands::Command::ORIGIN_SDL)); + command_->onTimeOut(); +} + +TEST_F(ResetGlobalPropertiesRequestTest, + Run_WaitUIAndTTS_Timeout_GENERIC_ERROR_TTSAndUINotRespond) { + Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); + (*msg_)[am::strings::params][am::hmi_response::code] = + hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE; + + (*msg_)[am::strings::msg_params][am::strings::properties][0] = + mobile_apis::GlobalProperty::TIMEOUTPROMPT; + (*msg_)[am::strings::msg_params][am::strings::properties][1] = + mobile_apis::GlobalProperty::MENUICON; + + std::vector<std::string> time_out_prompt; + time_out_prompt.push_back("time_out"); + EXPECT_CALL(app_mngr_settings_, time_out_promt()) + .WillOnce(ReturnRef(time_out_prompt)); + + EXPECT_CALL(*mock_app_, set_timeout_prompt(_)); + + smart_objects::SmartObjectSPtr prompt = + utils::MakeShared<smart_objects::SmartObject>(); + *prompt = "prompt"; + + EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get())); + + EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); + + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::UI_SetGlobalProperties))) + .WillOnce(Return(true)); + EXPECT_CALL(app_mngr_, + ManageHMICommand(HMIResultCodeIs( + hmi_apis::FunctionID::TTS_SetGlobalProperties))) + .WillOnce(Return(true)); + + command_->Run(); + // TTS and UI don't respond, so timeout should send generic error + std::string info = "TTS, UI component does not respond"; + smart_objects::SmartObjectSPtr response = + utils::MakeShared<smart_objects::SmartObject>(); + (*response)[am::strings::msg_params][am::strings::result_code] = + mobile_apis::Result::GENERIC_ERROR; + EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) + .WillOnce(Return(response)); + EXPECT_CALL( + app_mngr_, + ManageMobileCommand( + MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false), + am::commands::Command::ORIGIN_SDL)); + command_->onTimeOut(); +} + } // namespace reset_global_properties } // namespace mobile_commands_test } // namespace commands_test diff --git a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc index d9fac769e5..4520e1b120 100644 --- a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc +++ b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc @@ -65,7 +65,6 @@ using ::utils::SharedPtr; using ::testing::_; using ::testing::Eq; using ::testing::Ref; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -84,9 +83,6 @@ const uint32_t kFunctionID = 3u; class ScrollableMessageRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - ScrollableMessageRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {} - MockMessageHelper& mock_message_helper_; typedef TypeIf<kMocksAreNice, NiceMock<application_manager_test::MockHMICapabilities>, application_manager_test::MockHMICapabilities>::Result @@ -118,11 +114,6 @@ class ScrollableMessageRequestTest ON_CALL(app_mngr_, GetPolicyHandler()) .WillByDefault(ReturnRef(mock_policy_handler_)); command_ = CreateCommand<ScrollableMessageRequest>(msg_); - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); } MockPolicyHandlerInterface mock_policy_handler_; @@ -159,10 +150,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { Event event(hmi_apis::FunctionID::UI_ScrollableMessage); event.set_smart_object(*msg); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MessageSharedPtr ui_command_result; EXPECT_CALL( app_mngr_, @@ -185,7 +172,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { .asString() .empty()); } - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) { @@ -274,8 +260,6 @@ TEST_F(ScrollableMessageRequestTest, DISABLED_OnEvent_ReceivedUIScrollableMessage_SUCCESS) { (*msg_)[params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS; - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _)); @@ -289,9 +273,6 @@ TEST_F(ScrollableMessageRequestTest, (*msg_)[params][hmi_response::code] = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE; - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - EXPECT_CALL( app_mngr_, ManageMobileCommand( diff --git a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc index 03cc715188..c5786675d6 100644 --- a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc @@ -54,7 +54,6 @@ using utils::SharedPtr; using testing::_; using testing::Return; using testing::ReturnRef; -using ::testing::Mock; namespace strings = application_manager::strings; namespace hmi_response = application_manager::hmi_response; @@ -92,18 +91,13 @@ class SendLocationRequestTest typedef SharedPtr<UnwrappedSendLocationRequest> CommandSPrt; - SendLocationRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) { + SendLocationRequestTest() { mock_app_ = CreateMockApp(); disp_cap_ = utils::MakeShared<SmartObject>(smart_objects::SmartType_Map); message_ = CreateMessage(); command_ = CreateCommand<UnwrappedSendLocationRequest>(message_); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - void InitialSetup(MessageSharedPtr message_) { (*message_)[strings::params][strings::connection_key] = kConnectionKey; (*message_)[strings::params][strings::function_id] = kFunctionID; @@ -158,7 +152,6 @@ class SendLocationRequestTest MockAppPtr mock_app_; MockHMICapabilities mock_hmi_capabilities_; - MockMessageHelper& mock_message_helper_; SharedPtr<SmartObject> disp_cap_; MessageSharedPtr message_; CommandSPrt command_; @@ -356,10 +349,6 @@ TEST_F(SendLocationRequestTest, OnEvent_Success) { Event event(hmi_apis::FunctionID::Navigation_SendLocation); event.set_smart_object(*message_); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); - MockAppPtr app(CreateMockApp()); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillRepeatedly(Return(app)); diff --git a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc index 60b01f2cfa..b278479df8 100644 --- a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc @@ -57,7 +57,6 @@ using am::commands::MessageSharedPtr; using am::MockMessageHelper; using ::utils::SharedPtr; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -70,19 +69,6 @@ const uint32_t kConnectionKey = 2u; class SetAppIconRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - SetAppIconRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {} - - void SetUp() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - MockMessageHelper& mock_message_helper_; - MessageSharedPtr CreateFullParamsUISO() { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; @@ -134,10 +120,6 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { Event event(hmi_apis::FunctionID::UI_SetAppIcon); event.set_smart_object(*msg); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MessageSharedPtr ui_command_result; EXPECT_CALL( app_mngr_, diff --git a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc index 68aa76010f..8444b88d63 100644 --- a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc @@ -59,7 +59,6 @@ using am::commands::MessageSharedPtr; using am::MockMessageHelper; using ::utils::SharedPtr; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -80,20 +79,12 @@ MATCHER_P(CheckMshCorrId, corr_id, "") { class SetDisplayLayoutRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - SetDisplayLayoutRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - + SetDisplayLayoutRequestTest() : mock_app_(CreateMockApp()) { ON_CALL(app_mngr_, application(kConnectionKey)) .WillByDefault(Return(mock_app_)); ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); } - ~SetDisplayLayoutRequestTest() { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - MessageSharedPtr CreateFullParamsUISO() { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; @@ -130,7 +121,6 @@ class SetDisplayLayoutRequestTest } sync_primitives::Lock lock_; - MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -164,9 +154,6 @@ TEST_F(SetDisplayLayoutRequestTest, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - ON_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillByDefault(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); MessageSharedPtr ui_command_result; EXPECT_CALL( app_mngr_, @@ -245,17 +232,12 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) { (*dispaly_capabilities_msg)[am::hmi_response::templates_available] = "templates_available"; - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, hmi_capabilities()) .WillOnce(ReturnRef(hmi_capabilities)); EXPECT_CALL(hmi_capabilities, display_capabilities()) .WillOnce(Return(dispaly_capabilities_msg.get())); - ON_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS)) - .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); + EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), diff --git a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc index 7143bdf71a..641e5636a9 100644 --- a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc @@ -59,7 +59,6 @@ using am::CommandsMap; using utils::custom_string::CustomString; using ::utils::SharedPtr; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -75,9 +74,7 @@ const uint32_t kPosition = 1u; class SetGlobalPropertiesRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - SetGlobalPropertiesRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) {} + SetGlobalPropertiesRequestTest() : mock_app_(CreateMockApp()) {} MessageSharedPtr CreateFullParamsUISO() { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); @@ -118,6 +115,8 @@ class SetGlobalPropertiesRequestTest vr_help_array[0][am::strings::text] = kText; vr_help_array[0][am::strings::position] = kPosition; (*msg)[am::strings::msg_params][am::strings::vr_help] = vr_help_array; + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); } void OnEventUISetupHelper(MessageSharedPtr msg, @@ -152,6 +151,8 @@ class SetGlobalPropertiesRequestTest (*msg)[am::strings::msg_params][am::strings::timeout_prompt] = timeout_prompt; + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); @@ -216,10 +217,6 @@ class SetGlobalPropertiesRequestTest .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - void ResultCommandExpectations(MessageSharedPtr msg, const std::string& info) { EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(), @@ -242,13 +239,12 @@ class SetGlobalPropertiesRequestTest .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); } sync_primitives::Lock lock_; - MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -323,6 +319,9 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_SUCCESS_Expect_MessageNotSend) { utils::SharedPtr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(response); + MockAppPtr mock_app(CreateMockApp()); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + EXPECT_CALL( app_mngr_, ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) @@ -348,9 +347,6 @@ TEST_F(SetGlobalPropertiesRequestTest, utils::SharedPtr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(response); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -1032,8 +1028,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) { SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0); - Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); @@ -1061,8 +1055,8 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) { Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -1091,15 +1085,14 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) { .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); OnEventUISetupHelper(msg, command); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL)) .WillOnce(Return(true)); @@ -1126,9 +1119,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) { EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillRepeatedly(Return(MockAppPtr())); @@ -1146,7 +1136,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidEventID_Canceled) { SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0); EXPECT_CALL(app_mngr_, application(kConnectionKey)).Times(0); EXPECT_CALL(*mock_app_, UpdateHash()).Times(0); @@ -1180,8 +1169,8 @@ TEST_F(SetGlobalPropertiesRequestTest, ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL)) .WillOnce(Return(true)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(response_code)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*msg); @@ -1192,7 +1181,7 @@ TEST_F(SetGlobalPropertiesRequestTest, TEST_F(SetGlobalPropertiesRequestTest, OnEvent_TTSAndWarningsResultCode_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - hmi_apis::Common_Result::eType response_code = + const hmi_apis::Common_Result::eType response_code = hmi_apis::Common_Result::WARNINGS; (*msg)[am::strings::params][am::hmi_response::code] = response_code; ON_CALL( @@ -1210,17 +1199,27 @@ TEST_F(SetGlobalPropertiesRequestTest, EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(app_mngr_, - ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL)) - .WillOnce(Return(true)); + MessageSharedPtr ui_command_result; + EXPECT_CALL( + app_mngr_, + ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) + .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*msg); command->on_event(event); + + EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success] + .asBool(), + true); + EXPECT_EQ( + (*ui_command_result)[am::strings::msg_params][am::strings::result_code] + .asInt(), + static_cast<int32_t>(hmi_apis::Common_Result::WARNINGS)); } } // namespace set_global_properties_request diff --git a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc index 3056d0e9fc..cf668c8b36 100644 --- a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc @@ -55,7 +55,6 @@ using am::commands::MessageSharedPtr; using am::event_engine::Event; using am::MockMessageHelper; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -75,9 +74,7 @@ const uint32_t kSeconds = 1u; class SetMediaClockRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - SetMediaClockRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) {} + SetMediaClockRequestTest() : mock_app_(CreateMockApp()) {} void SetUp() OVERRIDE { ON_CALL(app_mngr_, application(kConnectionKey)) @@ -85,10 +82,6 @@ class SetMediaClockRequestTest ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - void ResultCommandExpectations(MessageSharedPtr msg, const std::string& info) { EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(), @@ -114,7 +107,6 @@ class SetMediaClockRequestTest EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)); } - MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; }; @@ -140,10 +132,6 @@ TEST_F(SetMediaClockRequestTest, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_RESPONSE)); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MessageSharedPtr ui_command_result; EXPECT_CALL( app_mngr_, @@ -328,12 +316,9 @@ TEST_F(SetMediaClockRequestTest, Run_InvalidApp_Canceled) { TEST_F(SetMediaClockRequestTest, OnEvent_Success) { MessageSharedPtr msg = CreateMessage(); (*msg)[am::strings::params][am::hmi_response::code] = - mobile_apis::Result::SUCCESS; + hmi_apis::Common_Result::SUCCESS; (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Null); - SharedPtr<SetMediaClockRequest> command( - CreateCommand<SetMediaClockRequest>(msg)); - EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)); MockAppPtr app(CreateMockApp()); @@ -341,7 +326,8 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) { Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer); event.set_smart_object(*msg); - + SharedPtr<SetMediaClockRequest> command( + CreateCommand<SetMediaClockRequest>(msg)); command->on_event(event); } diff --git a/src/components/application_manager/test/commands/mobile/show_test.cc b/src/components/application_manager/test/commands/mobile/show_test.cc index d1e3c14181..4752bac0fd 100644 --- a/src/components/application_manager/test/commands/mobile/show_test.cc +++ b/src/components/application_manager/test/commands/mobile/show_test.cc @@ -59,7 +59,6 @@ using am::MockMessageHelper; using test::components::policy_test::MockPolicyHandlerInterface; using ::utils::SharedPtr; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -73,8 +72,7 @@ const uint32_t kFunctionID = 3u; class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - ShowRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) { + ShowRequestTest() { mock_app_ = CreateMockApp(); } sync_primitives::Lock lock_; @@ -203,16 +201,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { EXPECT_CALL(*mock_app_, set_show_command(msg_params)); } - void SetUp() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - MockAppPtr mock_app_; - MockMessageHelper& mock_message_helper_; std::string text_field_; }; @@ -238,10 +227,6 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { Event event(hmi_apis::FunctionID::UI_Show); event.set_smart_object(*msg); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MessageSharedPtr vr_command_result; EXPECT_CALL( app_mngr_, @@ -264,12 +249,9 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { .asString() .empty()); } - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -298,13 +280,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) { EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -328,13 +306,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) { EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -361,13 +335,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) { EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -392,13 +362,9 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) { EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_Graphic_Canceled) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -420,13 +386,9 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) { EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -447,13 +409,9 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) { EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -478,13 +436,9 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) { EXPECT_CALL(*mock_app_, set_show_command(msg_params)); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -506,13 +460,9 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) { EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - MessageSharedPtr msg = CreateMsgParams(); SmartObject msg_params(smart_objects::SmartType_Map); @@ -533,8 +483,6 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) { EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0); command->Run(); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_MainField1_SUCCESS) { @@ -720,7 +668,6 @@ TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) { } TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) { - Mock::VerifyAndClearExpectations(&mock_message_helper_); MessageSharedPtr msg = CreateMsgParams(); SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); @@ -745,10 +692,6 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) { Event event(hmi_apis::FunctionID::UI_Show); event.set_smart_object(*ev_msg); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); - MessageSharedPtr ui_command_result; EXPECT_CALL( app_mngr_, @@ -764,8 +707,6 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) { (*ui_command_result)[am::strings::msg_params][am::strings::result_code] .asInt(), static_cast<int32_t>(mobile_apis::Result::WARNINGS)); - - Mock::VerifyAndClearExpectations(&mock_message_helper_); } TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) { @@ -943,9 +884,6 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) { SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); - ON_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS)) - .WillByDefault(Return(am::mobile_api::Result::SUCCESS)); EXPECT_CALL(app_mngr_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), _)); @@ -967,9 +905,6 @@ TEST_F(ShowRequestTest, OnEvent_WarningsResultCode_SUCCESS) { SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::WARNINGS)) - .WillOnce(Return(mobile_apis::Result::WARNINGS)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)); Event event(hmi_apis::FunctionID::UI_Show); diff --git a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc index cbc2d702b3..7ded373d29 100644 --- a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc +++ b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc @@ -58,28 +58,12 @@ namespace commands = am::commands; using ::testing::_; using ::testing::Types; using ::testing::Return; -using ::testing::Mock; - -using am::MockMessageHelper; template <class Command> class MobileNotificationCommandsTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: typedef Command CommandType; - - public: - MobileNotificationCommandsTest() - : message_helper_(*MockMessageHelper::message_helper_mock()) { - Mock::VerifyAndClearExpectations(&message_helper_); - } - - ~MobileNotificationCommandsTest() { - Mock::VerifyAndClearExpectations(&message_helper_); - } - - protected: - MockMessageHelper& message_helper_; }; typedef Types<commands::OnAppInterfaceUnregisteredNotification, diff --git a/src/components/application_manager/test/commands/mobile/slider_test.cc b/src/components/application_manager/test/commands/mobile/slider_test.cc index 20262ed35a..54ac3cccc0 100644 --- a/src/components/application_manager/test/commands/mobile/slider_test.cc +++ b/src/components/application_manager/test/commands/mobile/slider_test.cc @@ -59,7 +59,6 @@ using am::MockMessageHelper; using policy_test::MockPolicyHandlerInterface; using ::utils::SharedPtr; using ::testing::_; -using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; @@ -82,8 +81,7 @@ class SliderRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: SliderRequestTest() - : mock_message_helper_(*MockMessageHelper::message_helper_mock()) - , mock_app_(CreateMockApp()) + : mock_app_(CreateMockApp()) , msg_(CreateMessage(smart_objects::SmartType_Map)) {} MessageSharedPtr CreateFullParamsUISO() { @@ -123,10 +121,6 @@ class SliderRequestTest ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); } - void SetUp() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - void ExpectManageMobileCommandWithResultCode( const mobile_apis::Result::eType code) { EXPECT_CALL( @@ -135,12 +129,8 @@ class SliderRequestTest am::commands::Command::CommandOrigin::ORIGIN_SDL)); } - void TearDown() OVERRIDE { - Mock::VerifyAndClearExpectations(&mock_message_helper_); - } sync_primitives::Lock lock_; - MockMessageHelper& mock_message_helper_; MockAppPtr mock_app_; MessageSharedPtr msg_; MockPolicyHandlerInterface mock_policy_handler_; @@ -167,10 +157,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { Event event(hmi_apis::FunctionID::UI_Slider); event.set_smart_object(*msg); - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE)) - .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - MessageSharedPtr ui_command_result; EXPECT_CALL( app_mngr_, @@ -193,7 +179,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { .asString() .empty()); } - Mock::VerifyAndClearExpectations(&mock_message_helper_); } class CallOnTimeOut { @@ -325,9 +310,6 @@ TEST_F(SliderRequestTest, OnEvent_UISliderPositionExists_SUCCESS) { (*msg_)[am::strings::params][am::strings::data] [am::strings::slider_position] = "position"; - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::TIMED_OUT)) - .WillOnce(Return(mobile_apis::Result::TIMED_OUT)); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::TIMED_OUT); Event event(hmi_apis::FunctionID::UI_Slider); @@ -343,9 +325,6 @@ TEST_F(SliderRequestTest, OnEvent_UISliderAborted_SUCCESS) { (*msg_)[am::strings::params][am::hmi_response::code] = hmi_apis::Common_Result::ABORTED; - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::ABORTED)) - .WillOnce(Return(mobile_apis::Result::ABORTED)); ExpectManageMobileCommandWithResultCode(mobile_apis::Result::ABORTED); Event event(hmi_apis::FunctionID::UI_Slider); diff --git a/src/components/application_manager/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/test/commands/mobile/speak_request_test.cc index f8a7d22b40..f07012d315 100644 --- a/src/components/application_manager/test/commands/mobile/speak_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/speak_request_test.cc @@ -84,16 +84,9 @@ const uint32_t kConnectionKey = 5u; class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: SpeakRequestTest() - : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) - , request_(CreateMessage(smart_objects::SmartType_Map)) + : request_(CreateMessage(smart_objects::SmartType_Map)) , response_(CreateMessage(smart_objects::SmartType_Map)) - , app_(CreateMockApp()) { - testing::Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - ~SpeakRequestTest() { - testing::Mock::VerifyAndClearExpectations(&mock_message_helper_); - } + , app_(CreateMockApp()) {} void CheckExpectations(const hmi_apis::Common_Result::eType hmi_response, const mobile_apis::Result::eType mobile_response, @@ -114,10 +107,6 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { MessageSharedPtr response_to_mobile; EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(state)); - MockMessageHelper* mock_message_helper = - MockMessageHelper::message_helper_mock(); - EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_)) - .WillOnce(Return(mobile_response)); EXPECT_CALL(app_mngr_, ManageMobileCommand( @@ -134,7 +123,6 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { static_cast<int32_t>(mobile_response)); } - am::MockMessageHelper& mock_message_helper_; MessageSharedPtr request_; MessageSharedPtr response_; MockAppPtr app_; @@ -156,9 +144,6 @@ TEST_F(SpeakRequestTest, OnEvent_SUCCESS_Expect_true) { MessageSharedPtr response_to_mobile; - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL( app_mngr_, ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) @@ -349,8 +334,6 @@ TEST_F(SpeakRequestTest, OnEvent_TTS_Speak_SUCCESS) { ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_result)) - .WillOnce(Return(am::mobile_api::Result::SUCCESS)); EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); @@ -369,8 +352,6 @@ TEST_F(SpeakRequestTest, OnEvent_TTS_SpeakWithWarning_WarningWithSuccess) { ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_result)) - .WillOnce(Return(am::mobile_api::Result::WARNINGS)); EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::WARNINGS), _)); diff --git a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc index 4546293172..87127231be 100644 --- a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc @@ -51,16 +51,15 @@ namespace mobile_commands_test { namespace subscribe_way_points_request { using ::testing::_; +using ::testing::A; using ::testing::Return; using ::testing::ReturnRef; using ::testing::DoAll; using ::testing::SaveArg; using ::testing::InSequence; -using ::testing::Mock; namespace am = ::application_manager; using am::commands::SubscribeWayPointsRequest; using am::commands::MessageSharedPtr; -using am::MockMessageHelper; typedef SharedPtr<SubscribeWayPointsRequest> CommandPtr; @@ -72,14 +71,15 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); - ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(_)) + ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(A<am::ApplicationSharedPtr>())) .WillByDefault(Return(false)); ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints()) .WillByDefault(Return(true)); { InSequence dummy; - EXPECT_CALL(app_mngr_, SubscribeAppForWayPoints(_)); + EXPECT_CALL(app_mngr_, + SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>())); EXPECT_CALL(*app, UpdateHash()); } @@ -106,16 +106,13 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) { event.set_smart_object(*event_msg); - MockMessageHelper* mock_message_helper = - MockMessageHelper::message_helper_mock(); - Mock::VerifyAndClearExpectations(mock_message_helper); - ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); { InSequence dummy; - EXPECT_CALL(app_mngr_, SubscribeAppForWayPoints(_)); - EXPECT_CALL(*mock_message_helper, HMIToMobileResult(result_code)) + EXPECT_CALL(app_mngr_, + SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>())); + EXPECT_CALL(mock_message_helper_, HMIToMobileResult(result_code)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)); EXPECT_CALL(*app, UpdateHash()); @@ -123,8 +120,6 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) { command->Init(); command->on_event(event); - - Mock::VerifyAndClearExpectations(mock_message_helper); } } // namespace subscribe_way_points_request diff --git a/src/components/application_manager/test/commands/mobile/system_request_test.cc b/src/components/application_manager/test/commands/mobile/system_request_test.cc new file mode 100644 index 0000000000..0e07889b4b --- /dev/null +++ b/src/components/application_manager/test/commands/mobile/system_request_test.cc @@ -0,0 +1,135 @@ +/* + * 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. + */ + +#include <stdint.h> +#include <string> +#include <set> + +#include "gtest/gtest.h" + +#include "application_manager/commands/mobile/system_request.h" +#include "application_manager/commands/command_request_test.h" +#include "application_manager/mock_application.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/event_engine/event.h" +#include "application_manager/mock_hmi_interface.h" +#include "application_manager/policies/mock_policy_handler_interface.h" + +namespace test { +namespace components { +namespace commands_test { +namespace mobile_commands_test { +namespace system_request { + +namespace am = application_manager; +using am::commands::SystemRequest; +using am::commands::CommandImpl; +using am::commands::MessageSharedPtr; +using am::MockHmiInterfaces; +using am::event_engine::Event; +using policy_test::MockPolicyHandlerInterface; +using ::utils::SharedPtr; +using ::testing::_; +using ::testing::Return; +using ::testing::ReturnRef; + +namespace { +const uint32_t kConnectionKey = 2u; +const std::string kAppPolicyId = "fake-app-id"; +const uint32_t kDefaultTimeout = 1000u; +const std::string kAppFolderName = "fake-app-name"; +const std::string kAppStorageFolder = "fake-storage"; +const std::string kSystemFilesPath = "/fake/system/files"; +const std::string kFileName = "Filename"; +} // namespace + +class SystemRequestTest + : public CommandRequestTest<CommandsTestMocks::kIsNice> { + public: + SystemRequestTest() : mock_app_(CreateMockApp()) {} + + protected: + MessageSharedPtr CreateIVSUMessage() { + MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); + (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; + (*msg)[am::strings::msg_params][am::strings::request_type] = + mobile_apis::RequestType::HTTP; + (*msg)[am::strings::msg_params][am::strings::file_name] = kFileName; + return msg; + } + + void PreConditions() { + ON_CALL(app_mngr_, application(kConnectionKey)) + .WillByDefault(Return(mock_app_)); + ON_CALL(app_mngr_, GetPolicyHandler()) + .WillByDefault(ReturnRef(mock_policy_handler_)); + + ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey)); + ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kAppPolicyId)); + ON_CALL(*mock_app_, folder_name()).WillByDefault(Return(kAppFolderName)); + + ON_CALL(app_mngr_settings_, system_files_path()) + .WillByDefault(ReturnRef(kSystemFilesPath)); + ON_CALL(app_mngr_settings_, app_storage_folder()) + .WillByDefault(ReturnRef(kAppStorageFolder)); + + ON_CALL(mock_policy_handler_, IsRequestTypeAllowed(kAppPolicyId, _)) + .WillByDefault(Return(true)); + } + + void ExpectManageMobileCommandWithResultCode( + const mobile_apis::Result::eType code) { + EXPECT_CALL( + app_mngr_, + ManageMobileCommand(MobileResultCodeIs(code), + am::commands::Command::CommandOrigin::ORIGIN_SDL)); + } + + MockAppPtr mock_app_; + MockPolicyHandlerInterface mock_policy_handler_; +}; + +TEST_F(SystemRequestTest, Run_HTTP_FileName_no_binary_data_REJECTED) { + PreConditions(); + MessageSharedPtr msg = CreateIVSUMessage(); + + ExpectManageMobileCommandWithResultCode(mobile_apis::Result::REJECTED); + + SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); + command->Run(); +} + +} // namespace system_request +} // namespace mobile_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc index ae4e46d40b..3d083f5c45 100644 --- a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc @@ -90,7 +90,7 @@ TEST_F(UnregisterAppInterfaceRequestTest, Run_SUCCESS) { mobile_apis::AppInterfaceUnregisteredReason::INVALID_ENUM; MessageSharedPtr dummy_msg(CreateMessage()); - EXPECT_CALL(*am::MockMessageHelper::message_helper_mock(), + EXPECT_CALL(mock_message_helper_, GetOnAppInterfaceUnregisteredNotificationToMobile( kConnectionKey, kUnregisterReason)) .WillOnce(Return(dummy_msg)); diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc index 9652364646..bb4824e8f7 100644 --- a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc @@ -59,7 +59,8 @@ typedef ::utils::SharedPtr<UnsubscribeVehicleDataRequest> CommandPtr; namespace { const uint32_t kConnectionKey = 1u; const std::string kMsgParamKey = "test_key"; -const am::VehicleDataType kVehicleType = am::VehicleDataType::SPEED; +const mobile_apis::VehicleDataType::eType kVehicleType = + mobile_apis::VehicleDataType::VEHICLEDATA_SPEED; } // namespace class UnsubscribeVehicleRequestTest @@ -91,8 +92,7 @@ TEST_F(UnsubscribeVehicleRequestTest, kVehicleType; am::VehicleData data; - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data()) - .WillOnce(ReturnRef(data)); + EXPECT_CALL(mock_message_helper_, vehicle_data()).WillOnce(ReturnRef(data)); CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg)); MockAppPtr mock_app(CreateMockApp()); @@ -115,7 +115,7 @@ TEST_F(UnsubscribeVehicleRequestTest, am::VehicleData vehicle_data; vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType)); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data()) + EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg)); @@ -139,7 +139,7 @@ TEST_F(UnsubscribeVehicleRequestTest, am::VehicleData vehicle_data; vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType)); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data()) + EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg)); @@ -161,7 +161,7 @@ TEST_F(UnsubscribeVehicleRequestTest, Run_UnsubscribeDataDisabled_UNSUCCESS) { am::VehicleData vehicle_data; vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType)); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data()) + EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg)); @@ -185,7 +185,7 @@ void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() { am::VehicleData vehicle_data; vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType)); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data()) + EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); am::ApplicationSet application_set_; @@ -228,7 +228,7 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillRepeatedly(Return(mock_app)); vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType)); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data()) + EXPECT_CALL(mock_message_helper_, vehicle_data()) .WillOnce(ReturnRef(vehicle_data)); EXPECT_CALL(*mock_app, IsSubscribedToIVI(kVehicleType)) .WillRepeatedly(Return(false)); @@ -243,12 +243,9 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) { SmartObject message(smart_objects::SmartType_Map); const hmi_apis::Common_Result::eType hmi_result = hmi_apis::Common_Result::SUCCESS; - const mobile_apis::Result::eType mob_result = mobile_apis::Result::SUCCESS; message[am::strings::params][am::hmi_response::code] = hmi_result; message[am::strings::msg_params][kMsgParamKey] = true; test_event.set_smart_object(message); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), - HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result)); EXPECT_CALL( app_mngr_, @@ -272,14 +269,10 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) { SmartObject message(smart_objects::SmartType_Map); const hmi_apis::Common_Result::eType hmi_result = hmi_apis::Common_Result::SUCCESS; - const mobile_apis::Result::eType mob_result = mobile_apis::Result::SUCCESS; message[am::strings::params][am::hmi_response::code] = hmi_result; message[am::strings::msg_params][kMsgParamKey] = true; test_event.set_smart_object(message); - EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), - HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result)); - EXPECT_CALL( app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _)); diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc index 50567a7c62..5615b0cabd 100644 --- a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc @@ -72,20 +72,13 @@ class UnSubscribeWayPointsRequestTest public: UnSubscribeWayPointsRequestTest() : command_msg_(CreateMessage(smart_objects::SmartType_Map)) - , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_)) - , mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) { + , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_)) { (*command_msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey; - testing::Mock::VerifyAndClearExpectations(&mock_message_helper_); - } - - ~UnSubscribeWayPointsRequestTest() { - testing::Mock::VerifyAndClearExpectations(&mock_message_helper_); } MessageSharedPtr command_msg_; ::utils::SharedPtr<UnSubscribeWayPointsRequest> command_; - am::MockMessageHelper& mock_message_helper_; }; TEST_F(UnSubscribeWayPointsRequestTest, @@ -107,9 +100,9 @@ TEST_F(UnSubscribeWayPointsRequestTest, EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app)); - EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId)); - - EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId)) + EXPECT_CALL(app_mngr_, + IsAppSubscribedForWayPoints( + ::testing::Matcher<am::ApplicationSharedPtr>(mock_app))) .WillOnce(Return(false)); EXPECT_CALL( @@ -124,9 +117,9 @@ TEST_F(UnSubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app)); - EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId)); - - EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId)) + EXPECT_CALL(app_mngr_, + IsAppSubscribedForWayPoints( + ::testing::Matcher<am::ApplicationSharedPtr>(mock_app))) .WillOnce(Return(true)); EXPECT_CALL(app_mngr_, @@ -161,13 +154,9 @@ TEST_F(UnSubscribeWayPointsRequestTest, Event event(hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints); event.set_smart_object(*event_msg); - EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId)); - - EXPECT_CALL(app_mngr_, UnsubscribeAppFromWayPoints(kAppId)); - - EXPECT_CALL(mock_message_helper_, - HMIToMobileResult(hmi_apis::Common_Result::SUCCESS)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, + UnsubscribeAppFromWayPoints( + ::testing::Matcher<am::ApplicationSharedPtr>(mock_app))); EXPECT_CALL( app_mngr_, diff --git a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc index cab67e641c..dacabba5fd 100644 --- a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc +++ b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc @@ -79,8 +79,7 @@ class UpdateTurnListRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: UpdateTurnListRequestTest() - : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) - , command_msg_(CreateMessage(smart_objects::SmartType_Map)) + : command_msg_(CreateMessage(smart_objects::SmartType_Map)) , command_(CreateCommand<UpdateTurnListRequest>(command_msg_)) { (*command_msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey; @@ -88,7 +87,6 @@ class UpdateTurnListRequestTest kFunctionId; } - am::MockMessageHelper& mock_message_helper_; MessageSharedPtr command_msg_; ::utils::SharedPtr<UpdateTurnListRequest> command_; TypeIf<kMocksAreNice, @@ -275,9 +273,6 @@ TEST_F(UpdateTurnListRequestTest, OnEvent_UnsupportedResource_SUCCESS) { Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList); event.set_smart_object(*event_msg); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code)) - .WillOnce(Return(mobile_response_code)); - EXPECT_CALL(app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _)); @@ -297,9 +292,6 @@ TEST_F(UpdateTurnListRequestTest, Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList); event.set_smart_object(*event_msg); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code)) - .WillOnce(Return(mobile_response_code)); - EXPECT_CALL(app_mngr_, ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _)); diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h index b6733b5818..553126091f 100644 --- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h @@ -44,7 +44,7 @@ #include "test/application_manager/mock_application_manager_settings.h" #include "application_manager/mock_hmi_interface.h" #include "application_manager/mock_application.h" - +#include "application_manager/mock_message_helper.h" namespace test { namespace components { namespace commands_test { @@ -54,6 +54,7 @@ namespace am = ::application_manager; using ::testing::ReturnRef; using ::testing::Return; using ::testing::NiceMock; +using ::testing::Mock; using ::testing::_; using ::utils::SharedPtr; @@ -63,6 +64,7 @@ using ::test::components::application_manager_test::MockApplicationManager; using ::test::components::application_manager_test:: MockApplicationManagerSettings; using am::ApplicationSharedPtr; +using am::MockMessageHelper; using ::test::components::application_manager_test::MockApplication; // Depending on the value type will be selected @@ -100,7 +102,9 @@ class CommandsTest : public ::testing::Test { MockApplication>::Result MockApp; typedef SharedPtr<MockApp> MockAppPtr; - virtual ~CommandsTest() {} + virtual ~CommandsTest() { + Mock::VerifyAndClearExpectations(&mock_message_helper_); + } static MessageSharedPtr CreateMessage( const smart_objects::SmartType type = smart_objects::SmartType_Null) { @@ -136,6 +140,7 @@ class CommandsTest : public ::testing::Test { MockAppManager app_mngr_; MockAppManagerSettings app_mngr_settings_; MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; + am::MockMessageHelper& mock_message_helper_; protected: virtual void InitCommand(const uint32_t& timeout) { @@ -145,13 +150,64 @@ class CommandsTest : public ::testing::Test { .WillByDefault(ReturnRef(timeout)); } - CommandsTest() { + CommandsTest() + : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) { ON_CALL(app_mngr_, hmi_interfaces()) .WillByDefault(ReturnRef(mock_hmi_interfaces_)); ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_SDL)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); + Mock::VerifyAndClearExpectations(&mock_message_helper_); + InitHMIToMobileResultConverter(); + } + + void InitHMIToMobileResultConverter() { + namespace MobileResult = mobile_apis::Result; + namespace HMIResult = hmi_apis::Common_Result; + auto link_hmi_to_mob_result = + [this](HMIResult::eType hmi_result, MobileResult::eType mobile_result) { + ON_CALL(mock_message_helper_, HMIToMobileResult(hmi_result)) + .WillByDefault(Return(mobile_result)); + }; + link_hmi_to_mob_result(HMIResult::INVALID_ENUM, MobileResult::INVALID_ENUM); + link_hmi_to_mob_result(HMIResult::SUCCESS, MobileResult::SUCCESS); + link_hmi_to_mob_result(HMIResult::UNSUPPORTED_REQUEST, + MobileResult::UNSUPPORTED_REQUEST); + link_hmi_to_mob_result(HMIResult::UNSUPPORTED_RESOURCE, + MobileResult::UNSUPPORTED_RESOURCE); + link_hmi_to_mob_result(HMIResult::DISALLOWED, MobileResult::DISALLOWED); + link_hmi_to_mob_result(HMIResult::REJECTED, MobileResult::REJECTED); + link_hmi_to_mob_result(HMIResult::ABORTED, MobileResult::ABORTED); + link_hmi_to_mob_result(HMIResult::IGNORED, MobileResult::IGNORED); + link_hmi_to_mob_result(HMIResult::RETRY, MobileResult::RETRY); + link_hmi_to_mob_result(HMIResult::IN_USE, MobileResult::IN_USE); + link_hmi_to_mob_result(HMIResult::TIMED_OUT, MobileResult::TIMED_OUT); + link_hmi_to_mob_result(HMIResult::INVALID_DATA, MobileResult::INVALID_DATA); + link_hmi_to_mob_result(HMIResult::CHAR_LIMIT_EXCEEDED, + MobileResult::CHAR_LIMIT_EXCEEDED); + link_hmi_to_mob_result(HMIResult::INVALID_ID, MobileResult::INVALID_ID); + link_hmi_to_mob_result(HMIResult::DUPLICATE_NAME, + MobileResult::DUPLICATE_NAME); + link_hmi_to_mob_result(HMIResult::APPLICATION_NOT_REGISTERED, + MobileResult::APPLICATION_NOT_REGISTERED); + link_hmi_to_mob_result(HMIResult::WRONG_LANGUAGE, + MobileResult::WRONG_LANGUAGE); + link_hmi_to_mob_result(HMIResult::OUT_OF_MEMORY, + MobileResult::OUT_OF_MEMORY); + link_hmi_to_mob_result(HMIResult::TOO_MANY_PENDING_REQUESTS, + MobileResult::TOO_MANY_PENDING_REQUESTS); + link_hmi_to_mob_result(HMIResult::WARNINGS, MobileResult::WARNINGS); + link_hmi_to_mob_result(HMIResult::GENERIC_ERROR, + MobileResult::GENERIC_ERROR); + link_hmi_to_mob_result(HMIResult::USER_DISALLOWED, + MobileResult::USER_DISALLOWED); + link_hmi_to_mob_result(HMIResult::TRUNCATED_DATA, + MobileResult::TRUNCATED_DATA); + link_hmi_to_mob_result(HMIResult::SAVED, MobileResult::SAVED); + link_hmi_to_mob_result(HMIResult::DATA_NOT_AVAILABLE, + MobileResult::DATA_NOT_AVAILABLE); + link_hmi_to_mob_result(HMIResult::READ_ONLY, MobileResult::READ_ONLY); } }; diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h index c24e4590f5..10cf5f746e 100644 --- a/src/components/application_manager/test/include/application_manager/mock_application.h +++ b/src/components/application_manager/test/include/application_manager/mock_application.h @@ -50,8 +50,11 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(curHash, const std::string&()); MOCK_METHOD0(UpdateHash, void()); - MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool()); - MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag)); + DEPRECATED MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool()); + DEPRECATED MOCK_METHOD1(set_flag_sending_hash_change_after_awake, + void(bool flag)); + MOCK_CONST_METHOD0(IsHashChangedDuringSuspend, bool()); + MOCK_METHOD1(SetHashChangedDuringSuspend, void(const bool flag)); MOCK_CONST_METHOD0(is_application_data_changed, bool()); MOCK_METHOD1(set_is_application_data_changed, void(bool state_application_data)); @@ -153,6 +156,7 @@ class MockApplication : public ::application_manager::Application { bool(mobile_apis::FunctionID::eType cmd_id, ::application_manager::TLimitSource source)); MOCK_METHOD0(usage_report, ::application_manager::UsageStatistics&()); + MOCK_METHOD1(SetInitialState, void(::application_manager::HmiStatePtr state)); MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state)); MOCK_METHOD1(SetPostponedState, void(::application_manager::HmiStatePtr state)); @@ -313,7 +317,8 @@ class MockApplication : public ::application_manager::Application { bool(application_manager::AppExtensionPtr extention)); MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid)); MOCK_METHOD0(RemoveExtensions, void()); - MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&()); + MOCK_CONST_METHOD0(SubscribesIVI, + const application_manager::VehicleInfoSubscriptions&()); #endif // SDL_REMOTE_CONTROL }; diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/hmi_proxy.h b/src/components/application_manager/test/include/application_manager/mock_application_helper.h index d7277d017b..1013af26bd 100644 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/hmi_proxy.h +++ b/src/components/application_manager/test/include/application_manager/mock_application_helper.h @@ -1,7 +1,5 @@ /* - * \file hmiproxy.h - * \brief HmiProxy class header file. - * Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,32 +30,28 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_HMI_PROXY_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_HMI_PROXY_H_ +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_HELPER_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_HELPER_H_ -#include "qt_version.h" -#include "qml_dbus.h" +#include <gmock/gmock.h> +#include "application_manager/application.h" +#include "application_manager/application_manager.h" -#if QT_4 -#include <QtDeclarative/QDeclarativeItem> -typedef QDeclarativeItem Item; -#elif QT_5 -#include <QtQuick/QQuickItem> -typedef QQuickItem Item; -#endif // QT_VERSION - -class HmiProxy : public Item { - Q_OBJECT - Q_DISABLE_COPY(HmiProxy) +namespace test { +namespace components { +namespace application_manager_test { +class MockApplicationHelper { public: - explicit HmiProxy(Item* parent = 0); - static ApiAdaptors api_adaptors_; + MOCK_METHOD2(RecallApplicationData, + void(application_manager::ApplicationSharedPtr, + application_manager::ApplicationManager&)); - protected: - virtual void componentComplete(); + static MockApplicationHelper& application_helper_mock(); }; -QML_DECLARE_TYPE(HmiProxy) +} // namespace application_manager_test +} // namespace components +} // namespace test -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_HMI_PROXY_H_ +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_APPLICATION_HELPER_H_ diff --git a/src/components/qt_hmi/test/qt_hmi_test.cc b/src/components/application_manager/test/include/application_manager/mock_hmi_command_factory.h index 0241549ca5..cf40d7b98b 100644 --- a/src/components/qt_hmi/test/qt_hmi_test.cc +++ b/src/components/application_manager/test/include/application_manager/mock_hmi_command_factory.h @@ -1,5 +1,5 @@ /* - Copyright (c) 2014, Ford Motor Company + Copyright (c) 2017, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -29,5 +29,32 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <QtQuickTest/quicktest.h> -QUICK_TEST_MAIN(QtHMI) + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HMI_COMMAND_FACTORY_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HMI_COMMAND_FACTORY_H_ + +#include <gmock/gmock.h> +#include "application_manager/application_manager.h" +#include "application_manager/commands/command.h" +#include "smart_objects/smart_object.h" +#include "utils/shared_ptr.h" + +namespace test { +namespace components { +namespace application_manager_test { + +class MockHMICommandFactory { + public: + MOCK_METHOD2(CreateCommand, + utils::SharedPtr<application_manager::commands::Command>( + const utils::SharedPtr<smart_objects::SmartObject>&, + application_manager::ApplicationManager&)); + + static MockHMICommandFactory* mock_hmi_command_factory(); +}; + +} // namespace application_manager_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HMI_COMMAND_FACTORY_H_ diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index f927f6bb72..7598e33e19 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -268,6 +268,29 @@ class MockMessageHelper { MOCK_METHOD2(GetDeviceMacAddressForHandle, std::string(const uint32_t device_handle, const ApplicationManager& app_mngr)); + MOCK_METHOD3(SendDeleteCommandRequest, + void(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr)); + MOCK_METHOD3(SendDeleteSubmenuRequest, + void(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr)); + MOCK_METHOD3(SendDeleteChoiceSetRequest, + void(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr)); + MOCK_METHOD2(SendResetPropertiesRequest, + void(ApplicationSharedPtr application, + ApplicationManager& app_mngr)); + MOCK_METHOD3(SendUnsubscribeButtonNotification, + void(mobile_apis::ButtonName::eType button, + ApplicationSharedPtr application, + ApplicationManager& app_mngr)); + MOCK_METHOD3(SendUnsubscribeIVIRequest, + void(int32_t ivi_id, + ApplicationSharedPtr application, + ApplicationManager& app_mngr)); static MockMessageHelper* message_helper_mock(); }; diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h index b06b207f84..fb264b7d82 100644 --- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h +++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h @@ -48,7 +48,9 @@ class MockResumeCtrl : public resumption::ResumeCtrl { MOCK_METHOD1(RemoveApplicationFromSaved, bool(app_mngr::ApplicationConstSharedPtr application)); MOCK_METHOD0(OnSuspend, void()); + MOCK_METHOD0(OnIgnitionOff, void()); MOCK_METHOD0(OnAwake, void()); + MOCK_CONST_METHOD0(is_suspended, bool()); MOCK_METHOD0(StopSavePersistentDataTimer, void()); MOCK_METHOD2(StartResumption, bool(app_mngr::ApplicationSharedPtr application, diff --git a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h index 7b16a3bf00..cfec034653 100644 --- a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h +++ b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h @@ -60,11 +60,13 @@ class MockResumptionData : public ::resumption::ResumptionData { uint32_t(const std::string& policy_app_id, const std::string& device_id)); MOCK_METHOD0(OnSuspend, void()); + MOCK_METHOD0(IncrementIgnOffCount, void()); MOCK_CONST_METHOD3(GetHashId, bool(const std::string& policy_app_id, const std::string& device_id, std::string& hash_id)); MOCK_METHOD0(OnAwake, void()); + MOCK_METHOD0(DecrementIgnOffCount, void()); MOCK_CONST_METHOD3(GetSavedApplication, bool(const std::string& policy_app_id, const std::string& device_id, diff --git a/src/components/application_manager/test/message_helper/CMakeLists.txt b/src/components/application_manager/test/message_helper/CMakeLists.txt index ccf05fc1c9..8ebb2dea0e 100755 --- a/src/components/application_manager/test/message_helper/CMakeLists.txt +++ b/src/components/application_manager/test/message_helper/CMakeLists.txt @@ -49,8 +49,8 @@ set(LIBRARIES if(REMOTE_CONTROL) SET (LIBRARIES - FunctionalModule - ${LIBRARIES} + FunctionalModule + ${LIBRARIES} ) endif(REMOTE_CONTROL) diff --git a/src/components/application_manager/test/mobile_message_handler_test.cc b/src/components/application_manager/test/mobile_message_handler_test.cc index 3f2ba0a3c5..2fe28d8249 100644 --- a/src/components/application_manager/test/mobile_message_handler_test.cc +++ b/src/components/application_manager/test/mobile_message_handler_test.cc @@ -169,7 +169,7 @@ class MobileMessageHandlerTest : public testing::Test { uint32_t correlation_id, uint32_t connection_key, const std::string& json_msg, - application_manager::BinaryData* data = NULL) { + const application_manager::BinaryData* data = NULL) { MobileMessage message = utils::MakeShared<Message>( MessagePriority::FromServiceType(ServiceType::kRpc)); message->set_function_id(function_id); @@ -256,10 +256,10 @@ TEST(mobile_message_test, basic_test) { MobileMessage message = utils::MakeShared<Message>(protocol_handler::MessagePriority::kDefault); EXPECT_FALSE(message->has_binary_data()); - application_manager::BinaryData* binary_data = - new application_manager::BinaryData; - binary_data->push_back('X'); - message->set_binary_data(binary_data); + application_manager::BinaryData binary_data; + binary_data.push_back('X'); + message->set_binary_data( + (const application_manager::BinaryData*)&binary_data); EXPECT_TRUE(message->has_binary_data()); } diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/metatype.h b/src/components/application_manager/test/mock_application_helper.cc index b127cea1a8..c64a56e53e 100644 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/metatype.h +++ b/src/components/application_manager/test/mock_application_helper.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2017, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,32 +30,26 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_METATYPE_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_METATYPE_H_ +#include "application_manager/mock_application_helper.h" -#include <QMetaType> +namespace test { +namespace components { +namespace application_manager_test { -template <typename T> -QMetaType::Type metatype(); - -template <> -inline QMetaType::Type metatype<int>() { - return QMetaType::Int; +MockApplicationHelper& MockApplicationHelper::application_helper_mock() { + static ::testing::NiceMock<MockApplicationHelper> application_helper_mock; + return application_helper_mock; } -template <> -inline QMetaType::Type metatype<QString>() { - return QMetaType::QString; -} +} // application_manager_test +} // components +} // test -template <> -inline QMetaType::Type metatype<bool>() { - return QMetaType::Bool; -} +namespace application_manager { -template <> -inline QMetaType::Type metatype<double>() { - return QMetaType::Double; +void DeleteApplicationData(ApplicationSharedPtr app, + ApplicationManager& app_manager) { + test::components::application_manager_test::MockApplicationHelper:: + application_helper_mock().RecallApplicationData(app, app_manager); } - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_METATYPE_H_ +} // application_managers diff --git a/src/components/include/application_manager/vehicle_info_data.h b/src/components/application_manager/test/mock_hmi_command_factory.cc index 693353abfe..c2b4644f86 100644 --- a/src/components/include/application_manager/vehicle_info_data.h +++ b/src/components/application_manager/test/mock_hmi_command_factory.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2013, Ford Motor Company + Copyright (c) 2017, Ford Motor Company All rights reserved. Redistribution and use in source and binary forms, with or without @@ -30,42 +30,28 @@ POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_VEHICLE_INFO_DATA_H_ -#define SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_VEHICLE_INFO_DATA_H_ +#include <gmock/gmock.h> +#include "application_manager/hmi_command_factory.h" +#include "application_manager/mock_hmi_command_factory.h" -namespace application_manager { -/* -*@brief Typedef for the vehicle data types that can -*be published and subscribed to -*/ -enum VehicleDataType { - GPS = 0, - SPEED, - RPM, - FUELLEVEL, - FUELLEVEL_STATE, - FUELCONSUMPTION, - EXTERNTEMP, - VIN, - PRNDL, - TIREPRESSURE, - ODOMETER, - BELTSTATUS, - BODYINFO, - DEVICESTATUS, - ECALLINFO, - AIRBAGSTATUS, - EMERGENCYEVENT, - CLUSTERMODESTATUS, - MYKEY, - BRAKING, - WIPERSTATUS, - HEADLAMPSTATUS, - BATTVOLTAGE, - ENGINETORQUE, - ACCPEDAL, - STEERINGWHEEL -}; -} // namespace application_manager +namespace test { +namespace components { +namespace application_manager_test { + +MockHMICommandFactory* MockHMICommandFactory::mock_hmi_command_factory() { + static MockHMICommandFactory mock_hmi_command_factory; + return &mock_hmi_command_factory; +} -#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_VEHICLE_INFO_DATA_H_ +} // application_manager_test +} // components +} // test + +namespace application_manager { +CommandSharedPtr HMICommandFactory::CreateCommand( + const commands::MessageSharedPtr& message, + ApplicationManager& application_manager) { + return test::components::application_manager_test::MockHMICommandFactory:: + mock_hmi_command_factory()->CreateCommand(message, application_manager); +} +} // application_manager diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc index 5f221a105b..2a74f5b3b1 100644 --- a/src/components/application_manager/test/mock_message_helper.cc +++ b/src/components/application_manager/test/mock_message_helper.cc @@ -501,4 +501,46 @@ std::string MessageHelper::GetDeviceMacAddressForHandle( device_handle, app_mngr); } +void MessageHelper::SendDeleteCommandRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + return MockMessageHelper::message_helper_mock()->SendDeleteCommandRequest( + cmd, application, app_mngr); +} + +void MessageHelper::SendDeleteSubmenuRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + return MockMessageHelper::message_helper_mock()->SendDeleteSubmenuRequest( + cmd, application, app_mngr); +} + +void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + return MockMessageHelper::message_helper_mock()->SendDeleteChoiceSetRequest( + cmd, application, app_mngr); +} + +void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + return MockMessageHelper::message_helper_mock()->SendResetPropertiesRequest( + application, app_mngr); +} + +void MessageHelper::SendUnsubscribeButtonNotification( + mobile_apis::ButtonName::eType button, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + return MockMessageHelper::message_helper_mock() + ->SendUnsubscribeButtonNotification(button, application, app_mngr); +} + +void MessageHelper::SendUnsubscribeIVIRequest(int32_t ivi_id, + ApplicationSharedPtr application, + ApplicationManager& app_mngr) { + return MockMessageHelper::message_helper_mock()->SendUnsubscribeIVIRequest( + ivi_id, application, app_mngr); +} + } // namespace application_manager diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index 4c3e882eae..66efe45e30 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -803,8 +803,14 @@ void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key, EXPECT_CALL(*application1, is_audio()).WillRepeatedly(Return(false)); EXPECT_CALL(mock_message_helper_, SendOnAppPermissionsChangedNotification(kAppId1_, _, _)); - EXPECT_CALL(mock_session_observer, - GetDataOnDeviceID(device_handle, _, _, _, _)); + EXPECT_CALL( + mock_session_observer, + GetDataOnDeviceID( + testing::Matcher<transport_manager::DeviceHandle>(device_handle), + _, + _, + _, + _)); #endif // EXTERNAL_PROPRIETARY_MODE EXPECT_CALL(*application1, policy_app_id()).WillOnce(Return(kPolicyAppId_)); @@ -1162,7 +1168,15 @@ TEST_F(PolicyHandlerTest, OnCurrentDeviceIdUpdateRequired) { EXPECT_CALL(conn_handler, get_session_observer()) .WillOnce(ReturnRef(session_observer)); - EXPECT_CALL(session_observer, GetDataOnDeviceID(0u, _, _, _, _)); + const transport_manager::DeviceHandle handle = 0u; + + EXPECT_CALL(session_observer, + GetDataOnDeviceID( + testing::Matcher<transport_manager::DeviceHandle>(handle), + _, + _, + _, + _)); // Act policy_handler_.OnCurrentDeviceIdUpdateRequired(kPolicyAppId_); @@ -1463,7 +1477,9 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions) { EXPECT_CALL(app_manager_, application(app_id)) .WillRepeatedly(Return(mock_app_)); EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(std::string())); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)); policy_handler_.OnGetListOfPermissions(app_id, corr_id); } @@ -1489,7 +1505,9 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_WithoutConnectionKey) { EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set)); EXPECT_CALL(*mock_app_, device()).WillOnce(Return(0)); EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(std::string())); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)); #ifdef EXTERNAL_PROPRIETARY_MODE policy::ExternalConsentStatus external_consent_status = @@ -1563,7 +1581,9 @@ TEST_F(PolicyHandlerTest, OnGetListOfPermissions_GroupPermissions_SUCCESS) { EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set)); EXPECT_CALL(*mock_app_, device()).WillOnce(Return(0)); EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(std::string())); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)); #ifdef EXTERNAL_PROPRIETARY_MODE policy::ExternalConsentStatus external_consent_status = @@ -1878,7 +1898,9 @@ void PolicyHandlerTest::GetAppIDForSending() { EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true)); EXPECT_CALL(*mock_app_, hmi_level()) .WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL)); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)) + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)) .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0))); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_)) @@ -1944,7 +1966,9 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { // Check expectations - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)) + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)) .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0))); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_)) @@ -1984,7 +2008,9 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) { // Check expectations - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)) + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)) .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0))); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_)) @@ -2077,7 +2103,9 @@ TEST_F(PolicyHandlerTest, CanUpdate_TwoApplicationForSending_SUCCESS) { test_app.insert(mock_app_); test_app.insert(second_mock_app); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, _, _, _)) + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, _, _, _)) .WillOnce(DoAll(SetArgPointee<3>(kMacAddr_), Return(0))); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(kMacAddr_)) @@ -2111,8 +2139,13 @@ TEST_F(PolicyHandlerTest, .WillOnce(ReturnRef(conn_handler)); EXPECT_CALL(conn_handler, get_session_observer()) .WillOnce(ReturnRef(mock_session_observer)); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(device, _, NULL, _, _)) - .WillOnce(Return(1u)); + EXPECT_CALL(mock_session_observer, + GetDataOnDeviceID( + testing::Matcher<transport_manager::DeviceHandle>(device), + _, + NULL, + _, + _)).WillOnce(Return(1u)); EXPECT_CALL(app_manager_, application(kConnectionKey_)) .WillOnce(Return(mock_app_)); @@ -2265,7 +2298,10 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(*mock_app_, policy_app_id()) .WillRepeatedly(Return(kPolicyAppId_)); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, NULL, _, _)) + EXPECT_CALL( + mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, NULL, _, _)) .WillRepeatedly(DoAll(SetDeviceParamsMacAdress(kMacAddr_), (Return(1u)))); EXPECT_CALL(app_manager_, connection_handler()) @@ -2326,7 +2362,10 @@ TEST_F(PolicyHandlerTest, EXPECT_CALL(*mock_app_, policy_app_id()) .WillRepeatedly(Return(kPolicyAppId_)); - EXPECT_CALL(mock_session_observer, GetDataOnDeviceID(_, _, NULL, _, _)) + EXPECT_CALL( + mock_session_observer, + GetDataOnDeviceID( + testing::An<transport_manager::DeviceHandle>(), _, NULL, _, _)) .WillRepeatedly(DoAll(SetDeviceParamsMacAdress(kMacAddr_), (Return(1u)))); EXPECT_CALL(app_manager_, connection_handler()) diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc index f80842e250..f3e49001fa 100644 --- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc +++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc @@ -54,6 +54,7 @@ namespace components { namespace resumption_test { using ::testing::_; +using ::testing::A; using ::testing::Return; using ::testing::ReturnRef; using ::testing::DoAll; @@ -452,9 +453,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) { smart_objects::SmartObject test_subscriptions; smart_objects::SmartObject app_vi; - int vtype = application_manager::VehicleDataType::GPS; + int vtype = mobile_apis::VehicleDataType::VEHICLEDATA_GPS; uint i = 0; - for (; vtype < application_manager::VehicleDataType::STEERINGWHEEL; + for (; vtype < mobile_apis::VehicleDataType::VEHICLEDATA_STEERINGWHEEL; ++i, ++vtype) { app_vi[i] = vtype; } @@ -481,7 +482,7 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) { for (size_t i = 0; i < app_vi.length(); ++i) { EXPECT_CALL( *app_mock_, - SubscribeToIVI(static_cast<application_manager::VehicleDataType>(i))); + SubscribeToIVI(static_cast<mobile_apis::VehicleDataType::eType>(i))); } smart_objects::SmartObjectList requests; @@ -505,7 +506,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToWayPoints) { GetSavedApplication(kTestPolicyAppId_, kMacAddress_, _)) .WillByDefault(DoAll(SetArgReferee<2>(saved_app), Return(true))); EXPECT_CALL(*app_mock_, set_grammar_id(kTestGrammarId_)); - EXPECT_CALL(app_mngr_, SubscribeAppForWayPoints(_)); + EXPECT_CALL( + app_mngr_, + SubscribeAppForWayPoints(A<application_manager::ApplicationSharedPtr>())); const mobile_apis::HMILevel::eType hmi_test_level = mobile_apis::HMILevel::HMI_FULL; ON_CALL(app_mngr_, GetDefaultHmiLevel(const_app_)) @@ -880,7 +883,7 @@ TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithChoiceSet) { // TODO (VVeremjova) APPLINK-16718 TEST_F(ResumeCtrlTest, DISABLED_OnSuspend) { - EXPECT_CALL(*mock_storage_, OnSuspend()); + EXPECT_CALL(*mock_storage_, IncrementIgnOffCount()); res_ctrl_->OnSuspend(); } @@ -896,7 +899,7 @@ TEST_F(ResumeCtrlTest, OnSuspend_EmptyApplicationlist) { ON_CALL(app_mngr_, applications()).WillByDefault(Return(accessor)); EXPECT_CALL(*mock_storage_, SaveApplication(mock_app)).Times(0); - EXPECT_CALL(*mock_storage_, OnSuspend()); + EXPECT_CALL(*mock_storage_, IncrementIgnOffCount()).Times(0); EXPECT_CALL(*mock_storage_, Persist()); res_ctrl_->OnSuspend(); } @@ -906,7 +909,7 @@ TEST_F(ResumeCtrlTest, OnAwake) { EXPECT_CALL(mock_application_manager_settings_, app_resumption_save_persistent_data_timeout()) .WillOnce(ReturnRef(timeout)); - EXPECT_CALL(*mock_storage_, OnAwake()); + EXPECT_CALL(*mock_storage_, DecrementIgnOffCount()).Times(0); res_ctrl_->OnAwake(); } diff --git a/src/components/application_manager/test/resumption/resumption_data_db_test.cc b/src/components/application_manager/test/resumption/resumption_data_db_test.cc index aa4db59eac..cf0ebb7fd2 100644 --- a/src/components/application_manager/test/resumption/resumption_data_db_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_db_test.cc @@ -728,7 +728,7 @@ TEST_F(ResumptionDataDBTest, OnSuspend) { res_db()->SaveApplication(app_mock); CheckSavedDB(); - res_db()->OnSuspend(); + res_db()->IncrementIgnOffCount(); ign_off_count_++; CheckSavedDB(); } @@ -740,18 +740,18 @@ TEST_F(ResumptionDataDBTest, OnSuspendFourTimes) { res_db()->SaveApplication(app_mock); CheckSavedDB(); - res_db()->OnSuspend(); + res_db()->IncrementIgnOffCount(); ign_off_count_++; CheckSavedDB(); - res_db()->OnSuspend(); + res_db()->IncrementIgnOffCount(); ign_off_count_++; CheckSavedDB(); - res_db()->OnSuspend(); + res_db()->IncrementIgnOffCount(); ign_off_count_++; CheckSavedDB(); - res_db()->OnSuspend(); + res_db()->IncrementIgnOffCount(); ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, kMacAddress_); EXPECT_EQ(-1, result); @@ -765,11 +765,11 @@ TEST_F(ResumptionDataDBTest, OnSuspendOnAwake) { res_db()->SaveApplication(app_mock); CheckSavedDB(); - res_db()->OnSuspend(); + res_db()->IncrementIgnOffCount(); ign_off_count_++; CheckSavedDB(); - res_db()->OnAwake(); + res_db()->DecrementIgnOffCount(); ign_off_count_ = 0; CheckSavedDB(); } @@ -782,7 +782,7 @@ TEST_F(ResumptionDataDBTest, Awake_AppNotSuspended) { res_db()->SaveApplication(app_mock); CheckSavedDB(); - res_db()->OnAwake(); + res_db()->DecrementIgnOffCount(); ign_off_count_ = 0; CheckSavedDB(); } @@ -795,12 +795,12 @@ TEST_F(ResumptionDataDBTest, TwiceAwake_AppNotSuspended) { res_db()->SaveApplication(app_mock); CheckSavedDB(); - res_db()->OnSuspend(); - res_db()->OnAwake(); + res_db()->IncrementIgnOffCount(); + res_db()->DecrementIgnOffCount(); ign_off_count_ = 0; CheckSavedDB(); - res_db()->OnAwake(); + res_db()->DecrementIgnOffCount(); CheckSavedDB(); } @@ -826,14 +826,14 @@ TEST_F(ResumptionDataDBTest, GetIgnOffTime_AfterSuspendAndAwake) { last_ign_off_time = res_db()->GetIgnOffTime(); EXPECT_EQ(0u, last_ign_off_time); - res_db()->OnSuspend(); + res_db()->IncrementIgnOffCount(); uint32_t after_suspend; after_suspend = res_db()->GetIgnOffTime(); EXPECT_LE(last_ign_off_time, after_suspend); uint32_t after_awake; - res_db()->OnAwake(); + res_db()->DecrementIgnOffCount(); after_awake = res_db()->GetIgnOffTime(); EXPECT_LE(after_suspend, after_awake); diff --git a/src/components/application_manager/test/resumption/resumption_data_json_test.cc b/src/components/application_manager/test/resumption/resumption_data_json_test.cc index 834637fa62..e017c39497 100644 --- a/src/components/application_manager/test/resumption/resumption_data_json_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_json_test.cc @@ -257,7 +257,7 @@ TEST_F(ResumptionDataJsonTest, OnSuspend) { res_json.SaveApplication(app_mock); CheckSavedJson(); - res_json.OnSuspend(); + res_json.IncrementIgnOffCount(); ign_off_count_++; CheckSavedJson(); } @@ -268,13 +268,13 @@ TEST_F(ResumptionDataJsonTest, OnSuspendFourTimes) { res_json.SaveApplication(app_mock); CheckSavedJson(); - res_json.OnSuspend(); + res_json.IncrementIgnOffCount(); ign_off_count_++; CheckSavedJson(); - res_json.OnSuspend(); - res_json.OnSuspend(); - res_json.OnSuspend(); + res_json.IncrementIgnOffCount(); + res_json.IncrementIgnOffCount(); + res_json.IncrementIgnOffCount(); EXPECT_TRUE(-1 != res_json.IsApplicationSaved(policy_app_id_, kMacAddress_)); } @@ -285,11 +285,11 @@ TEST_F(ResumptionDataJsonTest, OnSuspendOnAwake) { res_json.SaveApplication(app_mock); CheckSavedJson(); - res_json.OnSuspend(); + res_json.IncrementIgnOffCount(); ign_off_count_++; CheckSavedJson(); - res_json.OnAwake(); + res_json.DecrementIgnOffCount(); ign_off_count_ = 0; CheckSavedJson(); } @@ -300,7 +300,7 @@ TEST_F(ResumptionDataJsonTest, Awake_AppNotSuspended) { res_json.SaveApplication(app_mock); CheckSavedJson(); - res_json.OnAwake(); + res_json.DecrementIgnOffCount(); ign_off_count_ = 0; CheckSavedJson(); } @@ -311,12 +311,12 @@ TEST_F(ResumptionDataJsonTest, TwiceAwake_AppNotSuspended) { res_json.SaveApplication(app_mock); CheckSavedJson(); - res_json.OnSuspend(); - res_json.OnAwake(); + res_json.IncrementIgnOffCount(); + res_json.DecrementIgnOffCount(); ign_off_count_ = 0; CheckSavedJson(); - res_json.OnAwake(); + res_json.DecrementIgnOffCount(); CheckSavedJson(); } @@ -339,14 +339,14 @@ TEST_F(ResumptionDataJsonTest, GetIgnOffTime_AfterSuspendAndAwake) { last_ign_off_time = res_json.GetIgnOffTime(); EXPECT_EQ(0u, last_ign_off_time); - res_json.OnSuspend(); + res_json.IncrementIgnOffCount(); uint32_t after_suspend; after_suspend = res_json.GetIgnOffTime(); EXPECT_LE(last_ign_off_time, after_suspend); uint32_t after_awake; - res_json.OnAwake(); + res_json.DecrementIgnOffCount(); after_awake = res_json.GetIgnOffTime(); EXPECT_LE(after_suspend, after_awake); diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc index 79397f5175..1f13ff78f3 100644 --- a/src/components/application_manager/test/resumption/resumption_data_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_test.cc @@ -539,8 +539,8 @@ void ResumptionDataTest::SetKeyboardProperties() { void ResumptionDataTest::SetSubscriptions() { btn_subscr.insert(ButtonName::eType::CUSTOM_BUTTON); btn_subscr.insert(ButtonName::eType::OK); - ivi.insert(0); - ivi.insert(5); + ivi.insert(static_cast<mobile_apis::VehicleDataType::eType>(0)); + ivi.insert(static_cast<mobile_apis::VehicleDataType::eType>(5)); } } // namespace resumption_test diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc index eb718c8b8b..fe4d1d2ee8 100644 --- a/src/components/application_manager/test/state_controller/state_controller_test.cc +++ b/src/components/application_manager/test/state_controller/state_controller_test.cc @@ -213,7 +213,7 @@ class StateControllerImplTest : public ::testing::Test { namespace SystemContext = mobile_apis::SystemContext; am::HmiStatePtr state = - utils::MakeShared<am::HmiState>(simple_app_id_, app_manager_mock_); + utils::MakeShared<am::HmiState>(simple_app_, app_manager_mock_); state->set_hmi_level(hmi_level); state->set_audio_streaming_state(aidio_ss); state->set_system_context(system_context); @@ -229,9 +229,9 @@ class StateControllerImplTest : public ::testing::Test { const mobile_apis::HMILevel::eType hmi_level, const mobile_apis::AudioStreamingState::eType audio_ss, const mobile_apis::SystemContext::eType system_context, - const uint32_t app_id) { + const am::ApplicationSharedPtr app) { am::HmiStatePtr new_state = - utils::MakeShared<HmiStateType>(app_id, app_manager_mock_); + utils::MakeShared<HmiStateType>(app, app_manager_mock_); new_state->set_hmi_level(hmi_level); new_state->set_audio_streaming_state(audio_ss); @@ -591,9 +591,9 @@ class StateControllerImplTest : public ::testing::Test { app_type = AppType(app_id); app = (*it_begin); am::HmiStatePtr state_first = - utils::MakeShared<T>(app_id, app_manager_mock_); + utils::MakeShared<T>(app, app_manager_mock_); am::HmiStatePtr state_second = - utils::MakeShared<Q>(app_id, app_manager_mock_); + utils::MakeShared<Q>(app, app_manager_mock_); TestSetSeveralState( app, state_first, state_second, app_type, call_back_result); TestSetSeveralState( @@ -1829,7 +1829,7 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) { for (; it != hmi_states.end(); ++it) { am::HmiStatePtr hmi_state = it->first; - am::HmiStatePtr initial_hmi_state = it->first; + am::HmiStatePtr initial_hmi_state = it2->first; Common_HMILevel::eType hmi_level = it->second; SetBCActivateAppRequestToHMI(hmi_level, corr_id); @@ -1981,8 +1981,8 @@ TEST_F(StateControllerImplTest, ApplyTempStatesForMediaNaviVCApp) { } TEST_F(StateControllerImplTest, SetStatePhoneCallForNonMediaApplication) { - am::HmiStatePtr state_phone_call = utils::MakeShared<am::PhoneCallHmiState>( - simple_app_id_, app_manager_mock_); + am::HmiStatePtr state_phone_call = + utils::MakeShared<am::PhoneCallHmiState>(simple_app_, app_manager_mock_); TestSetState(simple_app_, state_phone_call, APP_TYPE_NON_MEDIA, @@ -1990,8 +1990,8 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForNonMediaApplication) { } TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaApplication) { - am::HmiStatePtr state_phone_call = utils::MakeShared<am::PhoneCallHmiState>( - media_app_id_, app_manager_mock_); + am::HmiStatePtr state_phone_call = + utils::MakeShared<am::PhoneCallHmiState>(media_app_, app_manager_mock_); TestSetState(media_app_, state_phone_call, APP_TYPE_MEDIA, @@ -2000,7 +2000,7 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaApplication) { TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaNaviApplication) { am::HmiStatePtr state_phone_call = utils::MakeShared<am::PhoneCallHmiState>( - media_navi_app_id_, app_manager_mock_); + media_navi_app_, app_manager_mock_); TestSetState(media_navi_app_, state_phone_call, APP_TYPE_NAVI, @@ -2009,7 +2009,7 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaNaviApplication) { TEST_F(StateControllerImplTest, SetVRStateForNonMediaApplication) { am::HmiStatePtr state_vr = - utils::MakeShared<am::VRHmiState>(simple_app_id_, app_manager_mock_); + utils::MakeShared<am::VRHmiState>(simple_app_, app_manager_mock_); TestSetState(simple_app_, state_vr, APP_TYPE_NON_MEDIA, @@ -2018,7 +2018,7 @@ TEST_F(StateControllerImplTest, SetVRStateForNonMediaApplication) { TEST_F(StateControllerImplTest, SetVRStateForMediaApplication) { am::HmiStatePtr state_vr = - utils::MakeShared<am::VRHmiState>(media_app_id_, app_manager_mock_); + utils::MakeShared<am::VRHmiState>(media_app_, app_manager_mock_); TestSetState(media_app_, state_vr, APP_TYPE_MEDIA, @@ -2026,8 +2026,8 @@ TEST_F(StateControllerImplTest, SetVRStateForMediaApplication) { } TEST_F(StateControllerImplTest, SetVRStateForMediaNaviVoiceApplication) { - am::HmiStatePtr state_vr = utils::MakeShared<am::VRHmiState>( - media_navi_vc_app_id_, app_manager_mock_); + am::HmiStatePtr state_vr = + utils::MakeShared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_); TestSetState(media_navi_vc_app_, state_vr, APP_TYPE_MEDIA, @@ -2037,7 +2037,7 @@ TEST_F(StateControllerImplTest, SetVRStateForMediaNaviVoiceApplication) { TEST_F(StateControllerImplTest, SetTTSStateForNonMediaApplicationAttenuatedNotSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(simple_app_id_, app_manager_mock_); + utils::MakeShared<am::TTSHmiState>(simple_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); TestSetState(simple_app_, @@ -2049,7 +2049,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForNonMediaApplicationAttenuatedSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(simple_app_id_, app_manager_mock_); + utils::MakeShared<am::TTSHmiState>(simple_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); TestSetState(simple_app_, @@ -2061,7 +2061,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForMediaApplicationAttenuatedNotSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(media_app_id_, app_manager_mock_); + utils::MakeShared<am::TTSHmiState>(media_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); TestSetState(media_app_, @@ -2073,7 +2073,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForMediaApplicationAttenuatedSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(media_app_id_, app_manager_mock_); + utils::MakeShared<am::TTSHmiState>(media_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); TestSetState(media_app_, @@ -2084,8 +2084,8 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForMediaNaviVCApplicationAttenuatedNotSupported) { - am::HmiStatePtr state_tts = utils::MakeShared<am::TTSHmiState>( - media_navi_vc_app_id_, app_manager_mock_); + am::HmiStatePtr state_tts = + utils::MakeShared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); TestSetState(media_navi_vc_app_, @@ -2096,8 +2096,8 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForMediaNaviVCApplicationAttenuatedSupported) { - am::HmiStatePtr state_tts = utils::MakeShared<am::TTSHmiState>( - media_navi_vc_app_id_, app_manager_mock_); + am::HmiStatePtr state_tts = + utils::MakeShared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); TestSetState(media_navi_vc_app_, @@ -2108,7 +2108,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetNaviStreamingStateForNonMediaApplication) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::NaviStreamingHmiState>(simple_app_id_, + utils::MakeShared<am::NaviStreamingHmiState>(simple_app_, app_manager_mock_); TestSetState(simple_app_, state_navi_streming, @@ -2119,7 +2119,7 @@ TEST_F(StateControllerImplTest, SetNaviStreamingStateForNonMediaApplication) { TEST_F(StateControllerImplTest, SetNaviStreamingStateMediaApplicationAttenuatedNotSupported) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::NaviStreamingHmiState>(media_app_id_, + utils::MakeShared<am::NaviStreamingHmiState>(media_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); @@ -2132,7 +2132,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetNaviStreamingStateMediaApplicationAttenuatedSupported) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::NaviStreamingHmiState>(media_app_id_, + utils::MakeShared<am::NaviStreamingHmiState>(media_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); @@ -2145,8 +2145,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetNaviStreamingStateVCApplicationAttenuatedNotSupported) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::NaviStreamingHmiState>(vc_app_id_, - app_manager_mock_); + utils::MakeShared<am::NaviStreamingHmiState>(vc_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); TestSetState(vc_app_, @@ -2158,8 +2157,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetNaviStreamingStateVCApplicationAttenuatedSupported) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::NaviStreamingHmiState>(vc_app_id_, - app_manager_mock_); + utils::MakeShared<am::NaviStreamingHmiState>(vc_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); TestSetState(vc_app_, @@ -2170,7 +2168,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetNaviStreamingStateNaviApplication) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::NaviStreamingHmiState>(navi_app_id_, + utils::MakeShared<am::NaviStreamingHmiState>(navi_app_, app_manager_mock_); TestSetState(navi_app_, state_navi_streming, @@ -2180,7 +2178,7 @@ TEST_F(StateControllerImplTest, SetNaviStreamingStateNaviApplication) { TEST_F(StateControllerImplTest, SetNaviStreamingStateMediaNaviApplication) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::NaviStreamingHmiState>(media_navi_app_id_, + utils::MakeShared<am::NaviStreamingHmiState>(media_navi_app_, app_manager_mock_); TestSetState(media_navi_app_, state_navi_streming, @@ -2189,8 +2187,8 @@ TEST_F(StateControllerImplTest, SetNaviStreamingStateMediaNaviApplication) { } TEST_F(StateControllerImplTest, SetSafetyModeStateForNonMediaApplication) { - am::HmiStatePtr state_safety_mode = utils::MakeShared<am::SafetyModeHmiState>( - simple_app_id_, app_manager_mock_); + am::HmiStatePtr state_safety_mode = + utils::MakeShared<am::SafetyModeHmiState>(simple_app_, app_manager_mock_); TestSetState(simple_app_, state_safety_mode, APP_TYPE_NON_MEDIA, @@ -2199,7 +2197,7 @@ TEST_F(StateControllerImplTest, SetSafetyModeStateForNonMediaApplication) { TEST_F(StateControllerImplTest, SetSafetyModeStateForMediaApplication) { am::HmiStatePtr state_safety_mode = - utils::MakeShared<am::VRHmiState>(media_app_id_, app_manager_mock_); + utils::MakeShared<am::VRHmiState>(media_app_, app_manager_mock_); TestSetState(media_app_, state_safety_mode, APP_TYPE_MEDIA, @@ -2208,8 +2206,8 @@ TEST_F(StateControllerImplTest, SetSafetyModeStateForMediaApplication) { TEST_F(StateControllerImplTest, SetSafetyModeStateForMediaNaviVoiceApplication) { - am::HmiStatePtr state_safety_mode = utils::MakeShared<am::VRHmiState>( - media_navi_vc_app_id_, app_manager_mock_); + am::HmiStatePtr state_safety_mode = + utils::MakeShared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_); TestSetState(media_navi_vc_app_, state_safety_mode, APP_TYPE_MEDIA, @@ -2909,7 +2907,7 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) { mobile_apis::HMILevel::HMI_FULL, mobile_apis::AudioStreamingState::AUDIBLE, mobile_apis::SystemContext::SYSCTXT_MAIN, - app_id); + simple_app_); EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id)); EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()) @@ -2921,7 +2919,7 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) { mobile_apis::HMILevel::HMI_BACKGROUND, mobile_apis::AudioStreamingState::AUDIBLE, mobile_apis::SystemContext::SYSCTXT_MAIN, - app_id); + simple_app_); EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(old_state)); EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()) @@ -2958,7 +2956,7 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) { mobile_apis::HMILevel::HMI_FULL, mobile_apis::AudioStreamingState::AUDIBLE, mobile_apis::SystemContext::SYSCTXT_MAIN, - app_id); + simple_app_); EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id)); EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()) @@ -2970,7 +2968,7 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) { mobile_apis::HMILevel::HMI_BACKGROUND, mobile_apis::AudioStreamingState::AUDIBLE, mobile_apis::SystemContext::SYSCTXT_MAIN, - app_id); + simple_app_); EXPECT_CALL(*simple_app_ptr_, RegularHmiState()) .WillOnce(Return(default_state)); EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()) diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h index ac4950220e..61dddf55b0 100644 --- a/src/components/config_profile/include/config_profile/profile.h +++ b/src/components/config_profile/include/config_profile/profile.h @@ -110,9 +110,9 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, /** * @brief Returns true, if SDL 4.0 is enabled + * @deprecated use max_supported_protocol_version instead */ - // DEPRECATED, use max_supported_protocol_version instead - bool enable_protocol_4() const OVERRIDE; + DEPRECATED bool enable_protocol_4() const OVERRIDE; /** * @brief Returns application icons folder path @@ -656,6 +656,18 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, const bool enable_app_launch_ios() const OVERRIDE; /** + * @brief Returns the millisecond count before timeout + * for transport change feature occures. + */ + uint32_t app_transport_change_timer() const OVERRIDE; + + /** + * @brief Returns the millisecond count used as addition + * value for transport change timer + */ + uint32_t app_transport_change_timer_addition() const OVERRIDE; + + /** * @brief Updates all related values from ini file */ void UpdateValues(); @@ -914,6 +926,8 @@ class Profile : public protocol_handler::ProtocolHandlerSettings, uint16_t max_number_of_ios_device_; uint16_t wait_time_between_apps_; bool enable_app_launch_ios_; + uint32_t app_tranport_change_timer_; + uint32_t app_tranport_change_timer_addition_; bool error_occured_; std::string error_description_; diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc index 6389375bb8..4137476d63 100644 --- a/src/components/config_profile/src/profile.cc +++ b/src/components/config_profile/src/profile.cc @@ -211,6 +211,9 @@ const char* kRemoveBundleIDattemptsKey = "RemoveBundleIDattempts"; const char* kMaxNumberOfiOSDeviceKey = "MaxNumberOfiOSDevice"; const char* kWaitTimeBetweenAppsKey = "WaitTimeBetweenApps"; const char* kEnableAppLaunchIOSKey = "EnableAppLaunchIOS"; +const char* kAppTransportChangeTimerKey = "AppTransportChangeTimer"; +const char* kAppTransportChangeTimerAdditionKey = + "AppTransportChangeTimerAddition"; #ifdef WEB_HMI const char* kDefaultLinkToWebHMI = "HMI/index.html"; #endif // WEB_HMI @@ -304,6 +307,8 @@ const uint16_t kDefaultRemoveBundleIDattempts = 3; const uint16_t kDefaultMaxNumberOfiOSDevice = 10; const uint16_t kDefaultWaitTimeBetweenApps = 4000; const bool kDefaultEnableAppLaunchIOS = true; +const uint32_t kDefaultAppTransportChangeTimer = 500u; +const uint32_t kDefaultAppTransportChangeTimerAddition = 0u; const std::string kAllowedSymbols = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-"; } // namespace @@ -405,6 +410,9 @@ Profile::Profile() , max_number_of_ios_device_(kDefaultMaxNumberOfiOSDevice) , wait_time_between_apps_(kDefaultWaitTimeBetweenApps) , enable_app_launch_ios_(kDefaultEnableAppLaunchIOS) + , app_tranport_change_timer_(kDefaultAppTransportChangeTimer) + , app_tranport_change_timer_addition_( + kDefaultAppTransportChangeTimerAddition) , error_occured_(false) , error_description_() { // SDL version @@ -907,6 +915,14 @@ const bool Profile::enable_app_launch_ios() const { return enable_app_launch_ios_; } +uint32_t Profile::app_transport_change_timer() const { + return app_tranport_change_timer_; +} + +uint32_t Profile::app_transport_change_timer_addition() const { + return app_tranport_change_timer_addition_; +} + const uint16_t Profile::max_number_of_ios_device() const { return max_number_of_ios_device_; } @@ -1884,6 +1900,23 @@ void Profile::UpdateValues() { LOG_UPDATED_BOOL_VALUE( enable_app_launch_ios_, kEnableAppLaunchIOSKey, kAppLaunchSection); + + ReadUIntValue(&app_tranport_change_timer_, + kDefaultAppTransportChangeTimer, + kMainSection, + kAppTransportChangeTimerKey); + + LOG_UPDATED_VALUE( + app_tranport_change_timer_, kAppTransportChangeTimerKey, kMainSection); + + ReadUIntValue(&app_tranport_change_timer_addition_, + kDefaultAppTransportChangeTimerAddition, + kMainSection, + kAppTransportChangeTimerAdditionKey); + + LOG_UPDATED_VALUE(app_tranport_change_timer_addition_, + kAppTransportChangeTimerAdditionKey, + kMainSection); } bool Profile::ReadValue(bool* value, diff --git a/src/components/connection_handler/include/connection_handler/connection.h b/src/components/connection_handler/include/connection_handler/connection.h index bd5858c4cd..b0f9586046 100644 --- a/src/components/connection_handler/include/connection_handler/connection.h +++ b/src/components/connection_handler/include/connection_handler/connection.h @@ -76,8 +76,10 @@ struct Service { Service() : service_type(protocol_handler::kInvalidServiceType) , is_protected_(false) {} + explicit Service(protocol_handler::ServiceType service_type) : service_type(service_type), is_protected_(false) {} + bool operator==(const protocol_handler::ServiceType service_type) const { return this->service_type == service_type; } @@ -209,6 +211,17 @@ class Connection { */ void SetProtectionFlag(const uint8_t session_id, const protocol_handler::ServiceType& service_type); + + /** + * @brief Check if session contains service with specified service type + * @param session_id id of session to check + * @param service_type type of service to check + * @return true if session contains service with specified service type + */ + bool SessionServiceExists( + const uint8_t session_id, + const protocol_handler::ServiceType& service_type) const; + #endif // ENABLE_SECURITY /** * @brief Returns map of sessions which have been opened in diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index aebc612a22..3aa304aabc 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -137,6 +137,24 @@ class ConnectionHandlerImpl void OnDeviceRemoved( const transport_manager::DeviceInfo& device_info) OVERRIDE; + /** + * @brief OnDeviceSwitchingStart notifies listeners on device transport + * switching start + * @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 std::string& device_uid_from, + const std::string& device_uid_to) FINAL; + + /** + * @brief OnDeviceSwitchingFinish notifies listeners on device transport + * switching completion + * @param device_uid the id for the device which is fails to reconnect. + */ + void OnDeviceSwitchingFinish( + const transport_manager::DeviceUID& device_uid) FINAL; + void OnScanDevicesFinished() OVERRIDE; void OnScanDevicesFailed( const transport_manager::SearchDeviceError& error) OVERRIDE; @@ -182,8 +200,8 @@ class ConnectionHandlerImpl * \param is_protected would be service protected * \param hash_id pointer for session hash identifier * \return uint32_t Id (number) of new session if successful, otherwise 0. + * \deprecated */ - // DEPRECATED virtual uint32_t OnSessionStartedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t session_id, @@ -194,7 +212,7 @@ class ConnectionHandlerImpl /** * \brief Callback function used by ProtocolHandler * when Mobile Application initiates start of new session. - * Result must be notified through NotifySessionStartedResult(). + * 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 @@ -209,8 +227,17 @@ class ConnectionHandlerImpl const protocol_handler::ServiceType& service_type, const bool is_protected, const BsonObject* params); - - // DEPRECATED + /** + * \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. + * If not equal to hash assigned to session on start then operation fails. + * \return uint32_t 0 if operation fails, session key otherwise + * \deprecated + */ uint32_t OnSessionEndedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t session_id, @@ -323,6 +350,16 @@ class ConnectionHandlerImpl const uint32_t& key, const protocol_handler::ServiceType& service_type) OVERRIDE; + /** + * @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 + */ + bool SessionServiceExists( + const uint32_t connection_key, + const protocol_handler::ServiceType& service_type) const OVERRIDE; + security_manager::SSLContext::HandshakeContext GetHandshakeContext( uint32_t key) const OVERRIDE; #endif // ENABLE_SECURITY @@ -452,6 +489,29 @@ class ConnectionHandlerImpl uint8_t session_id, uint8_t& protocol_version) const OVERRIDE; + /** + * \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 + */ + int32_t GetDataOnSessionKey( + uint32_t key, + uint32_t* app_id, + std::list<int32_t>* sessions_list, + connection_handler::DeviceHandle* device_id) const OVERRIDE; + + /** + * 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 + */ int32_t GetDataOnSessionKey(uint32_t key, uint32_t* app_id, std::list<int32_t>* sessions_list, @@ -480,54 +540,6 @@ class ConnectionHandlerImpl private: /** - * \brief Struct to keep variables between OnSessionStartedCallback() and - * NotifyServiceStartedResult() - **/ - struct ServiceStartedContext { - transport_manager::ConnectionUID connection_handle_; - uint8_t session_id_; - uint32_t new_session_id_; - protocol_handler::ServiceType service_type_; - uint32_t hash_id_; - bool is_protected_; - - /** - * \brief Constructor - */ - ServiceStartedContext() - : connection_handle_(0) - , session_id_(0) - , new_session_id_(0) - , service_type_(protocol_handler::kInvalidServiceType) - , hash_id_(0) - , is_protected_(0) {} - - /** - * \brief Constructor - * \param connection_handle 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 - **/ - ServiceStartedContext(transport_manager::ConnectionUID connection_handle, - uint8_t session_id, - uint32_t new_session_id, - protocol_handler::ServiceType service_type, - uint32_t hash_id, - bool is_protected) - : connection_handle_(connection_handle) - , session_id_(session_id) - , new_session_id_(new_session_id) - , service_type_(service_type) - , hash_id_(hash_id) - , is_protected_(is_protected) {} - }; - - /** * \brief Disconnect application. * * \param device_handle DeviceHandle of disconnected device. @@ -537,19 +549,6 @@ class ConnectionHandlerImpl void OnConnectionEnded(const transport_manager::ConnectionUID connection_id); - /** - * \brief Convenient method to call NotifySessionStartedResult() with - * negative result. - * \param connection_handle Identifier of connection within which session - * exists - * \param session_id session ID passed to OnSessionStartedCallback() - * \param is_protected whether the service would be protected - **/ - void NotifySessionStartedFailure( - const transport_manager::ConnectionUID connection_handle, - const uint8_t session_id, - bool is_protected); - const ConnectionHandlerSettings& settings_; /** * \brief Pointer to observer @@ -585,7 +584,8 @@ class ConnectionHandlerImpl utils::StlMapDeleter<ConnectionList> connection_list_deleter_; sync_primitives::Lock start_service_context_map_lock_; - std::map<uint32_t, ServiceStartedContext> start_service_context_map_; + std::map<uint32_t, protocol_handler::SessionContext> + start_service_context_map_; #ifdef BUILD_TESTS // Methods for test usage diff --git a/src/components/connection_handler/include/connection_handler/device.h b/src/components/connection_handler/include/connection_handler/device.h index cee0bf8875..26376c1d8d 100644 --- a/src/components/connection_handler/include/connection_handler/device.h +++ b/src/components/connection_handler/include/connection_handler/device.h @@ -36,6 +36,7 @@ #include <string> #include <map> #include <vector> +#include "transport_manager/common.h" /** * \namespace connection_handler @@ -46,7 +47,7 @@ namespace connection_handler { /** * \brief Type for DeviceHandle */ -typedef uint32_t DeviceHandle; +typedef transport_manager::DeviceHandle DeviceHandle; typedef std::vector<int32_t> AppList; /** @@ -112,6 +113,6 @@ class Device { /** * \brief Type for Devices map */ -typedef std::map<int32_t, Device> DeviceMap; +typedef std::map<DeviceHandle, Device> DeviceMap; } // namespace connection_handler #endif // SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_DEVICE_H_ diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc index 202736e612..d494611643 100644 --- a/src/components/connection_handler/src/connection.cc +++ b/src/components/connection_handler/src/connection.cc @@ -39,6 +39,7 @@ #include "protocol_handler/protocol_packet.h" #include "utils/logger.h" #include "utils/macro.h" +#include "utils/helpers.h" #ifdef ENABLE_SECURITY #include "security_manager/ssl_context.h" @@ -148,6 +149,10 @@ bool Connection::AddNewService(uint8_t session_id, LOG4CXX_WARN(logger_, "Wrong service " << static_cast<int>(service_type)); return false; } + + LOG4CXX_DEBUG(logger_, + "Add service " << service_type << " for session " + << static_cast<uint32_t>(session_id)); sync_primitives::AutoLock lock(session_map_lock_); SessionMap::iterator session_it = session_map_.find(session_id); @@ -156,6 +161,20 @@ bool Connection::AddNewService(uint8_t session_id, return false; } Session& session = session_it->second; + + if (session.protocol_version <= protocol_handler::PROTOCOL_VERSION_2 && + helpers::Compare<protocol_handler::ServiceType, + helpers::EQ, + helpers::ONE>( + service_type, + protocol_handler::ServiceType::kAudio, + protocol_handler::ServiceType::kMobileNav)) { + LOG4CXX_WARN(logger_, + "Audio and video services are disallowed for protocol version " + "2 or lower"); + return false; + } + Service* service = session.FindService(service_type); // if service already exists if (service) { @@ -294,6 +313,23 @@ void Connection::SetProtectionFlag( service_rpc->is_protected_ = true; } } + +bool Connection::SessionServiceExists( + const uint8_t session_id, + const protocol_handler::ServiceType& service_type) const { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(session_map_lock_); + + SessionMap::const_iterator session_it = session_map_.find(session_id); + if (session_it == session_map_.end()) { + LOG4CXX_WARN(logger_, "Session not found in this connection!"); + return false; + } + + const Session& session = session_it->second; + return session.FindService(service_type); +} + #endif // ENABLE_SECURITY ConnectionHandle Connection::connection_handle() const { diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index bd5b3d79bb..7ea9efa1cc 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -38,6 +38,7 @@ #include "connection_handler/connection_handler_impl.h" #include "transport_manager/info.h" +#include "encryption/hashing.h" #ifdef ENABLE_SECURITY #include "security_manager/security_manager.h" @@ -136,15 +137,21 @@ void ConnectionHandlerImpl::OnDeviceFound( void ConnectionHandlerImpl::OnDeviceAdded( const transport_manager::DeviceInfo& device_info) { LOG4CXX_AUTO_TRACE(logger_); - device_list_.insert( - DeviceMap::value_type(device_info.device_handle(), - Device(device_info.device_handle(), - device_info.name(), - device_info.mac_address(), - device_info.connection_type()))); - sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); - if (connection_handler_observer_) { - connection_handler_observer_->OnDeviceListUpdated(device_list_); + auto handle = device_info.device_handle(); + + Device device(handle, + device_info.name(), + device_info.mac_address(), + device_info.connection_type()); + + auto result = device_list_.insert(std::make_pair(handle, device)); + + if (!result.second) { + LOG4CXX_ERROR(logger_, + "Device with handle " << handle + << " is known already. " + "Information won't be updated."); + return; } } @@ -182,6 +189,49 @@ void ConnectionHandlerImpl::OnDeviceRemoved( device_list_.erase(device_info.device_handle()); } +void ConnectionHandlerImpl::OnDeviceSwitchingFinish( + const transport_manager::DeviceUID& device_uid) { + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); + if (connection_handler_observer_) { + connection_handler_observer_->OnDeviceSwitchingFinish( + encryption::MakeHash(device_uid)); + } +} + +namespace { +struct DeviceFinder { + explicit DeviceFinder(const std::string& device_uid) + : device_uid_(device_uid) {} + bool operator()(const DeviceMap::value_type& device) { + return device_uid_ == device.second.mac_address(); + } + + private: + const std::string& device_uid_; +}; +} // namespace + +void ConnectionHandlerImpl::OnDeviceSwitchingStart( + const std::string& device_uid_from, const std::string& device_uid_to) { + auto device_from = + std::find_if(device_list_.begin(), + device_list_.end(), + DeviceFinder(encryption::MakeHash(device_uid_from))); + + auto device_to = + std::find_if(device_list_.begin(), + device_list_.end(), + DeviceFinder(encryption::MakeHash(device_uid_to))); + + DCHECK_OR_RETURN_VOID(device_list_.end() != device_from); + DCHECK_OR_RETURN_VOID(device_list_.end() != device_to); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); + if (connection_handler_observer_) { + connection_handler_observer_->OnDeviceSwitchingStart(device_from->second, + device_to->second); + } +} + void ConnectionHandlerImpl::OnScanDevicesFinished() { LOG4CXX_AUTO_TRACE(logger_); } @@ -284,7 +334,6 @@ bool AllowProtection(const ConnectionHandlerSettings& settings, } #endif // ENABLE_SECURITY -// DEPRECATED uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t session_id, @@ -363,18 +412,17 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( const BsonObject* params) { LOG4CXX_AUTO_TRACE(logger_); - uint32_t new_session_id = 0; - uint32_t hash_id = protocol_handler::HASH_ID_WRONG; + std::vector<std::string> rejected_params; + protocol_handler::SessionContext context(connection_handle, + session_id, + 0, + service_type, + protocol_handler::HASH_ID_WRONG, + is_protected); #ifdef ENABLE_SECURITY if (!AllowProtection(get_settings(), service_type, is_protected)) { - std::vector<std::string> empty; - protocol_handler_->NotifySessionStartedResult(connection_handle, - session_id, - new_session_id, - hash_id, - is_protected, - empty); + protocol_handler_->NotifySessionStarted(context, rejected_params); return; } #endif // ENABLE_SECURITY @@ -382,19 +430,22 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( ConnectionList::iterator it = connection_list_.find(connection_handle); if (connection_list_.end() == it) { LOG4CXX_ERROR(logger_, "Unknown connection!"); - NotifySessionStartedFailure(connection_handle, session_id, is_protected); + protocol_handler_->NotifySessionStarted(context, rejected_params); return; } Connection* connection = it->second; + context.is_new_service_ = + !connection->SessionServiceExists(session_id, service_type); + if ((0 == session_id) && (protocol_handler::kRpc == service_type)) { - new_session_id = connection->AddNewSession(); - if (0 == new_session_id) { + context.new_session_id_ = connection->AddNewSession(); + if (0 == context.new_session_id_) { LOG4CXX_ERROR(logger_, "Couldn't start new session!"); - NotifySessionStartedFailure(connection_handle, session_id, is_protected); + protocol_handler_->NotifySessionStarted(context, rejected_params); return; } - hash_id = KeyFromPair(connection_handle, new_session_id); + context.hash_id_ = KeyFromPair(connection_handle, context.new_session_id_); } else { // Could be create new service or protected exists one if (!connection->AddNewService(session_id, service_type, is_protected)) { LOG4CXX_ERROR(logger_, @@ -404,22 +455,25 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( #endif // ENABLE_SECURITY << " service " << static_cast<int>(service_type) << " for session " << static_cast<int>(session_id)); - NotifySessionStartedFailure(connection_handle, session_id, is_protected); + protocol_handler_->NotifySessionStarted(context, rejected_params); return; } - new_session_id = session_id; - hash_id = protocol_handler::HASH_ID_NOT_SUPPORTED; + context.new_session_id_ = session_id; + context.hash_id_ = protocol_handler::HASH_ID_NOT_SUPPORTED; } sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { - const uint32_t session_key = KeyFromPair(connection_handle, new_session_id); + const uint32_t session_key = + KeyFromPair(connection_handle, context.new_session_id_); + + uint32_t app_id = 0; + GetDataOnSessionKey( + session_key, &app_id, NULL, static_cast<DeviceHandle*>(NULL)); + if (app_id > 0) { + context.is_ptu_required_ = + !connection_handler_observer_->CheckAppIsNavi(app_id); + } - ServiceStartedContext context(connection_handle, - session_id, - new_session_id, - service_type, - hash_id, - is_protected); { sync_primitives::AutoLock auto_lock(start_service_context_map_lock_); start_service_context_map_[session_key] = context; @@ -432,13 +486,7 @@ void ConnectionHandlerImpl::OnSessionStartedCallback( params); } else { if (protocol_handler_) { - std::vector<std::string> empty; - protocol_handler_->NotifySessionStartedResult(connection_handle, - session_id, - new_session_id, - hash_id, - is_protected, - empty); + protocol_handler_->NotifySessionStarted(context, rejected_params); } } } @@ -449,11 +497,10 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult( std::vector<std::string>& rejected_params) { LOG4CXX_AUTO_TRACE(logger_); - ServiceStartedContext context; + protocol_handler::SessionContext context; { sync_primitives::AutoLock auto_lock(start_service_context_map_lock_); - std::map<uint32_t, ServiceStartedContext>::iterator it = - start_service_context_map_.find(session_key); + auto it = start_service_context_map_.find(session_key); if (it == start_service_context_map_.end()) { LOG4CXX_ERROR(logger_, "context for start service not found!"); return; @@ -465,8 +512,7 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult( Connection* connection = NULL; { sync_primitives::AutoReadLock lock(connection_list_lock_); - ConnectionList::iterator it = - connection_list_.find(context.connection_handle_); + ConnectionList::iterator it = connection_list_.find(context.connection_id_); if (connection_list_.end() == it) { LOG4CXX_ERROR(logger_, "connection not found"); return; @@ -480,35 +526,14 @@ void ConnectionHandlerImpl::NotifyServiceStartedResult( if (protocol_handler::kRpc == context.service_type_) { connection->RemoveSession(context.new_session_id_); } else { - connection->RemoveService(context.session_id_, context.service_type_); + connection->RemoveService(context.initial_session_id_, + context.service_type_); } context.new_session_id_ = 0; } if (protocol_handler_ != NULL) { - protocol_handler_->NotifySessionStartedResult(context.connection_handle_, - context.session_id_, - context.new_session_id_, - context.hash_id_, - context.is_protected_, - rejected_params); - } -} - -void ConnectionHandlerImpl::NotifySessionStartedFailure( - const transport_manager::ConnectionUID connection_handle, - const uint8_t session_id, - bool is_protected) { - LOG4CXX_AUTO_TRACE(logger_); - if (protocol_handler_) { - std::vector<std::string> empty; - protocol_handler_->NotifySessionStartedResult( - connection_handle, - session_id, - 0, - protocol_handler::HASH_ID_WRONG, - is_protected, - empty); + protocol_handler_->NotifySessionStarted(context, rejected_params); } } @@ -542,7 +567,6 @@ void ConnectionHandlerImpl::OnMalformedMessageCallback( CloseConnection(connection_handle); } -// DEPRECATED uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t session_id, @@ -648,7 +672,7 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( uint32_t key, uint32_t* app_id, std::list<int32_t>* sessions_list, - uint32_t* device_id) const { + connection_handler::DeviceHandle* device_id) const { LOG4CXX_AUTO_TRACE(logger_); const int32_t error_result = -1; @@ -692,6 +716,18 @@ int32_t ConnectionHandlerImpl::GetDataOnSessionKey( return 0; } +int32_t ConnectionHandlerImpl::GetDataOnSessionKey( + uint32_t key, + uint32_t* app_id, + std::list<int32_t>* sessions_list, + uint32_t* device_id) const { + LOG4CXX_AUTO_TRACE(logger_); + DeviceHandle handle; + int32_t result = GetDataOnSessionKey(key, app_id, sessions_list, &handle); + *device_id = static_cast<uint32_t>(handle); + return result; +} + const ConnectionHandlerSettings& ConnectionHandlerImpl::get_settings() const { return settings_; } @@ -842,6 +878,24 @@ void ConnectionHandlerImpl::SetProtectionFlag( connection.SetProtectionFlag(session_id, service_type); } +bool ConnectionHandlerImpl::SessionServiceExists( + const uint32_t connection_key, + const protocol_handler::ServiceType& service_type) const { + LOG4CXX_AUTO_TRACE(logger_); + transport_manager::ConnectionUID connection_handle = 0; + uint8_t session_id = 0; + PairFromKey(connection_key, &connection_handle, &session_id); + + sync_primitives::AutoReadLock lock(connection_list_lock_); + ConnectionList::const_iterator it = connection_list_.find(connection_handle); + if (connection_list_.end() == it) { + LOG4CXX_ERROR(logger_, "Unknown connection!"); + return false; + } + const Connection& connection = *it->second; + return connection.SessionServiceExists(session_id, service_type); +} + security_manager::SSLContext::HandshakeContext ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const { return connection_handler_observer_->GetHandshakeContext(key); diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc index ec4e12ffe2..a951598917 100644 --- a/src/components/connection_handler/test/connection_handler_impl_test.cc +++ b/src/components/connection_handler/test/connection_handler_impl_test.cc @@ -61,6 +61,7 @@ using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRefOfCopy; using ::testing::SaveArg; +using ::testing::SaveArgPointee; // custom action to call a member function with 3 arguments ACTION_P5(InvokeMemberFuncWithArg3, ptr, memberFunc, a, b, c) { @@ -118,42 +119,51 @@ class ConnectionHandlerTest : public ::testing::Test { void AddTestSession() { protocol_handler_test::MockProtocolHandler temp_protocol_handler; connection_handler_->set_protocol_handler(&temp_protocol_handler); - EXPECT_CALL(temp_protocol_handler, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce( - DoAll(SaveArg<2>(&start_session_id_), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&out_context_)); connection_handler_->OnSessionStartedCallback( uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); connection_handler_->set_protocol_handler(NULL); - EXPECT_NE(0u, start_session_id_); - EXPECT_EQ(SessionHash(uid_, start_session_id_), out_hash_id_); - connection_key_ = connection_handler_->KeyFromPair(uid_, start_session_id_); - CheckSessionExists(uid_, start_session_id_); + EXPECT_NE(0u, out_context_.new_session_id_); + EXPECT_EQ(SessionHash(uid_, out_context_.new_session_id_), + out_context_.hash_id_); + connection_key_ = + connection_handler_->KeyFromPair(uid_, out_context_.new_session_id_); + CheckSessionExists(uid_, out_context_.new_session_id_); } uint32_t SessionHash(const uint32_t connection, const uint32_t session) { return connection_handler_->KeyFromPair(connection, session); } void AddTestService(ServiceType service_type) { - EXPECT_NE(0u, start_session_id_); - EXPECT_EQ(SessionHash(uid_, start_session_id_), out_hash_id_); - connection_key_ = connection_handler_->KeyFromPair(uid_, start_session_id_); - CheckSessionExists(uid_, start_session_id_); + EXPECT_NE(0u, out_context_.new_session_id_); + EXPECT_EQ(SessionHash(uid_, out_context_.new_session_id_), + out_context_.hash_id_); + connection_key_ = + connection_handler_->KeyFromPair(uid_, out_context_.new_session_id_); + CheckSessionExists(uid_, out_context_.new_session_id_); + + // Set protocol version to 3 if audio or video service should be tested + if (service_type == ServiceType::kAudio || + service_type == ServiceType::kMobileNav) { + ChangeProtocol(uid_, + out_context_.new_session_id_, + protocol_handler::PROTOCOL_VERSION_3); + } - uint32_t session_id = 0; + SessionContext context; protocol_handler_test::MockProtocolHandler temp_protocol_handler; connection_handler_->set_protocol_handler(&temp_protocol_handler); - EXPECT_CALL(temp_protocol_handler, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(SaveArg<2>(&session_id)); + EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&context)); connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, service_type, PROTECTION_OFF, static_cast<BsonObject*>(0)); connection_handler_->set_protocol_handler(NULL); - EXPECT_EQ(session_id, start_session_id_); + EXPECT_EQ(context.new_session_id_, out_context_.new_session_id_); } // Check Service Wrapper @@ -279,8 +289,7 @@ class ConnectionHandlerTest : public ::testing::Test { transport_manager::DeviceHandle device_handle_; transport_manager::ConnectionUID uid_; uint32_t connection_key_; - uint32_t start_session_id_; - uint32_t out_hash_id_; + protocol_handler::SessionContext out_context_; std::string connection_type_; std::string device_name_; @@ -295,17 +304,17 @@ TEST_F(ConnectionHandlerTest, StartSession_NoConnection) { // Null sessionId for start new session const uint8_t sessionID = 0; // Start new session with RPC service - uint32_t result_fail = 0; + protocol_handler::SessionContext context; + connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(DoAll(SaveArg<2>(&result_fail), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&context)); connection_handler_->OnSessionStartedCallback( uid_, sessionID, kRpc, PROTECTION_ON, static_cast<BsonObject*>(NULL)); // Unknown connection error is '0' - EXPECT_EQ(0u, result_fail); - EXPECT_EQ(protocol_handler::HASH_ID_WRONG, out_hash_id_); + EXPECT_EQ(0u, context.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_WRONG, context.hash_id_); ASSERT_TRUE(connection_handler_->getConnectionList().empty()); } @@ -340,11 +349,12 @@ TEST_F(ConnectionHandlerTest, GetAppIdOnSessionKey) { AddTestSession(); uint32_t app_id = 0; - const uint32_t testid = SessionHash(uid_, start_session_id_); + const uint32_t testid = SessionHash(uid_, out_context_.new_session_id_); + connection_handler::DeviceHandle null_handle = 0; EXPECT_EQ(0, connection_handler_->GetDataOnSessionKey( - connection_key_, &app_id, NULL, NULL)); + connection_key_, &app_id, NULL, &null_handle)); EXPECT_EQ(testid, app_id); } @@ -352,9 +362,10 @@ TEST_F(ConnectionHandlerTest, GetAppIdOnSessionKey_SessionNotStarted) { AddTestDeviceConnection(); uint32_t app_id = 0; + connection_handler::DeviceHandle null_handle = 0; EXPECT_EQ(-1, connection_handler_->GetDataOnSessionKey( - connection_key_, &app_id, NULL, NULL)); + connection_key_, &app_id, NULL, &null_handle)); } TEST_F(ConnectionHandlerTest, GetDeviceID) { @@ -405,7 +416,8 @@ TEST_F(ConnectionHandlerTest, GetApplicationsOnDevice) { 0, connection_handler_->GetDataOnDeviceID(handle, NULL, &applications_list)); - uint32_t test_id = connection_handler_->KeyFromPair(uid_, start_session_id_); + uint32_t test_id = + connection_handler_->KeyFromPair(uid_, out_context_.new_session_id_); EXPECT_EQ(1u, applications_list.size()); EXPECT_EQ(test_id, applications_list.front()); @@ -417,7 +429,7 @@ TEST_F(ConnectionHandlerTest, GetDefaultProtocolVersion) { uint8_t protocol_version = 0; EXPECT_TRUE(connection_handler_->ProtocolVersionUsed( - uid_, start_session_id_, protocol_version)); + uid_, out_context_.new_session_id_, protocol_version)); EXPECT_EQ(PROTOCOL_VERSION_2, protocol_version); } @@ -425,11 +437,11 @@ TEST_F(ConnectionHandlerTest, GetDefaultProtocolVersion) { TEST_F(ConnectionHandlerTest, GetProtocolVersion) { AddTestDeviceConnection(); AddTestSession(); - ChangeProtocol(uid_, start_session_id_, PROTOCOL_VERSION_3); + ChangeProtocol(uid_, out_context_.new_session_id_, PROTOCOL_VERSION_3); uint8_t protocol_version = 0; EXPECT_TRUE(connection_handler_->ProtocolVersionUsed( - uid_, start_session_id_, protocol_version)); + uid_, out_context_.new_session_id_, protocol_version)); EXPECT_EQ(PROTOCOL_VERSION_3, protocol_version); } @@ -439,14 +451,14 @@ TEST_F(ConnectionHandlerTest, GetProtocolVersionAfterBinding) { AddTestSession(); uint8_t protocol_version = 0; EXPECT_TRUE(connection_handler_->ProtocolVersionUsed( - uid_, start_session_id_, protocol_version)); + uid_, out_context_.new_session_id_, protocol_version)); EXPECT_EQ(PROTOCOL_VERSION_2, protocol_version); connection_handler_->BindProtocolVersionWithSession(connection_key_, PROTOCOL_VERSION_3); EXPECT_TRUE(connection_handler_->ProtocolVersionUsed( - uid_, start_session_id_, protocol_version)); + uid_, out_context_.new_session_id_, protocol_version)); EXPECT_EQ(PROTOCOL_VERSION_3, protocol_version); } @@ -458,15 +470,22 @@ TEST_F(ConnectionHandlerTest, GetPairFromKey) { uint32_t test_uid = 0; connection_handler_->PairFromKey(connection_key_, &test_uid, &session_id); EXPECT_EQ(uid_, test_uid); - EXPECT_EQ(start_session_id_, session_id); + EXPECT_EQ(out_context_.new_session_id_, session_id); } TEST_F(ConnectionHandlerTest, IsHeartBeatSupported) { AddTestDeviceConnection(); AddTestSession(); - ChangeProtocol(uid_, start_session_id_, PROTOCOL_VERSION_3); - EXPECT_TRUE( - connection_handler_->IsHeartBeatSupported(uid_, start_session_id_)); + ChangeProtocol(uid_, out_context_.new_session_id_, PROTOCOL_VERSION_3); + EXPECT_TRUE(connection_handler_->IsHeartBeatSupported( + uid_, out_context_.new_session_id_)); +} + +MATCHER_P(SameDevice, device, "") { + return arg.device_handle() == device.device_handle() && + arg.user_friendly_name() == device.user_friendly_name() && + arg.mac_address() == device.mac_address() && + arg.connection_type() == device.connection_type(); } TEST_F(ConnectionHandlerTest, SendEndServiceWithoutSetProtocolHandler) { @@ -552,8 +571,8 @@ TEST_F(ConnectionHandlerTest, OnApplicationFloodCallBack) { connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, SendEndSession(uid_, start_session_id_)) - .Times(1); + EXPECT_CALL(mock_protocol_handler_, + SendEndSession(uid_, out_context_.new_session_id_)).Times(1); InSequence seq; EXPECT_CALL(mock_connection_handler_observer, OnServiceEndedCallback(connection_key_, kMobileNav, kCommon)); @@ -579,7 +598,8 @@ TEST_F(ConnectionHandlerTest, OnApplicationFloodCallBack_SessionFound) { &mock_connection_handler_observer); connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, SendEndSession(uid_, start_session_id_)); + EXPECT_CALL(mock_protocol_handler_, + SendEndSession(uid_, out_context_.new_session_id_)); InSequence seq; EXPECT_CALL(mock_connection_handler_observer, OnServiceEndedCallback(connection_key_, kMobileNav, kFlood)); @@ -853,7 +873,8 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithCommonReason) { TestAsyncWaiter waiter; uint32_t times = 0; - EXPECT_CALL(mock_protocol_handler_, SendEndSession(uid_, start_session_id_)) + EXPECT_CALL(mock_protocol_handler_, + SendEndSession(uid_, out_context_.new_session_id_)) .WillOnce(NotifyTestAsyncWaiter(&waiter)); times++; @@ -894,7 +915,8 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithFloodReason) { TestAsyncWaiter waiter; uint32_t times = 0; - EXPECT_CALL(mock_protocol_handler_, SendEndSession(uid_, start_session_id_)) + EXPECT_CALL(mock_protocol_handler_, + SendEndSession(uid_, out_context_.new_session_id_)) .WillOnce(NotifyTestAsyncWaiter(&waiter)); times++; @@ -935,8 +957,8 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithMalformedMessage) { TestAsyncWaiter waiter; uint32_t times = 0; - EXPECT_CALL(mock_protocol_handler_, SendEndSession(uid_, start_session_id_)) - .Times(0); + EXPECT_CALL(mock_protocol_handler_, + SendEndSession(uid_, out_context_.new_session_id_)).Times(0); InSequence seq; EXPECT_CALL(mock_connection_handler_observer, @@ -975,8 +997,8 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithMalformedMessage) { TestAsyncWaiter waiter; uint32_t times = 0; - EXPECT_CALL(mock_protocol_handler_, SendEndSession(uid_, start_session_id_)) - .Times(0); + EXPECT_CALL(mock_protocol_handler_, + SendEndSession(uid_, out_context_.new_session_id_)).Times(0); InSequence seq; EXPECT_CALL(mock_connection_handler_observer, @@ -1015,7 +1037,8 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithCommonReason) { TestAsyncWaiter waiter; uint32_t times = 0; - EXPECT_CALL(mock_protocol_handler_, SendEndSession(uid_, start_session_id_)) + EXPECT_CALL(mock_protocol_handler_, + SendEndSession(uid_, out_context_.new_session_id_)) .WillOnce(NotifyTestAsyncWaiter(&waiter)); times++; @@ -1046,34 +1069,34 @@ TEST_F(ConnectionHandlerTest, StartService_withServices) { // Add virtual device and connection AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); - uint32_t start_audio = 0; - uint32_t start_video = 0; + SessionContext audio_context, video_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(DoAll(SaveArg<2>(&start_audio), SaveArg<3>(&out_hash_id_))) - .WillOnce(DoAll(SaveArg<2>(&start_video), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&audio_context)) + .WillOnce(SaveArg<0>(&video_context)); // Start Audio service connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); - EXPECT_EQ(start_session_id_, start_audio); - CheckServiceExists(uid_, start_session_id_, kAudio, true); - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); + EXPECT_NE(0u, audio_context.new_session_id_); + CheckServiceExists(uid_, audio_context.new_session_id_, kAudio, true); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, audio_context.hash_id_); // Start Audio service connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kMobileNav, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); - EXPECT_EQ(start_session_id_, start_video); - CheckServiceExists(uid_, start_session_id_, kMobileNav, true); - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); + EXPECT_NE(0u, video_context.new_session_id_); + CheckServiceExists(uid_, video_context.new_session_id_, kMobileNav, true); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, video_context.hash_id_); connection_handler_->set_protocol_handler(NULL); } @@ -1081,22 +1104,27 @@ TEST_F(ConnectionHandlerTest, StartService_withServices) { TEST_F(ConnectionHandlerTest, StartService_withServices_withParams) { AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); + + SessionContext video_context; - uint32_t start_video = 0; // create a dummy pointer int dummy = 0; std::vector<std::string> empty; BsonObject* dummy_param = reinterpret_cast<BsonObject*>(&dummy); connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, empty)) - .WillOnce(DoAll(SaveArg<2>(&start_video), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty)) + .WillOnce(SaveArg<0>(&video_context)); - connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kMobileNav, PROTECTION_OFF, dummy_param); - EXPECT_EQ(start_session_id_, start_video); - CheckServiceExists(uid_, start_session_id_, kMobileNav, true); - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); + connection_handler_->OnSessionStartedCallback(uid_, + out_context_.new_session_id_, + kMobileNav, + PROTECTION_OFF, + dummy_param); + EXPECT_EQ(out_context_.new_session_id_, video_context.new_session_id_); + CheckServiceExists(uid_, out_context_.new_session_id_, kMobileNav, true); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, video_context.hash_id_); connection_handler_->set_protocol_handler(NULL); } @@ -1117,39 +1145,39 @@ TEST_F(ConnectionHandlerTest, ServiceStop_UnExistService) { uint32_t dummy_hash = 0u; const uint32_t end_session_result = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, &dummy_hash, kAudio); + uid_, out_context_.new_session_id_, &dummy_hash, kAudio); EXPECT_EQ(0u, end_session_result); - CheckServiceExists(uid_, start_session_id_, kAudio, false); + CheckServiceExists(uid_, out_context_.new_session_id_, kAudio, false); } TEST_F(ConnectionHandlerTest, ServiceStop) { AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); - uint32_t start_audio = 0; + SessionContext audio_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillRepeatedly( - DoAll(SaveArg<2>(&start_audio), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillRepeatedly(SaveArg<0>(&audio_context)); // Check ignoring hash_id on stop non-rpc service for (uint32_t some_hash_id = 0; some_hash_id < 0xFF; ++some_hash_id) { // Start audio service connection_handler_->OnSessionStartedCallback( uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); - EXPECT_EQ(start_session_id_, start_audio); - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); + EXPECT_EQ(out_context_.new_session_id_, audio_context.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, audio_context.hash_id_); const uint32_t end_session_result = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, &some_hash_id, kAudio); + uid_, out_context_.new_session_id_, &some_hash_id, kAudio); EXPECT_EQ(connection_key_, end_session_result); - CheckServiceExists(uid_, start_session_id_, kAudio, false); + CheckServiceExists(uid_, out_context_.new_session_id_, kAudio, false); } } @@ -1158,18 +1186,18 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckHash) { for (uint32_t session = 0; session < 0xFF; ++session) { AddTestSession(); - const uint32_t hash = connection_key_; + uint32_t hash = connection_key_; uint32_t wrong_hash = hash + 1; const uint32_t end_audio_wrong_hash = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, &wrong_hash, kRpc); + uid_, out_context_.new_session_id_, &wrong_hash, kRpc); EXPECT_EQ(0u, end_audio_wrong_hash); EXPECT_EQ(protocol_handler::HASH_ID_WRONG, wrong_hash); - CheckSessionExists(uid_, start_session_id_); + CheckSessionExists(uid_, out_context_.new_session_id_); const uint32_t end_audio = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, hash, kRpc); + uid_, out_context_.new_session_id_, &hash, kRpc); EXPECT_EQ(connection_key_, end_audio); CheckSessionExists(uid_, 0); } @@ -1181,17 +1209,17 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckSpecificHash) { AddTestSession(); uint32_t wrong_hash = protocol_handler::HASH_ID_WRONG; - const uint32_t hash = protocol_handler::HASH_ID_NOT_SUPPORTED; + uint32_t hash = protocol_handler::HASH_ID_NOT_SUPPORTED; const uint32_t end_audio_wrong_hash = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, wrong_hash, kRpc); + uid_, out_context_.new_session_id_, &wrong_hash, kRpc); EXPECT_EQ(0u, end_audio_wrong_hash); EXPECT_EQ(protocol_handler::HASH_ID_WRONG, wrong_hash); - CheckSessionExists(uid_, start_session_id_); + CheckSessionExists(uid_, out_context_.new_session_id_); const uint32_t end_audio = connection_handler_->OnSessionEndedCallback( - uid_, start_session_id_, hash, kRpc); + uid_, out_context_.new_session_id_, &hash, kRpc); EXPECT_EQ(connection_key_, end_audio); CheckSessionExists(uid_, 0); } @@ -1200,16 +1228,17 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckSpecificHash) { TEST_F(ConnectionHandlerTest, SessionStarted_WithRpc) { // Add virtual device and connection AddTestDeviceConnection(); + out_context_.initial_session_id_ = 1u; // Expect that rpc service has started connection_handler_test::MockConnectionHandlerObserver mock_connection_handler_observer; connection_handler_->set_connection_handler_observer( &mock_connection_handler_observer); - uint32_t session_key = - connection_handler_->KeyFromPair(uid_, start_session_id_); std::vector<std::string> empty; + uint32_t session_key = + connection_handler_->KeyFromPair(uid_, out_context_.initial_session_id_); EXPECT_CALL(mock_connection_handler_observer, - OnServiceStartedCallback(device_handle_, session_key, kRpc, NULL)) + OnServiceStartedCallback(device_handle_, _, kRpc, NULL)) .WillOnce(InvokeMemberFuncWithArg3( connection_handler_, &ConnectionHandler::NotifyServiceStartedResult, @@ -1217,22 +1246,25 @@ TEST_F(ConnectionHandlerTest, SessionStarted_WithRpc) { true, ByRef(empty))); - uint32_t new_session_id = 0; + EXPECT_CALL(mock_connection_handler_observer, CheckAppIsNavi(_)) + .WillOnce(Return(true)); + connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(DoAll(SaveArg<2>(&new_session_id), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&out_context_)); // Start new session with RPC service connection_handler_->OnSessionStartedCallback( uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); - EXPECT_NE(0u, new_session_id); + EXPECT_NE(0u, out_context_.new_session_id_); } TEST_F(ConnectionHandlerTest, ServiceStarted_Video_SUCCESS) { AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); int dummy = 0; BsonObject* dummy_params = reinterpret_cast<BsonObject*>(&dummy); @@ -1242,7 +1274,7 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_SUCCESS) { connection_handler_->set_connection_handler_observer( &mock_connection_handler_observer); uint32_t session_key = - connection_handler_->KeyFromPair(uid_, start_session_id_); + connection_handler_->KeyFromPair(uid_, out_context_.new_session_id_); std::vector<std::string> empty; EXPECT_CALL(mock_connection_handler_observer, OnServiceStartedCallback( @@ -1253,23 +1285,28 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_SUCCESS) { session_key, true, ByRef(empty))); + EXPECT_CALL(mock_connection_handler_observer, CheckAppIsNavi(_)) + .WillOnce(Return(true)); - // confirm that NotifySessionStartedResult() is called - uint32_t new_session_id = 0; + // confirm that NotifySessionStarted() is called connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, false, empty)) - .WillOnce(DoAll(SaveArg<2>(&new_session_id), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty)) + .WillOnce(SaveArg<0>(&out_context_)); - connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kMobileNav, PROTECTION_OFF, dummy_params); + connection_handler_->OnSessionStartedCallback(uid_, + out_context_.new_session_id_, + kMobileNav, + PROTECTION_OFF, + dummy_params); - EXPECT_NE(0u, new_session_id); + EXPECT_NE(0u, out_context_.new_session_id_); } TEST_F(ConnectionHandlerTest, ServiceStarted_Video_FAILURE) { AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); int dummy = 0; BsonObject* dummy_params = reinterpret_cast<BsonObject*>(&dummy); @@ -1279,7 +1316,7 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_FAILURE) { connection_handler_->set_connection_handler_observer( &mock_connection_handler_observer); uint32_t session_key = - connection_handler_->KeyFromPair(uid_, start_session_id_); + connection_handler_->KeyFromPair(uid_, out_context_.new_session_id_); std::vector<std::string> empty; EXPECT_CALL(mock_connection_handler_observer, OnServiceStartedCallback( @@ -1290,18 +1327,21 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_FAILURE) { session_key, false, ByRef(empty))); + EXPECT_CALL(mock_connection_handler_observer, CheckAppIsNavi(_)) + .WillOnce(Return(true)); - // confirm that NotifySessionStartedResult() is called - uint32_t new_session_id = 0; + // confirm that NotifySessionStarted() is called connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, false, empty)) - .WillOnce(DoAll(SaveArg<2>(&new_session_id), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty)) + .WillOnce(SaveArg<0>(&out_context_)); - connection_handler_->OnSessionStartedCallback( - uid_, start_session_id_, kMobileNav, PROTECTION_OFF, dummy_params); + connection_handler_->OnSessionStartedCallback(uid_, + out_context_.new_session_id_, + kMobileNav, + PROTECTION_OFF, + dummy_params); - EXPECT_EQ(0u, new_session_id); + EXPECT_EQ(0u, out_context_.new_session_id_); } /* @@ -1312,17 +1352,13 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_FAILURE) { TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) { AddTestDeviceConnection(); - uint32_t rpc_session_id1; - uint32_t rpc_session_id2; - uint32_t hash_id1; - uint32_t hash_id2; + SessionContext context_first, context_second; protocol_handler_test::MockProtocolHandler temp_protocol_handler; connection_handler_->set_protocol_handler(&temp_protocol_handler); - EXPECT_CALL(temp_protocol_handler, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(DoAll(SaveArg<2>(&rpc_session_id1), SaveArg<3>(&hash_id1))) - .WillOnce(DoAll(SaveArg<2>(&rpc_session_id2), SaveArg<3>(&hash_id2))); + EXPECT_CALL(temp_protocol_handler, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&context_first)) + .WillOnce(SaveArg<0>(&context_second)); // add two sessions connection_handler_->OnSessionStartedCallback( @@ -1330,12 +1366,14 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) { connection_handler_->OnSessionStartedCallback( uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); - EXPECT_NE(0u, rpc_session_id1); - EXPECT_NE(0u, rpc_session_id2); - EXPECT_EQ(SessionHash(uid_, rpc_session_id1), hash_id1); - EXPECT_EQ(SessionHash(uid_, rpc_session_id2), hash_id2); - CheckSessionExists(uid_, rpc_session_id1); - CheckSessionExists(uid_, rpc_session_id2); + EXPECT_NE(0u, context_first.new_session_id_); + EXPECT_NE(0u, context_second.new_session_id_); + EXPECT_EQ(SessionHash(uid_, context_first.new_session_id_), + context_first.hash_id_); + EXPECT_EQ(SessionHash(uid_, context_second.new_session_id_), + context_second.hash_id_); + CheckSessionExists(uid_, context_first.new_session_id_); + CheckSessionExists(uid_, context_second.new_session_id_); connection_handler_->set_protocol_handler(NULL); @@ -1347,11 +1385,17 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) { connection_handler_->set_connection_handler_observer( &mock_connection_handler_observer); uint32_t session_key1 = - connection_handler_->KeyFromPair(uid_, rpc_session_id1); + connection_handler_->KeyFromPair(uid_, context_first.new_session_id_); uint32_t session_key2 = - connection_handler_->KeyFromPair(uid_, rpc_session_id2); + connection_handler_->KeyFromPair(uid_, context_second.new_session_id_); std::vector<std::string> empty; + ChangeProtocol(uid_, + context_first.new_session_id_, + protocol_handler::PROTOCOL_VERSION_3); + ChangeProtocol(uid_, + context_second.new_session_id_, + protocol_handler::PROTOCOL_VERSION_3); EXPECT_CALL(mock_connection_handler_observer, OnServiceStartedCallback( @@ -1375,27 +1419,30 @@ TEST_F(ConnectionHandlerTest, ServiceStarted_Video_Multiple) { session_key1, true, ByRef(empty)))); + EXPECT_CALL(mock_connection_handler_observer, CheckAppIsNavi(_)) + .Times(2) + .WillRepeatedly(Return(true)); // verify that connection handler will not mix up the two results - uint32_t new_session_id1 = 0; - uint32_t new_session_id2 = 0; + SessionContext new_context_first, new_context_second; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL( - mock_protocol_handler_, - NotifySessionStartedResult(_, rpc_session_id1, _, _, false, empty)) - .WillOnce(SaveArg<2>(&new_session_id1)); - EXPECT_CALL( - mock_protocol_handler_, - NotifySessionStartedResult(_, rpc_session_id2, _, _, false, empty)) - .WillOnce(SaveArg<2>(&new_session_id2)); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, empty)) + .WillOnce(SaveArg<0>(&new_context_second)) + .WillOnce(SaveArg<0>(&new_context_first)); - connection_handler_->OnSessionStartedCallback( - uid_, rpc_session_id1, kMobileNav, PROTECTION_OFF, dummy_params); - connection_handler_->OnSessionStartedCallback( - uid_, rpc_session_id2, kMobileNav, PROTECTION_OFF, dummy_params); + connection_handler_->OnSessionStartedCallback(uid_, + context_first.new_session_id_, + kMobileNav, + PROTECTION_OFF, + dummy_params); + connection_handler_->OnSessionStartedCallback(uid_, + context_second.new_session_id_, + kMobileNav, + PROTECTION_OFF, + dummy_params); - EXPECT_NE(0u, new_session_id1); // result is positive - EXPECT_EQ(0u, new_session_id2); // result is negative + EXPECT_NE(0u, new_context_first.new_session_id_); // result is positive + EXPECT_EQ(0u, new_context_second.new_session_id_); // result is negative } TEST_F(ConnectionHandlerTest, @@ -1408,23 +1455,23 @@ TEST_F(ConnectionHandlerTest, protected_services_.push_back(kRpc); SetSpecificServices(); - uint32_t session_id_fail = 0; - uint32_t session_id = 0; + SessionContext fail_context; + SessionContext positive_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(DoAll(SaveArg<2>(&session_id_fail), SaveArg<3>(&out_hash_id_))) - .WillOnce(DoAll(SaveArg<2>(&session_id), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&fail_context)) + .WillOnce(SaveArg<0>(&positive_context)); // Start new session with RPC service connection_handler_->OnSessionStartedCallback( uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY - EXPECT_EQ(0u, session_id_fail); - EXPECT_EQ(protocol_handler::HASH_ID_WRONG, out_hash_id_); + EXPECT_EQ(0u, fail_context.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_WRONG, fail_context.hash_id_); #else - EXPECT_EQ(1u, session_id_fail); - EXPECT_EQ(SessionHash(uid_, session_id_fail), out_hash_id_); + EXPECT_EQ(1u, fail_context.new_session_id_); + EXPECT_EQ(SessionHash(uid_, fail_context.new_session_id_), + fail_context.hash_id_); #endif // ENABLE_SECURITY // Allow start kRPC without encryption @@ -1434,9 +1481,11 @@ TEST_F(ConnectionHandlerTest, // Start new session with RPC service connection_handler_->OnSessionStartedCallback( uid_, 0, kRpc, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); - EXPECT_NE(0u, session_id); - CheckService(uid_, session_id, kRpc, NULL, PROTECTION_OFF); - EXPECT_EQ(SessionHash(uid_, session_id), out_hash_id_); + EXPECT_NE(0u, positive_context.new_session_id_); + CheckService( + uid_, positive_context.new_session_id_, kRpc, NULL, PROTECTION_OFF); + EXPECT_EQ(SessionHash(uid_, positive_context.new_session_id_), + positive_context.hash_id_); } TEST_F(ConnectionHandlerTest, @@ -1450,21 +1499,20 @@ TEST_F(ConnectionHandlerTest, unprotected_services_.push_back(kControl); SetSpecificServices(); - uint32_t session_id_fail = 0; - uint32_t session_id = 0; + SessionContext fail_context; + SessionContext positive_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(SaveArg<2>(&session_id_fail)) - .WillOnce(DoAll(SaveArg<2>(&session_id), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&fail_context)) + .WillOnce(SaveArg<0>(&positive_context)); // Start new session with RPC service connection_handler_->OnSessionStartedCallback( uid_, 0, kRpc, PROTECTION_ON, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY - EXPECT_EQ(0u, session_id_fail); + EXPECT_EQ(0u, fail_context.new_session_id_); #else - EXPECT_EQ(1u, session_id_fail); + EXPECT_EQ(1u, fail_context.new_session_id_); #endif // ENABLE_SECURITY // Allow start kRPC with encryption @@ -1474,17 +1522,21 @@ TEST_F(ConnectionHandlerTest, // Start new session with RPC service connection_handler_->OnSessionStartedCallback( uid_, 0, kRpc, PROTECTION_ON, static_cast<BsonObject*>(NULL)); - EXPECT_NE(0u, session_id); - EXPECT_EQ(SessionHash(uid_, session_id), out_hash_id_); + EXPECT_NE(0u, positive_context.new_session_id_); + EXPECT_EQ(SessionHash(uid_, positive_context.new_session_id_), + positive_context.hash_id_); // Protection steal FALSE because of APPlink Protocol implementation - CheckService(uid_, session_id, kRpc, NULL, PROTECTION_OFF); + CheckService( + uid_, positive_context.new_session_id_, kRpc, NULL, PROTECTION_OFF); } TEST_F(ConnectionHandlerTest, SessionStarted_StartService_SecureSpecific_Unprotect) { AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); // Forbid start kAudio without encryption protected_services_.push_back(UnnamedService::kServedService1); @@ -1493,24 +1545,22 @@ TEST_F(ConnectionHandlerTest, protected_services_.push_back(kControl); SetSpecificServices(); - uint32_t session_id2 = 0; - uint32_t session_id3 = 0; + SessionContext context_first, context_second; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(SaveArg<2>(&session_id2)) - .WillOnce(DoAll(SaveArg<2>(&session_id3), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&context_first)) + .WillOnce(SaveArg<0>(&context_second)); // Start new session with Audio service connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY - EXPECT_EQ(0u, session_id2); + EXPECT_EQ(0u, context_first.new_session_id_); #else - EXPECT_EQ(1u, session_id2); + EXPECT_EQ(1u, context_first.new_session_id_); #endif // ENABLE_SECURITY // Allow start kAudio without encryption protected_services_.clear(); @@ -1520,18 +1570,19 @@ TEST_F(ConnectionHandlerTest, protected_services_.push_back(kControl); SetSpecificServices(); connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); // Returned original session id #ifdef ENABLE_SECURITY - EXPECT_EQ(start_session_id_, session_id3); - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); - CheckService(uid_, session_id3, kRpc, NULL, PROTECTION_OFF); + EXPECT_EQ(out_context_.new_session_id_, context_second.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, context_second.hash_id_); + CheckService( + uid_, context_second.new_session_id_, kRpc, NULL, PROTECTION_OFF); #else - EXPECT_EQ(0u, session_id3); - EXPECT_EQ(protocol_handler::HASH_ID_WRONG, out_hash_id_); + EXPECT_EQ(0u, context_second.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_WRONG, context_second.hash_id_); #endif // ENABLE_SECURITY } @@ -1539,6 +1590,8 @@ TEST_F(ConnectionHandlerTest, SessionStarted_StartService_SecureSpecific_Protect) { AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); // Forbid start kAudio with encryption unprotected_services_.push_back(UnnamedService::kServedService1); @@ -1547,101 +1600,103 @@ TEST_F(ConnectionHandlerTest, unprotected_services_.push_back(kControl); SetSpecificServices(); - uint32_t session_id_reject = 0; - uint32_t session_id3 = 0; + SessionContext rejected_context, positive_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(SaveArg<2>(&session_id_reject)) - .WillOnce(DoAll(SaveArg<2>(&session_id3), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&rejected_context)) + .WillOnce(SaveArg<0>(&positive_context)); // Start new session with Audio service connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_ON, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY - EXPECT_EQ(0u, session_id_reject); + EXPECT_EQ(0u, rejected_context.new_session_id_); #else - EXPECT_EQ(1u, session_id_reject); + EXPECT_EQ(1u, rejected_context.new_session_id_); #endif // ENABLE_SECURITY // Allow start kAudio with encryption unprotected_services_.clear(); SetSpecificServices(); connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_ON, static_cast<BsonObject*>(NULL)); // Returned original session id #ifdef ENABLE_SECURITY - EXPECT_EQ(start_session_id_, session_id3); - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); - CheckService(uid_, session_id3, kAudio, NULL, PROTECTION_ON); + EXPECT_EQ(out_context_.new_session_id_, positive_context.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, positive_context.hash_id_); + CheckService( + uid_, positive_context.new_session_id_, kAudio, NULL, PROTECTION_ON); #else - EXPECT_EQ(0u, session_id3); - EXPECT_EQ(protocol_handler::HASH_ID_WRONG, out_hash_id_); - CheckService(uid_, start_session_id_, kAudio, NULL, PROTECTION_OFF); + EXPECT_EQ(0u, positive_context.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_WRONG, positive_context.hash_id_); + CheckService( + uid_, positive_context.new_session_id_, kAudio, NULL, PROTECTION_OFF); #endif // ENABLE_SECURITY } TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtect) { AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); - uint32_t session_id_new = 0; - uint32_t session_id2 = 0; - uint32_t session_id3 = 0; + SessionContext context_new, context_second, context_third; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(DoAll(SaveArg<2>(&session_id_new), SaveArg<3>(&out_hash_id_))) - .WillOnce(DoAll(SaveArg<2>(&session_id2), SaveArg<3>(&out_hash_id_))) - .WillOnce(DoAll(SaveArg<2>(&session_id3), SaveArg<3>(&out_hash_id_))); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&context_new)) + .WillOnce(SaveArg<0>(&context_second)) + .WillOnce(SaveArg<0>(&context_third)); // Start RPC protection connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kRpc, PROTECTION_ON, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY - EXPECT_EQ(start_session_id_, session_id_new); + EXPECT_EQ(out_context_.new_session_id_, context_new.new_session_id_); // Post protection nedd no hash - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); - CheckService(uid_, start_session_id_, kRpc, NULL, PROTECTION_ON); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, context_new.hash_id_); + CheckService(uid_, context_new.new_session_id_, kRpc, NULL, PROTECTION_ON); #else - EXPECT_EQ(0u, session_id_new); + EXPECT_EQ(0u, context_new.new_session_id_); // Post protection nedd no hash - EXPECT_EQ(protocol_handler::HASH_ID_WRONG, out_hash_id_); - CheckService(uid_, start_session_id_, kRpc, NULL, PROTECTION_OFF); + EXPECT_EQ(protocol_handler::HASH_ID_WRONG, context_new.hash_id_); + CheckService(uid_, context_new.new_session_id_, kRpc, NULL, PROTECTION_OFF); #endif // ENABLE_SECURITY // Start Audio session without protection connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_OFF, static_cast<BsonObject*>(NULL)); - EXPECT_EQ(start_session_id_, session_id2); - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); - CheckService(uid_, start_session_id_, kAudio, NULL, PROTECTION_OFF); + EXPECT_EQ(out_context_.new_session_id_, context_second.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, context_second.hash_id_); + CheckService( + uid_, context_second.new_session_id_, kAudio, NULL, PROTECTION_OFF); // Start Audio protection connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_ON, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY - EXPECT_EQ(start_session_id_, session_id3); - EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, out_hash_id_); - CheckService(uid_, start_session_id_, kAudio, NULL, PROTECTION_ON); + EXPECT_EQ(out_context_.new_session_id_, context_third.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_NOT_SUPPORTED, context_third.hash_id_); + CheckService( + uid_, context_third.new_session_id_, kAudio, NULL, PROTECTION_ON); #else - EXPECT_EQ(0u, session_id3); - EXPECT_EQ(protocol_handler::HASH_ID_WRONG, out_hash_id_); - CheckService(uid_, start_session_id_, kAudio, NULL, PROTECTION_OFF); + EXPECT_EQ(0u, context_third.new_session_id_); + EXPECT_EQ(protocol_handler::HASH_ID_WRONG, context_third.hash_id_); + CheckService( + uid_, context_third.new_session_id_, kAudio, NULL, PROTECTION_OFF); #endif // ENABLE_SECURITY } @@ -1649,22 +1704,21 @@ TEST_F(ConnectionHandlerTest, SessionStarted_DealyProtectBulk) { AddTestDeviceConnection(); AddTestSession(); - uint32_t session_id_new = 0; + SessionContext new_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(SaveArg<2>(&session_id_new)); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&new_context)); connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kBulk, PROTECTION_ON, static_cast<BsonObject*>(NULL)); #ifdef ENABLE_SECURITY - EXPECT_EQ(start_session_id_, session_id_new); - CheckService(uid_, start_session_id_, kRpc, NULL, PROTECTION_ON); + EXPECT_EQ(out_context_.new_session_id_, new_context.new_session_id_); + CheckService(uid_, new_context.new_session_id_, kRpc, NULL, PROTECTION_ON); #else - EXPECT_EQ(0u, session_id_new); - CheckService(uid_, start_session_id_, kRpc, NULL, PROTECTION_OFF); + EXPECT_EQ(0u, new_context.new_session_id_); + CheckService(uid_, new_context.new_session_id_, kRpc, NULL, PROTECTION_OFF); #endif // ENABLE_SECURITY } @@ -1743,6 +1797,9 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByProtectedService) { testing::StrictMock<security_manager_test::MockSSLContext> mock_ssl_context; AddTestDeviceConnection(); AddTestSession(); + ChangeProtocol( + uid_, out_context_.new_session_id_, protocol_handler::PROTOCOL_VERSION_3); + EXPECT_EQ( connection_handler_->SetSSLContext(connection_key_, &mock_ssl_context), ::security_manager::SecurityManager::ERROR_SUCCESS); @@ -1754,20 +1811,23 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByProtectedService) { EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kAudio), reinterpret_cast<security_manager::SSLContext*>(NULL)); - uint32_t session_id = 0; + SessionContext new_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(SaveArg<2>(&session_id)); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&new_context)); // Open kAudio service connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kAudio, PROTECTION_ON, static_cast<BsonObject*>(NULL)); - EXPECT_EQ(session_id, start_session_id_); - CheckService(uid_, session_id, kAudio, &mock_ssl_context, PROTECTION_ON); + EXPECT_EQ(new_context.new_session_id_, out_context_.new_session_id_); + CheckService(uid_, + new_context.new_session_id_, + kAudio, + &mock_ssl_context, + PROTECTION_ON); // kAudio is not exists yet EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kAudio), @@ -1788,20 +1848,23 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedRPC) { EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kRpc), reinterpret_cast<security_manager::SSLContext*>(NULL)); - uint32_t session_id = 0; + SessionContext new_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(SaveArg<2>(&session_id)); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&new_context)); // Protect kRpc (Bulk will be protect also) connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kRpc, PROTECTION_ON, static_cast<BsonObject*>(NULL)); - EXPECT_EQ(start_session_id_, session_id); - CheckService(uid_, session_id, kRpc, &mock_ssl_context, PROTECTION_ON); + EXPECT_EQ(out_context_.new_session_id_, new_context.new_session_id_); + CheckService(uid_, + new_context.new_session_id_, + kRpc, + &mock_ssl_context, + PROTECTION_ON); // kRpc is protected EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kRpc), @@ -1825,20 +1888,23 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedBulk) { EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kRpc), reinterpret_cast<security_manager::SSLContext*>(NULL)); - uint32_t session_id = 0; + SessionContext new_context; connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, - NotifySessionStartedResult(_, _, _, _, _, _)) - .WillOnce(SaveArg<2>(&session_id)); + EXPECT_CALL(mock_protocol_handler_, NotifySessionStarted(_, _)) + .WillOnce(SaveArg<0>(&new_context)); // Protect Bulk (kRpc will be protected also) connection_handler_->OnSessionStartedCallback(uid_, - start_session_id_, + out_context_.new_session_id_, kBulk, PROTECTION_ON, static_cast<BsonObject*>(NULL)); - EXPECT_EQ(start_session_id_, session_id); - CheckService(uid_, session_id, kRpc, &mock_ssl_context, PROTECTION_ON); + EXPECT_EQ(out_context_.new_session_id_, new_context.new_session_id_); + CheckService(uid_, + new_context.new_session_id_, + kRpc, + &mock_ssl_context, + PROTECTION_ON); // kRpc is protected EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kRpc), @@ -1854,8 +1920,9 @@ TEST_F(ConnectionHandlerTest, SendHeartBeat) { AddTestDeviceConnection(); AddTestSession(); connection_handler_->set_protocol_handler(&mock_protocol_handler_); - EXPECT_CALL(mock_protocol_handler_, SendHeartBeat(uid_, start_session_id_)); - connection_handler_->SendHeartBeat(uid_, start_session_id_); + EXPECT_CALL(mock_protocol_handler_, + SendHeartBeat(uid_, out_context_.new_session_id_)); + connection_handler_->SendHeartBeat(uid_, out_context_.new_session_id_); } TEST_F(ConnectionHandlerTest, RunAppOnDevice_NoAppOnDevice_UNSUCCESS) { @@ -1892,6 +1959,41 @@ TEST_F(ConnectionHandlerTest, RunAppOnDevice_AppOnDevice_SUCCESS) { connection_handler_->RunAppOnDevice(hash_of_mac_address, bundle_id); } +TEST_F(ConnectionHandlerTest, OnDeviceConnectionSwitching) { + connection_handler_test::MockConnectionHandlerObserver + mock_connection_handler_observer; + connection_handler_->set_connection_handler_observer( + &mock_connection_handler_observer); + + const transport_manager::DeviceInfo device_info_1( + device_handle_, mac_address_, device_name_, connection_type_); + + connection_handler_->OnDeviceAdded(device_info_1); + + const auto second_mac_address = "second_mac_address"; + const transport_manager::DeviceInfo device_info_2(device_handle_ + 1, + second_mac_address, + "second_device_name", + "second_connection_type"); + + connection_handler_->OnDeviceAdded(device_info_2); + + connection_handler::Device d1(device_info_1.device_handle(), + device_info_1.name(), + device_info_1.mac_address(), + device_info_1.connection_type()); + + connection_handler::Device d2(device_info_2.device_handle(), + device_info_2.name(), + device_info_2.mac_address(), + device_info_2.connection_type()); + + EXPECT_CALL(mock_connection_handler_observer, + OnDeviceSwitchingStart(SameDevice(d1), SameDevice(d2))); + + connection_handler_->OnDeviceSwitchingStart(mac_address_, second_mac_address); +} + } // namespace connection_handler_test } // namespace components } // namespace test diff --git a/src/components/connection_handler/test/connection_test.cc b/src/components/connection_handler/test/connection_test.cc index 4582cc10ee..5fd6b40e0e 100644 --- a/src/components/connection_handler/test/connection_test.cc +++ b/src/components/connection_handler/test/connection_test.cc @@ -71,6 +71,11 @@ class ConnectionTest : public ::testing::Test { delete connection_handler_; } void StartSession() { + StartDefaultSession(); + connection_->UpdateProtocolVersionSession( + session_id, protocol_handler::PROTOCOL_VERSION_3); + } + void StartDefaultSession() { session_id = connection_->AddNewSession(); EXPECT_NE(session_id, 0u); const SessionMap sessionMap = connection_->session_map(); @@ -142,13 +147,13 @@ TEST_F(ConnectionTest, Session_TryGetProtocolVersionWithoutSession) { } TEST_F(ConnectionTest, Session_GetDefaultProtocolVersion) { - StartSession(); + StartDefaultSession(); uint8_t protocol_version; EXPECT_TRUE(connection_->ProtocolVersion(session_id, protocol_version)); EXPECT_EQ(static_cast<uint8_t>(PROTOCOL_VERSION_2), protocol_version); } TEST_F(ConnectionTest, Session_UpdateProtocolVersion) { - StartSession(); + StartDefaultSession(); uint8_t protocol_version = static_cast<uint8_t>(PROTOCOL_VERSION_3); connection_->UpdateProtocolVersionSession(session_id, protocol_version); EXPECT_TRUE(connection_->ProtocolVersion(session_id, protocol_version)); @@ -157,7 +162,7 @@ TEST_F(ConnectionTest, Session_UpdateProtocolVersion) { TEST_F(ConnectionTest, HeartBeat_NotSupported) { // Arrange - StartSession(); + StartDefaultSession(); uint8_t protocol_version; EXPECT_TRUE(connection_->ProtocolVersion(session_id, protocol_version)); EXPECT_EQ(static_cast<uint8_t>(PROTOCOL_VERSION_2), protocol_version); diff --git a/src/components/formatters/test/CSmartFactory_test.cc b/src/components/formatters/test/CSmartFactory_test.cc index f98af88328..3713d076e2 100644 --- a/src/components/formatters/test/CSmartFactory_test.cc +++ b/src/components/formatters/test/CSmartFactory_test.cc @@ -67,7 +67,9 @@ TEST(CSmartFactoryTest, obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -79,7 +81,9 @@ TEST(CSmartFactoryTest, FunctionIdTest::Function1, MessageTypeTest::INVALID_ENUM); EXPECT_FALSE(SmartType::SmartType_Map == obj.getType()); EXPECT_TRUE(SmartType::SmartType_Null == obj.getType()); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -99,7 +103,9 @@ TEST( obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -120,7 +126,9 @@ TEST( obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::OUT_OF_RANGE, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OUT_OF_RANGE, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -141,7 +149,9 @@ TEST( obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -163,7 +173,9 @@ TEST(CSmartFactoryTest, obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -185,7 +197,9 @@ TEST( obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -221,7 +235,9 @@ TEST( obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -236,7 +252,9 @@ TEST(CSmartFactoryTest, obj["position"] = 200; std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -251,7 +269,9 @@ TEST( obj["text"] = "test"; std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(1u, keys.size()); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -266,7 +286,9 @@ TEST(CSmartFactoryTest, obj["position"] = 200; std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -281,10 +303,14 @@ TEST(CSmartFactoryTest, obj["position"] = 200; obj["image"]["text"] = "test2"; obj["image"]["position"] = 100; - EXPECT_EQ(Errors::eType::OK, obj["image"].validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(3u, keys.size()); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -301,11 +327,15 @@ TEST( obj["image"]["text"] = "test2"; obj["image"]["position"] = 100; // Check object "image" - EXPECT_EQ(Errors::eType::OK, obj["image"].validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(3u, keys.size()); // Check global object - EXPECT_EQ(Errors::eType::OK, obj.validate()); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -321,11 +351,15 @@ TEST( obj["image"]["text"] = "test2"; obj["image"]["position"] = 100; // Check object "image" - EXPECT_EQ(Errors::eType::OK, obj["image"].validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); // Check global object - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate()); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -342,11 +376,15 @@ TEST( obj["image"]["text"] = "test2"; obj["image"]["position"] = 100; // Check object "image" - EXPECT_EQ(Errors::eType::OK, obj["image"].validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj["image"].validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(3u, keys.size()); // Check global object - EXPECT_EQ(Errors::eType::OK, obj.validate()); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_TRUE(obj.isValid()); } @@ -363,7 +401,9 @@ TEST( std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(2u, keys.size()); // Check global object - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } @@ -381,7 +421,9 @@ TEST( std::set<std::string> keys = obj.enumerate(); EXPECT_EQ(3u, keys.size()); // Check global object - EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::INVALID_VALUE, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_FALSE(obj.isValid()); } diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc index 91701c8aab..a4d40b4478 100644 --- a/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc +++ b/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc @@ -42,7 +42,9 @@ namespace formatters { TEST(CFormatterJsonSDLRPCv1Test, EmptySmartObjectToString) { SmartObject srcObj; - EXPECT_EQ(Errors::eType::OK, srcObj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; bool result = CFormatterJsonSDLRPCv1::toString(srcObj, jsonString); @@ -71,7 +73,10 @@ TEST(CFormatterJsonSDLRPCv1Test, SmObjWithRequestWithoutMsgNotValid_ToString) { srcObj[S_PARAMS][S_PROTOCOL_TYPE] = 0; srcObj[S_PARAMS][S_PROTOCOL_VERSION] = 1; - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, srcObj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, + srcObj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; bool result = CFormatterJsonSDLRPCv1::toString(srcObj, jsonString); @@ -102,7 +107,9 @@ TEST(CFormatterJsonSDLRPCv1Test, srcObj[S_PARAMS][S_PROTOCOL_VERSION] = 1; srcObj[S_MSG_PARAMS][""] = ""; - EXPECT_EQ(Errors::eType::OK, srcObj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; @@ -333,7 +340,9 @@ TEST(CFormatterJsonSDLRPCv1Test, StringRequestToSmObj) { inputJsonString, obj); EXPECT_EQ(CFormatterJsonSDLRPCv1::kSuccess, result); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface); EXPECT_EQ(obj[S_PARAMS][S_CORRELATION_ID], 5); @@ -477,7 +486,9 @@ TEST(CFormatterJsonSDLRPCv1Test, StringNotificationToSmartObject) { MessageTypeTest::eType>( inputJsonString, obj); EXPECT_EQ(CFormatterJsonSDLRPCv1::kSuccess, result); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::notification); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::SetGlobalProperties); EXPECT_EQ(obj[S_PARAMS][S_CORRELATION_ID], 13); diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc index feb7dd3129..c7e6f61674 100644 --- a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc +++ b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc @@ -41,7 +41,9 @@ namespace formatters { TEST(CFormatterJsonSDLRPCv2Test, EmptySmartObjectToString) { SmartObject srcObj; - EXPECT_EQ(Errors::eType::OK, srcObj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; bool result = CFormatterJsonSDLRPCv2::toString(srcObj, jsonString); @@ -64,7 +66,10 @@ TEST(CFormatterJsonSDLRPCv2Test, SmObjWithRequestWithoutMsgNotValid_ToString) { srcObj[S_PARAMS][S_PROTOCOL_TYPE] = 0; srcObj[S_PARAMS][S_PROTOCOL_VERSION] = 2; - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, srcObj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, + srcObj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; bool result = CFormatterJsonSDLRPCv2::toString(srcObj, jsonString); @@ -88,7 +93,9 @@ TEST(CFormatterJsonSDLRPCv2Test, srcObj[S_PARAMS][S_PROTOCOL_VERSION] = 2; srcObj[S_MSG_PARAMS][""] = ""; - EXPECT_EQ(Errors::eType::OK, srcObj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, srcObj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string jsonString; @@ -262,7 +269,9 @@ TEST(CFormatterJsonSDLRPCv2Test, StringRequestWithoutCorIdToSmObj) { MessageTypeTest::request); EXPECT_EQ(true, result); - EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::MISSING_MANDATORY_PARAMETER, obj.validate(&report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface); EXPECT_EQ(obj[S_PARAMS][S_PROTOCOL_TYPE], 0); @@ -307,7 +316,9 @@ TEST(CFormatterJsonSDLRPCv2Test, StringRequestWithCorIdToSmObj) { corId); EXPECT_EQ(true, result); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::request); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::RegisterAppInterface); EXPECT_EQ(obj[S_PARAMS][S_CORRELATION_ID], corId); @@ -372,7 +383,9 @@ TEST(CFormatterJsonSDLRPCv2Test, StringNotificationToSmartObject) { MessageTypeTest::notification, corId); EXPECT_EQ(true, result); - EXPECT_EQ(Errors::eType::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::eType::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); EXPECT_EQ(obj[S_PARAMS][S_MESSAGE_TYPE], MessageTypeTest::notification); EXPECT_EQ(obj[S_PARAMS][S_FUNCTION_ID], FunctionIDTest::SetGlobalProperties); EXPECT_EQ(obj[S_PARAMS][S_CORRELATION_ID], corId); diff --git a/src/components/formatters/test/formatter_json_rpc_test.cc b/src/components/formatters/test/formatter_json_rpc_test.cc index fa368924c9..e882bed618 100644 --- a/src/components/formatters/test/formatter_json_rpc_test.cc +++ b/src/components/formatters/test/formatter_json_rpc_test.cc @@ -149,7 +149,9 @@ TEST(FormatterJsonRPCTest, UpperBoundValuesInSystemRequest_ToString_Success) { hmi_apis::HMI_API factory; EXPECT_TRUE(factory.attachSchema(obj, false)); - EXPECT_EQ(Errors::OK, obj.validate()); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::OK, obj.validate(&report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); std::string result; // Convert SmartObject to Json string EXPECT_TRUE(FormatterJsonRpc::ToString(obj, result)); diff --git a/src/components/functional_module/test/include/mock_application.h b/src/components/functional_module/test/include/mock_application.h index e73851094e..95bd4a0505 100644 --- a/src/components/functional_module/test/include/mock_application.h +++ b/src/components/functional_module/test/include/mock_application.h @@ -115,6 +115,7 @@ class MockApplication : public Application { bool(mobile_apis::FunctionID::eType cmd_id, TLimitSource source)); MOCK_METHOD0(usage_report, UsageStatistics&()); + MOCK_METHOD1(SetInitialState, void(HmiStatePtr state)); MOCK_METHOD2(SubscribeToSoftButtons, void(int32_t cmd_id, const SoftButtonID& softbuttons_id)); MOCK_METHOD1(IsSubscribedToSoftButton, bool(const uint32_t softbutton_id)); @@ -132,7 +133,8 @@ class MockApplication : public Application { MOCK_CONST_METHOD0(tbt_show_command, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(SubscribedButtons, const std::set<mobile_apis::ButtonName::eType>&()); - MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&()); + MOCK_CONST_METHOD0(SubscribesIVI, + const application_manager::VehicleInfoSubscriptions&()); MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*()); diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc index abefbe3e24..ff5a6d687e 100644 --- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc +++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc @@ -108,6 +108,7 @@ void MessageBrokerAdapter::SubscribeTo() { MessageBrokerController::subscribeTo("BasicCommunication.OnUpdateDeviceList"); MessageBrokerController::subscribeTo("BasicCommunication.OnFindApplications"); MessageBrokerController::subscribeTo("BasicCommunication.OnAppActivated"); + MessageBrokerController::subscribeTo("BasicCommunication.OnAwakeSDL"); MessageBrokerController::subscribeTo("BasicCommunication.OnExitApplication"); MessageBrokerController::subscribeTo( "BasicCommunication.OnExitAllApplications"); diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index c1a37a24f1..96803e69a8 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -36,7 +36,6 @@ #include <string> #include <vector> #include <set> -#include "application_manager/vehicle_info_data.h" #include "application_manager/application.h" #include "application_manager/hmi_capabilities.h" #include "application_manager/commands/command.h" @@ -255,6 +254,7 @@ class ApplicationManager { 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 @@ -263,18 +263,40 @@ class ApplicationManager { 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 */ @@ -314,6 +336,17 @@ class ApplicationManager { 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; /** @@ -335,6 +368,13 @@ class ApplicationManager { */ 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; @@ -374,8 +414,8 @@ class ApplicationManager { * @param vehicle_info Enum value of type of vehicle data * @param new value (for integer values currently) of vehicle data */ - virtual AppSharedPtrs IviInfoUpdated(VehicleDataType vehicle_info, - int value) = 0; + 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; @@ -535,6 +575,15 @@ class ApplicationManager { 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; /** @@ -595,7 +644,22 @@ class ApplicationManager { /** * @brief CreateRegularState create regular HMI state for application - * @param app_id + * @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 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 d7e9f1cea7..f0859ece38 100644 --- a/src/components/include/application_manager/policies/policy_handler_interface.h +++ b/src/components/include/application_manager/policies/policy_handler_interface.h @@ -427,6 +427,15 @@ 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 diff --git a/src/components/include/connection_handler/connection_handler.h b/src/components/include/connection_handler/connection_handler.h index c70861b5f6..1fcf5e4477 100644 --- a/src/components/include/connection_handler/connection_handler.h +++ b/src/components/include/connection_handler/connection_handler.h @@ -39,6 +39,7 @@ #include "connection_handler/device.h" #include "connection_handler/connection.h" #include "connection_handler/devices_discovery_starter.h" +#include "utils/macro.h" /** * \namespace connection_handler @@ -175,10 +176,27 @@ class ConnectionHandler { * \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, - uint32_t* device_id) const = 0; + 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. diff --git a/src/components/include/connection_handler/connection_handler_observer.h b/src/components/include/connection_handler/connection_handler_observer.h index 6bfc78af24..1bd919f30e 100644 --- a/src/components/include/connection_handler/connection_handler_observer.h +++ b/src/components/include/connection_handler/connection_handler_observer.h @@ -33,6 +33,7 @@ #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" @@ -123,9 +124,38 @@ class ConnectionHandlerObserver { 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: /** diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h index adf195e3a9..24905671fa 100644 --- a/src/components/include/policy/policy_external/policy/policy_manager.h +++ b/src/components/include/policy/policy_external/policy/policy_manager.h @@ -483,6 +483,9 @@ class PolicyManager : public usage_statistics::StatisticsManager { */ 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 diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h index 510e35e699..3e90cfc094 100644 --- a/src/components/include/policy/policy_regular/policy/policy_manager.h +++ b/src/components/include/policy/policy_regular/policy/policy_manager.h @@ -487,6 +487,9 @@ class PolicyManager : public usage_statistics::StatisticsManager { */ 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. diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h index 34135617bd..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 @@ -121,7 +123,7 @@ class ProtocolHandler { * Only valid when generated_session_id is 0. Note, even if * generated_session_id is 0, the list may be empty. */ - virtual void NotifySessionStartedResult( + DEPRECATED virtual void NotifySessionStartedResult( int32_t connection_id, uint8_t session_id, uint8_t generated_session_id, @@ -129,6 +131,18 @@ class ProtocolHandler { 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 362f49e140..e1107cb2a9 100644 --- a/src/components/include/protocol_handler/protocol_handler_settings.h +++ b/src/components/include/protocol_handler/protocol_handler_settings.h @@ -34,8 +34,11 @@ class ProtocolHandlerSettings { */ virtual uint16_t max_supported_protocol_version() const = 0; - // DEPRECATED - virtual bool enable_protocol_4() 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 e58d959c8c..ccf000a18d 100644 --- a/src/components/include/protocol_handler/session_observer.h +++ b/src/components/include/protocol_handler/session_observer.h @@ -36,6 +36,7 @@ #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 @@ -55,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. @@ -75,9 +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 */ - // 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, @@ -87,7 +142,7 @@ class SessionObserver { /** * \brief Callback function used by ProtocolHandler * when Mobile Application initiates start of new session. - * Result must be notified through NotifySessionStartedResult(). + * 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 @@ -103,8 +158,19 @@ class SessionObserver { const bool is_protected, const BsonObject* params) = 0; - // DEPRECATED - virtual uint32_t OnSessionEndedCallback( + /** + * \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. + * 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 + */ + DEPRECATED virtual uint32_t OnSessionEndedCallback( const transport_manager::ConnectionUID connection_handle, const uint8_t sessionId, const uint32_t& hashCode, @@ -116,7 +182,7 @@ class SessionObserver { * \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. + * 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 @@ -165,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 @@ -178,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 @@ -246,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/rpc_base/include/rpc_base/validation_report.h b/src/components/include/rpc_base/validation_report.h index 4397112d54..82f265e594 100644 --- a/src/components/rpc_base/include/rpc_base/validation_report.h +++ b/src/components/include/rpc_base/validation_report.h @@ -68,14 +68,17 @@ inline void PrettyFormat(const ValidationReport& report, 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()); - result->append("\n"); } - const ValidationReports& subreports = report.subobject_reports(); for (ValidationReports::const_iterator i = subreports.begin(), end = subreports.end(); i != end; 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/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index e94d9b4b3a..4f2d964488 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -43,7 +43,6 @@ #include "application_manager/application_manager_settings.h" #include "application_manager/commands/command.h" #include "application_manager/hmi_capabilities.h" -#include "application_manager/vehicle_info_data.h" #include "application_manager/state_controller.h" #include "application_manager/message.h" #include "resumption/last_state.h" @@ -152,6 +151,8 @@ class MockApplicationManager : public application_manager::ApplicationManager { 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&()); @@ -167,7 +168,7 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_CONST_METHOD0(IsHMICooperating, bool()); MOCK_METHOD2(IviInfoUpdated, std::vector<application_manager::ApplicationSharedPtr>( - application_manager::VehicleDataType vehicle_info, + mobile_apis::VehicleDataType::eType vehicle_info, int value)); MOCK_METHOD1(RegisterApplication, application_manager::ApplicationSharedPtr(const utils::SharedPtr< @@ -245,10 +246,18 @@ class MockApplicationManager : public application_manager::ApplicationManager { bool state)); MOCK_CONST_METHOD4(CreateRegularState, application_manager::HmiStatePtr( - uint32_t app_id, + 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, @@ -260,9 +269,16 @@ class MockApplicationManager : public application_manager::ApplicationManager { MOCK_METHOD0(event_dispatcher, application_manager::event_engine::EventDispatcher&()); - MOCK_CONST_METHOD1(IsAppSubscribedForWayPoints, bool(const uint32_t)); - MOCK_METHOD1(SubscribeAppForWayPoints, void(const uint32_t)); - MOCK_METHOD1(UnsubscribeAppFromWayPoints, void(const uint32_t)); + 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( @@ -272,9 +288,9 @@ class MockApplicationManager : public application_manager::ApplicationManager { AppsWaitingForRegistration, DataAccessor<application_manager::AppsWaitRegistrationSet>()); - MOCK_METHOD1(ReplaceMobileByHMIAppId, + MOCK_METHOD1(ReplaceMobileWithHMIAppId, void(smart_objects::SmartObject& message)); - MOCK_METHOD1(ReplaceHMIByMobileAppId, + MOCK_METHOD1(ReplaceHMIWithMobileAppId, void(smart_objects::SmartObject& message)); MOCK_METHOD1(GetAvailableSpaceForApp, uint32_t(const std::string& folder_name)); @@ -289,6 +305,11 @@ class MockApplicationManager : public application_manager::ApplicationManager { 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 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 812df19ccd..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 @@ -255,6 +255,9 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface { 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: 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 5cb5f471b5..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, 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 index dead5bc61e..f1c605eaca 100644 --- a/src/components/include/test/connection_handler/mock_connection_handler_observer.h +++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h @@ -48,11 +48,11 @@ class MockConnectionHandlerObserver 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)); + 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, @@ -66,6 +66,12 @@ class MockConnectionHandlerObserver 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 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 index e90fa63075..5aa92446b6 100644 --- 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 @@ -247,6 +247,9 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface { 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 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 index 6227e7e85c..9e487da4ba 100644 --- 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 @@ -215,6 +215,9 @@ class MockPolicyManager : public PolicyManager { 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 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 index 39876cf713..ed3a5088c1 100644 --- 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 @@ -211,6 +211,9 @@ class MockCacheManagerInterface : public CacheManagerInterface { 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 diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h index cfe41ee64c..82012b83c7 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h @@ -222,6 +222,10 @@ class MockPolicyManager : public PolicyManager { 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 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 37fbbb9742..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,12 +62,15 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler { MOCK_CONST_METHOD0(get_settings, const ::protocol_handler::ProtocolHandlerSettings&()); MOCK_METHOD0(get_session_observer, protocol_handler::SessionObserver&()); - MOCK_METHOD6(NotifySessionStartedResult, - void(int32_t connection_id, - uint8_t session_id, - uint8_t generated_session_id, - uint32_t hash_id, - bool protection, + 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 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 4d2072624d..3d54b97fad 100644 --- a/src/components/include/test/protocol_handler/mock_session_observer.h +++ b/src/components/include/test/protocol_handler/mock_session_observer.h @@ -46,8 +46,7 @@ namespace protocol_handler_test { */ class MockSessionObserver : public ::protocol_handler::SessionObserver { public: - // DEPRECATED - MOCK_METHOD5( + DEPRECATED MOCK_METHOD5( OnSessionStartedCallback, uint32_t(const transport_manager::ConnectionUID connection_handle, const uint8_t sessionId, @@ -88,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)); @@ -113,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)); 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/transport_manager/mock_transport_manager_listener.h b/src/components/include/test/transport_manager/mock_transport_manager_listener.h index dfa2cbc31d..f4c4fdcf68 100644 --- a/src/components/include/test/transport_manager/mock_transport_manager_listener.h +++ b/src/components/include/test/transport_manager/mock_transport_manager_listener.h @@ -81,6 +81,10 @@ class MockTransportManagerListener : public TransportManagerListener { 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 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 00da2025dd..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 @@ -59,6 +59,8 @@ 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 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 index 16e6ddcb7a..c37c41d4f8 100644 --- 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 @@ -96,6 +96,13 @@ class MockTransportAdapter 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*()); diff --git a/src/components/include/test/utils/test_async_waiter.h b/src/components/include/test/utils/test_async_waiter.h index 2d53d5d7c8..fee7672e93 100644 --- a/src/components/include/test/utils/test_async_waiter.h +++ b/src/components/include/test/utils/test_async_waiter.h @@ -30,7 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#pragma once +#ifndef SRC_COMPONENTS_INCLUDE_TEST_UTILS_TEST_ASYNC_WAITER_H_ +#define SRC_COMPONENTS_INCLUDE_TEST_UTILS_TEST_ASYNC_WAITER_H_ #include <stdint.h> @@ -102,3 +103,4 @@ ACTION_P(NotifyTestAsyncWaiter, test_async_waiter) { } } // 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/macro.h b/src/components/include/utils/macro.h index 4cf76fe022..e6f3b6b3ca 100644 --- a/src/components/include/utils/macro.h +++ b/src/components/include/utils/macro.h @@ -145,4 +145,22 @@ #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/interfaces/QT_HMI_API.xml b/src/components/interfaces/QT_HMI_API.xml index 0e5d765964..0c86d4eea3 100644 --- a/src/components/interfaces/QT_HMI_API.xml +++ b/src/components/interfaces/QT_HMI_API.xml @@ -1,5 +1,5 @@ <!-- -* Copyright (c) 2013, Ford Motor Company + * Copyright (c) 2013, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,13 @@ * 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. --><interfaces name="SmartDeviceLink HMI API"> + * POSSIBILITY OF SUCH DAMAGE. --> + +<!-- + * DEPRECATED, use HMI_API instead. This API is used with the DBus adapter, + * which will be removed or refactored to use HMI_API in the next major release +--> +<interfaces name="SmartDeviceLink HMI API"> <interface name="Common" version="1.1" date="2013-10-02"> <enum name="Result"> <element name="SUCCESS" value="0"/> diff --git a/src/components/policy/policy_external/.gitignore b/src/components/policy/policy_external/.gitignore index 3e5fc41721..d67909069a 100644 --- a/src/components/policy/policy_external/.gitignore +++ b/src/components/policy/policy_external/.gitignore @@ -54,11 +54,8 @@ test/components/utils/test_Utils test/test_suit # libraries -src/components/qt_hmi/qml_plugins/dbus/libhmi_dbus.so -src/components/qt_hmi/qml_plugins/hmi_framework/libHmiFramework.so # install folders -src/components/qt_hmi/qml_model/com/ford/sdl # ctags-generated tags @@ -70,9 +67,6 @@ moc_*.cpp *_automoc.cpp # generated files -src/components/qt_hmi/qml_plugins/dbus_adapter/qml_dbus.cc -src/components/qt_hmi/qml_plugins/dbus_adapter/qml_dbus.h -src/components/qt_hmi/qml_model/hmi_api/*Proxy.qml # Mac OS Specific .DS_Store diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h index 428a9bd2f6..ef93ec72ab 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager.h +++ b/src/components/policy/policy_external/include/policy/cache_manager.h @@ -701,6 +701,15 @@ class CacheManager : public CacheManagerInterface { const PolicySettings& get_settings() const; + /** + * @brief OnDeviceSwitching Processes existing policy permissions for devices + * switching transport + * @param device_id_from Device ID original + * @param device_id_to Device ID new + */ + void OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) OVERRIDE; + private: std::string currentDateTime(); struct AppHMITypeToString { @@ -731,6 +740,13 @@ class CacheManager : public CacheManagerInterface { */ void ResetCalculatedPermissionsForDevice(const std::string& device_id); + /** + * @brief Transform to lower case all non default application names in + * applications policies section + * @param pt polict rable for update + */ + void MakeLowerCaseAppNames(policy_table::Table& pt) const; + void AddCalculatedPermissions(const std::string& device_id, const std::string& policy_app_id, const policy::Permissions& permissions); diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h index ae1f8922ba..b9e9f73646 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h @@ -778,6 +778,15 @@ class CacheManagerInterface { virtual void SetExternalConsentForApp( const PermissionConsent& permissions) = 0; + /** + * @brief OnDeviceSwitching Processes existing policy permissions for devices + * switching transport + * @param device_id_from Device ID original + * @param device_id_to Device ID new + */ + virtual void OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) = 0; + #ifdef BUILD_TESTS /** * @brief GetPT allows to obtain SharedPtr to PT. diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index 80ceb06e7e..97a2e60055 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -559,6 +559,9 @@ class PolicyManagerImpl : public PolicyManager { */ void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE; + void OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) OVERRIDE; + /** * @brief Gets meta information * @return meta information diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 3a3f3d06a9..a9b599f981 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -2249,6 +2249,27 @@ void CacheManager::FillDeviceSpecificData() { } } +void CacheManager::MakeLowerCaseAppNames(policy_table::Table& pt) const { + policy_table::ApplicationPolicies& apps = + pt.policy_table.app_policies_section.apps; + for (policy_table::ApplicationPolicies::iterator iter = apps.begin(); + iter != apps.end();) { + std::string key = iter->first; + if (key == kDefaultId || key == kPreDataConsentId || key == kDeviceId) { + ++iter; + continue; + } + + std::transform(key.begin(), key.end(), key.begin(), ::tolower); + if (key.compare(iter->first) != 0) { + std::swap(apps[key], iter->second); + iter = apps.erase(iter); + } else { + ++iter; + } + } +} + bool CacheManager::LoadFromBackup() { sync_primitives::AutoLock lock(cache_lock_); pt_ = backup_->GenerateSnapshot(); @@ -2291,6 +2312,8 @@ bool CacheManager::LoadFromFile(const std::string& file_name, "Policy table content loaded:" << s_writer.write(table.ToJsonValue())); #endif // ENABLE_LOG + MakeLowerCaseAppNames(table); + if (!table.is_valid()) { rpc::ValidationReport report("policy_table"); table.ReportErrors(&report); @@ -2606,6 +2629,31 @@ const PolicySettings& CacheManager::get_settings() const { return *settings_; } +void CacheManager::OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock auto_lock(cache_lock_); + auto device_data = *(pt_->policy_table.device_data); + + auto from = pt_->policy_table.device_data->find(device_id_from); + DCHECK_OR_RETURN_VOID(from != device_data.end()); + + auto to = pt_->policy_table.device_data->find(device_id_to); + DCHECK_OR_RETURN_VOID(to != device_data.end()); + + auto& consents_from = *(from->second.user_consent_records); + auto& consents_to = *(to->second.user_consent_records); + + LOG4CXX_DEBUG(logger_, + "Merging user consents from device: " + << device_id_from << " to device: " << device_id_to); + for (auto f = consents_from.begin(); f != consents_from.end(); ++f) { + const auto app_id = f->first; + LOG4CXX_DEBUG(logger_, "Updating permissions for key: " << app_id); + consents_to[app_id] = f->second; + } +} + CacheManager::BackgroundBackuper::BackgroundBackuper( CacheManager* cache_manager) : cache_manager_(cache_manager) diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index d50779383a..806b7e13ba 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -1681,6 +1681,12 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile( SendNotificationOnPermissionsUpdated(application_id); } +void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) { + LOG4CXX_AUTO_TRACE(logger_); + cache_->OnDeviceSwitching(device_id_from, device_id_to); +} + const MetaInfo PolicyManagerImpl::GetMetaInfo() const { LOG4CXX_AUTO_TRACE(logger_); return cache_->GetMetaInfo(); diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc index e3e1029692..4afce16885 100644 --- a/src/components/policy/policy_external/src/sql_pt_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_queries.cc @@ -137,7 +137,7 @@ const std::string kCreateSchema = "CREATE INDEX `rpc.select_rpc_name_hmi_level` " " ON `rpc`(`name`,`hmi_level_value`);" "CREATE TABLE IF NOT EXISTS `application`( " - " `id` VARCHAR(45) PRIMARY KEY NOT NULL, " + " `id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, " " `keep_context` BOOLEAN, " " `steal_focus` BOOLEAN, " " `default_hmi` VARCHAR(45), " @@ -160,7 +160,7 @@ const std::string kCreateSchema = "CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` " " ON `application`(`priority_value`); " "CREATE TABLE IF NOT EXISTS `app_group`( " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " `functional_group_id` INTEGER NOT NULL, " " PRIMARY KEY(`application_id`,`functional_group_id`), " " CONSTRAINT `fk_application_has_functional_group_application1` " @@ -175,9 +175,9 @@ const std::string kCreateSchema = " ON `app_group`(`functional_group_id`); " "CREATE INDEX IF NOT EXISTS " "`app_group.fk_application_has_functional_group_application1_idx` " - " ON `app_group`(`application_id`); " + " ON `app_group`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `preconsented_group`( " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " `functional_group_id` INTEGER NOT NULL, " " PRIMARY KEY(`application_id`,`functional_group_id`), " " CONSTRAINT `fk_application_has_functional_group_application2` " @@ -193,7 +193,7 @@ const std::string kCreateSchema = " ON `preconsented_group`(`functional_group_id`); " "CREATE INDEX IF NOT EXISTS " "`preconsented_group.fk_application_has_functional_group_application2_idx` " - " ON `preconsented_group`(`application_id`); " + " ON `preconsented_group`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `seconds_between_retry`( " " `index` INTEGER PRIMARY KEY NOT NULL, " " `value` INTEGER NOT NULL " @@ -220,7 +220,7 @@ const std::string kCreateSchema = "`device_consent_group.fk_device_has_functional_group_device1_idx` " " ON `device_consent_group`(`device_id`); " "CREATE TABLE IF NOT EXISTS `app_level`( " - " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, " + " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, " " `minutes_in_hmi_full` INTEGER DEFAULT 0, " " `minutes_in_hmi_limited` INTEGER DEFAULT 0, " " `minutes_in_hmi_background` INTEGER DEFAULT 0, " @@ -247,24 +247,24 @@ const std::string kCreateSchema = " REFERENCES `language`(`code`) " "); " "CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` " - " ON `app_level`(`application_id`); " + " ON `app_level`(`application_id` COLLATE NOCASE); " "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` " " ON `app_level`(`app_registration_language_gui`); " "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` " " ON `app_level`(`app_registration_language_vui`); " "CREATE TABLE IF NOT EXISTS `nickname`( " - " `name` VARCHAR(100) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `name` VARCHAR(100) NOT NULL COLLATE NOCASE, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`name`,`application_id`), " " CONSTRAINT `fk_nickname_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " "CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` " - " ON `nickname`(`application_id`); " + " ON `nickname`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `app_type`( " " `name` VARCHAR(50) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`name`,`application_id`), " " CONSTRAINT `fk_app_type_application1` " " FOREIGN KEY(`application_id`) " @@ -272,17 +272,17 @@ const std::string kCreateSchema = "); " "CREATE TABLE IF NOT EXISTS `request_type`( " " `request_type` VARCHAR(50) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`request_type`,`application_id`), " " CONSTRAINT `fk_app_type_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " "CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` " - " ON `app_type`(`application_id`); " + " ON `app_type`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `consent_group`( " " `device_id` VARCHAR(100) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " `functional_group_id` INTEGER NOT NULL, " " `is_consented` BOOL NOT NULL, " " `input` VARCHAR(45), " @@ -301,7 +301,7 @@ const std::string kCreateSchema = "); " "CREATE TABLE IF NOT EXISTS `external_consent_status_group`( " " `device_id` VARCHAR(100) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " `functional_group_id` INTEGER NOT NULL, " " `is_consented` BOOL NOT NULL, " " `input` VARCHAR(45), " @@ -327,13 +327,13 @@ const std::string kCreateSchema = "CREATE TABLE IF NOT EXISTS `endpoint`( " " `service` INTEGER NOT NULL, " " `url` VARCHAR(100) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " CONSTRAINT `fk_endpoint_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " "CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` " - " ON `endpoint`(`application_id`); " + " ON `endpoint`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `message`( " " `id` INTEGER PRIMARY KEY NOT NULL, " " `tts` TEXT, " @@ -374,14 +374,14 @@ const std::string kCreateSchema = /* module type */ "CREATE TABLE IF NOT EXISTS `module_type`( " " `name` VARCHAR(50) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`name`,`application_id`), " " CONSTRAINT `fk_module_type_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " "CREATE INDEX IF NOT EXISTS `module_type.fk_module_type_application1_idx` " - " ON `module_type`(`application_id`); " + " ON `module_type`(`application_id` COLLATE NOCASE); " "CREATE INDEX IF NOT EXISTS `message.fk_messages_languages1_idx` " " ON `message`(`language_code`);" diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h index c5d4c848f4..b711bf6ea2 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager.h @@ -701,6 +701,15 @@ class CacheManager : public CacheManagerInterface { return pt_; } + /** + * @brief OnDeviceSwitching Processes existing policy permissions for devices + * switching transport + * @param device_id_from Device ID original + * @param device_id_to Device ID new + */ + void OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) OVERRIDE; + private: std::string currentDateTime(); struct AppHMITypeToString { @@ -722,6 +731,13 @@ class CacheManager : public CacheManagerInterface { void PersistData(); + /** + * @brief Transform to lower case all non default application names in + * applications policies section + * @param pt polict rable for update + */ + void MakeLowerCaseAppNames(policy_table::Table& pt) const; + void ResetCalculatedPermissions(); void AddCalculatedPermissions(const std::string& device_id, diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h index 9712b799dc..9f7c7318db 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h @@ -641,6 +641,15 @@ class CacheManagerInterface { * */ virtual utils::SharedPtr<policy_table::Table> pt() const = 0; + + /** + * @brief OnDeviceSwitching Processes existing policy permissions for devices + * switching transport + * @param device_id_from Device ID original + * @param device_id_to Device ID new + */ + virtual void OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) = 0; }; typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr; diff --git a/src/components/policy/policy_regular/include/policy/policy_helper.h b/src/components/policy/policy_regular/include/policy/policy_helper.h index 996c2917d0..8a60801dd4 100644 --- a/src/components/policy/policy_regular/include/policy/policy_helper.h +++ b/src/components/policy/policy_regular/include/policy/policy_helper.h @@ -114,7 +114,8 @@ struct CheckAppPolicy { const std::vector<FunctionalGroupPermission>& revoked_groups) const; bool IsKnownAppication(const std::string& application_id) const; void NotifySystem(const AppPoliciesValueType& app_policy) const; - void SendPermissionsToApp(const AppPoliciesValueType& app_policy) const; + void SendPermissionsToApp(const std::string& app_id, + const policy_table::Strings& groups) const; bool IsAppRevoked(const AppPoliciesValueType& app_policy) const; bool NicknamesMatch(const AppPoliciesValueType& app_policy) const; /** diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h index 1b39392c0c..941db1a67f 100644 --- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h @@ -553,6 +553,9 @@ class PolicyManagerImpl : public PolicyManager { */ void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE; + void OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) OVERRIDE; + /** * @brief RetrieveCertificate Allows to obtain certificate in order * to start secure connection. diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 377278949b..94a33a1e04 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -83,6 +83,21 @@ struct LanguageFinder { const std::string& language_; }; +struct PolicyTableUpdater { + PolicyTableUpdater(const policy_table::ApplicationParams& default_params) + : default_params_(default_params) {} + + void operator()(policy_table::ApplicationPolicies::value_type& pt_value) { + if (policy::kDefaultId == pt_value.second.get_string()) { + pt_value.second = default_params_; + pt_value.second.set_to_string(policy::kDefaultId); + } + } + + private: + const policy_table::ApplicationParams& default_params_; +}; + CacheManager::CacheManager() : CacheManagerInterface() , pt_(new policy_table::Table) @@ -244,6 +259,11 @@ bool CacheManager::ApplyUpdate(const policy_table::Table& update_pt) { ""); } else { pt_->policy_table.app_policies_section.apps[iter->first] = iter->second; + if (kDefaultId == iter->first) { + std::for_each(pt_->policy_table.app_policies_section.apps.begin(), + pt_->policy_table.app_policies_section.apps.end(), + PolicyTableUpdater(iter->second)); + } } } @@ -1398,6 +1418,27 @@ bool CacheManager::LoadFromBackup() { return true; } +void CacheManager::MakeLowerCaseAppNames(policy_table::Table& pt) const { + policy_table::ApplicationPolicies& apps = + pt.policy_table.app_policies_section.apps; + for (policy_table::ApplicationPolicies::iterator iter = apps.begin(); + iter != apps.end();) { + std::string key = iter->first; + if (key == kDefaultId || key == kPreDataConsentId || key == kDeviceId) { + ++iter; + continue; + } + + std::transform(key.begin(), key.end(), key.begin(), ::tolower); + if (key.compare(iter->first) != 0) { + std::swap(apps[key], iter->second); + iter = apps.erase(iter); + } else { + ++iter; + } + } +} + bool CacheManager::LoadFromFile(const std::string& file_name, policy_table::Table& table) { LOG4CXX_AUTO_TRACE(logger_); @@ -1426,6 +1467,8 @@ bool CacheManager::LoadFromFile(const std::string& file_name, LOG4CXX_DEBUG(logger_, "PT out:"); LOG4CXX_DEBUG(logger_, s_writer.write(table.ToJsonValue())); + MakeLowerCaseAppNames(table); + if (!table.is_valid()) { rpc::ValidationReport report("policy_table"); table.ReportErrors(&report); @@ -1433,6 +1476,7 @@ bool CacheManager::LoadFromFile(const std::string& file_name, "Parsed table is not valid " << rpc::PrettyFormat(report)); return false; } + return true; } @@ -1588,6 +1632,12 @@ const PolicySettings& CacheManager::get_settings() const { return *settings_; } +void CacheManager::OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_INFO(logger_, "Implementation does not support user consents."); +} + CacheManager::BackgroundBackuper::BackgroundBackuper( CacheManager* cache_manager) : cache_manager_(cache_manager) diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index b72a041a83..782a65f91a 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -267,9 +267,7 @@ void policy::CheckAppPolicy::NotifySystem( } void CheckAppPolicy::SendPermissionsToApp( - const AppPoliciesValueType& app_policy) const { - const std::string app_id = app_policy.first; - + const std::string& app_id, const policy_table::Strings& groups) const { const std::string device_id = pm_->GetCurrentDeviceId(app_id); if (device_id.empty()) { LOG4CXX_WARN(logger_, @@ -281,7 +279,7 @@ void CheckAppPolicy::SendPermissionsToApp( Permissions notification_data; pm_->PrepareNotificationData(update_->policy_table.functional_groupings, - app_policy.second.groups, + groups, group_permissons, notification_data); @@ -356,6 +354,20 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { "Permissions for application:" << app_id << " have been changed."); + if (IsPredefinedApp(app_policy)) { + for (const policy_table::ApplicationPolicies::value_type& app : + snapshot_->policy_table.app_policies_section.apps) { + if (app_policy.first == app.second.get_string()) { + if (RESULT_CONSENT_NOT_REQIURED != result) { + SetPendingPermissions(app, result); + NotifySystem(app); + } + SendPermissionsToApp(app.first, app_policy.second.groups); + } + } + return true; + } + if (!IsPredefinedApp(app_policy) && RESULT_CONSENT_NOT_REQIURED != result) { SetPendingPermissions(app_policy, result); NotifySystem(app_policy); @@ -363,7 +375,7 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) { // Don't sent notification for predefined apps (e.g. default, device etc.) if (!IsPredefinedApp(app_policy)) { - SendPermissionsToApp(app_policy); + SendPermissionsToApp(app_policy.first, app_policy.second.groups); } return true; } diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index 640b9c1457..055b57d985 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -366,6 +366,12 @@ void PolicyManagerImpl::OnAppRegisteredOnMobile( SendNotificationOnPermissionsUpdated(application_id); } +void PolicyManagerImpl::OnDeviceSwitching(const std::string& device_id_from, + const std::string& device_id_to) { + LOG4CXX_AUTO_TRACE(logger_); + cache_->OnDeviceSwitching(device_id_from, device_id_to); +} + const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes( const std::string policy_app_id) const { std::vector<std::string> request_types; diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc index 7938eb4085..ef4ef49273 100644 --- a/src/components/policy/policy_regular/src/sql_pt_queries.cc +++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc @@ -123,7 +123,7 @@ const std::string kCreateSchema = "CREATE INDEX `rpc.select_rpc_name_hmi_level` " " ON `rpc`(`name`,`hmi_level_value`);" "CREATE TABLE IF NOT EXISTS `application`( " - " `id` VARCHAR(45) PRIMARY KEY NOT NULL, " + " `id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, " " `keep_context` BOOLEAN, " " `steal_focus` BOOLEAN, " " `default_hmi` VARCHAR(45), " @@ -147,7 +147,7 @@ const std::string kCreateSchema = "CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` " " ON `application`(`priority_value`); " "CREATE TABLE IF NOT EXISTS `app_group`( " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " `functional_group_id` INTEGER NOT NULL, " " PRIMARY KEY(`application_id`,`functional_group_id`), " " CONSTRAINT `fk_application_has_functional_group_application1` " @@ -162,9 +162,9 @@ const std::string kCreateSchema = " ON `app_group`(`functional_group_id`); " "CREATE INDEX IF NOT EXISTS " "`app_group.fk_application_has_functional_group_application1_idx` " - " ON `app_group`(`application_id`); " + " ON `app_group`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `preconsented_group`( " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " `functional_group_id` INTEGER NOT NULL, " " PRIMARY KEY(`application_id`,`functional_group_id`), " " CONSTRAINT `fk_application_has_functional_group_application2` " @@ -180,7 +180,7 @@ const std::string kCreateSchema = " ON `preconsented_group`(`functional_group_id`); " "CREATE INDEX IF NOT EXISTS " "`preconsented_group.fk_application_has_functional_group_application2_idx` " - " ON `preconsented_group`(`application_id`); " + " ON `preconsented_group`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `seconds_between_retry`( " " `index` INTEGER PRIMARY KEY NOT NULL, " " `value` INTEGER NOT NULL " @@ -207,7 +207,7 @@ const std::string kCreateSchema = "`device_consent_group.fk_device_has_functional_group_device1_idx` " " ON `device_consent_group`(`device_id`); " "CREATE TABLE IF NOT EXISTS `app_level`( " - " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, " + " `application_id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, " " `minutes_in_hmi_full` INTEGER DEFAULT 0, " " `minutes_in_hmi_limited` INTEGER DEFAULT 0, " " `minutes_in_hmi_background` INTEGER DEFAULT 0, " @@ -234,24 +234,24 @@ const std::string kCreateSchema = " REFERENCES `language`(`code`) " "); " "CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` " - " ON `app_level`(`application_id`); " + " ON `app_level`(`application_id` COLLATE NOCASE); " "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` " " ON `app_level`(`app_registration_language_gui`); " "CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` " " ON `app_level`(`app_registration_language_vui`); " "CREATE TABLE IF NOT EXISTS `nickname`( " - " `name` VARCHAR(100) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `name` VARCHAR(100) NOT NULL COLLATE NOCASE, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`name`,`application_id`), " " CONSTRAINT `fk_nickname_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " "CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` " - " ON `nickname`(`application_id`); " + " ON `nickname`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `app_type`( " " `name` VARCHAR(50) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`name`,`application_id`), " " CONSTRAINT `fk_app_type_application1` " " FOREIGN KEY(`application_id`) " @@ -259,17 +259,17 @@ const std::string kCreateSchema = "); " "CREATE TABLE IF NOT EXISTS `request_type`( " " `request_type` VARCHAR(50) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " PRIMARY KEY(`request_type`,`application_id`), " " CONSTRAINT `fk_app_type_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " "CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` " - " ON `app_type`(`application_id`); " + " ON `app_type`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `consent_group`( " " `device_id` VARCHAR(100) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " `functional_group_id` INTEGER NOT NULL, " " `is_consented` BOOL NOT NULL, " " `input` VARCHAR(45), " @@ -294,13 +294,13 @@ const std::string kCreateSchema = "CREATE TABLE IF NOT EXISTS `endpoint`( " " `service` VARCHAR(100) NOT NULL, " " `url` VARCHAR(100) NOT NULL, " - " `application_id` VARCHAR(45) NOT NULL, " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " CONSTRAINT `fk_endpoint_application1` " " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " "CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` " - " ON `endpoint`(`application_id`); " + " ON `endpoint`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `message`( " " `id` INTEGER PRIMARY KEY NOT NULL, " " `tts` TEXT, " diff --git a/src/components/protocol_handler/include/protocol_handler/handshake_handler.h b/src/components/protocol_handler/include/protocol_handler/handshake_handler.h new file mode 100644 index 0000000000..0ef40290f2 --- /dev/null +++ b/src/components/protocol_handler/include/protocol_handler/handshake_handler.h @@ -0,0 +1,128 @@ +/* + * 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_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_START_SESSION_HANDLER_H_ +#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_START_SESSION_HANDLER_H_ + +#include <memory> + +#include "protocol_handler/protocol_handler_impl.h" +#include "protocol_handler/protocol_packet.h" +#include "protocol_handler/session_observer.h" +#include "security_manager/security_manager_listener.h" + +namespace protocol_handler { + +class ProtocolHandlerImpl; + +/** + * @brief HandshakeHandler class for handling SSL handshake and sending + * Ack/Nack on its success or fail + */ +class HandshakeHandler : public security_manager::SecurityManagerListener { + public: + DEPRECATED HandshakeHandler(ProtocolHandlerImpl& protocol_handler, + SessionObserver& session_observer, + uint32_t connection_key, + ConnectionID connection_id, + uint8_t session_id, + uint8_t protocol_version, + uint32_t hash_id, + ServiceType service_type, + const std::vector<int>& force_protected_service, + const bool is_new_service, + ProtocolPacket::ProtocolVersion& full_version, + std::shared_ptr<uint8_t> payload); + + HandshakeHandler(ProtocolHandlerImpl& protocol_handler, + SessionObserver& session_observer, + ProtocolPacket::ProtocolVersion& full_version, + const SessionContext& context, + const uint8_t protocol_version, + std::shared_ptr<uint8_t> payload); + + ~HandshakeHandler(); + + /** + * @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 + */ + bool GetPolicyCertificateData(std::string& data) const OVERRIDE; + + /** + * @brief Notification about protection result + * @param connection_key Unique key of session which triggrs handshake + * @param result result of connection protection + * @return true on success notification handling or false otherwise + */ + bool OnHandshakeDone( + uint32_t connection_key, + security_manager::SSLContext::HandshakeResult result) OVERRIDE; + + /** + * @brief Notification that certificate update is required. + */ + void OnCertificateUpdateRequired() OVERRIDE; + + /** + * @brief Get connection key of this handler + * @return connection key + */ + uint32_t connection_key() const; + + private: + /** + * @brief Performs related actions if handshake was successfully finished + * @param connection_key Unique key of session which triggrs handshake + * @param params set of params used in bson part of message + */ + void ProcessSuccessfulHandshake(const uint32_t connection_key, + BsonObject& params); + + /** + * @brief Performs related actions if handshake was failed + * @param params set of params used in bson part of message + */ + void ProcessFailedHandshake(BsonObject& params); + + ProtocolHandlerImpl& protocol_handler_; + SessionObserver& session_observer_; + SessionContext context_; + ProtocolPacket::ProtocolVersion full_version_; + const uint8_t protocol_version_; + std::shared_ptr<uint8_t> payload_; +}; + +} // namespace protocol_handler + +#endif // SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_START_SESSION_HANDLER_H_ diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h index c5a45c0dfe..0efb81cdd7 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h @@ -56,6 +56,7 @@ #include "transport_manager/transport_manager.h" #include "transport_manager/transport_manager_listener_empty.h" #include "connection_handler/connection_handler.h" +#include "application_manager/policies/policy_handler_observer.h" #ifdef TELEMETRY_MONITOR #include "protocol_handler/telemetry_observer.h" @@ -64,6 +65,7 @@ #ifdef ENABLE_SECURITY #include "security_manager/security_manager.h" +#include "protocol_handler/handshake_handler.h" #endif // ENABLE_SECURITY namespace connection_handler { @@ -77,6 +79,7 @@ class ConnectionHandlerImpl; namespace protocol_handler { class ProtocolObserver; class SessionObserver; +class HandshakeHandler; class MessagesFromMobileAppHandler; class MessagesToMobileAppHandler; @@ -141,6 +144,7 @@ typedef threads::MessageLoopThread< class ProtocolHandlerImpl : public ProtocolHandler, public TransportManagerListenerEmpty, + public policy::PolicyHandlerObserver, public impl::FromMobileQueue::Handler, public impl::ToMobileQueue::Handler #ifdef TELEMETRY_MONITOR @@ -389,7 +393,7 @@ class ProtocolHandlerImpl * Only valid when generated_session_id is 0. Note, even if * generated_session_id is 0, the list may be empty. */ - void NotifySessionStartedResult( + DEPRECATED void NotifySessionStartedResult( int32_t connection_id, uint8_t session_id, uint8_t generated_session_id, @@ -397,6 +401,17 @@ class ProtocolHandlerImpl bool protection, std::vector<std::string>& rejected_params) OVERRIDE; + /** + * @brief Called by connection handler to notify the result 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. + */ + void NotifySessionStarted(const SessionContext& context, + std::vector<std::string>& rejected_params) OVERRIDE; + #ifdef BUILD_TESTS const impl::FromMobileQueue& get_from_mobile_queue() const { return raw_ford_messages_from_mobile_; @@ -458,6 +473,14 @@ class ProtocolHandlerImpl const transport_manager::ConnectionUID connection_id) OVERRIDE; /** + * @brief OnPTUFinished the callback which signals PTU has finished + * + * @param ptu_result the result from the PTU - true if successful, + * otherwise false. + */ + void OnPTUFinished(const bool ptu_result) OVERRIDE; + + /** * @brief Notifies subscribers about message * received from mobile device. * @param message Message with already parsed header. @@ -553,8 +576,8 @@ class ProtocolHandlerImpl RESULT_CODE HandleControlMessageEndServiceACK(const ProtocolPacket& packet); - // DEPRECATED - RESULT_CODE HandleControlMessageStartSession(const ProtocolPacket& packet); + DEPRECATED RESULT_CODE + HandleControlMessageStartSession(const ProtocolPacket& packet); RESULT_CODE HandleControlMessageStartSession(const ProtocolFramePtr packet); @@ -660,6 +683,10 @@ class ProtocolHandlerImpl #ifdef ENABLE_SECURITY security_manager::SecurityManager* security_manager_; + + bool is_ptu_triggered_; + std::list<std::shared_ptr<HandshakeHandler> > ptu_pending_handlers_; + sync_primitives::Lock ptu_handlers_lock_; #endif // ENABLE_SECURITY // Thread that pumps non-parsed messages coming from mobile side. diff --git a/src/components/protocol_handler/src/handshake_handler.cc b/src/components/protocol_handler/src/handshake_handler.cc new file mode 100644 index 0000000000..055ff2cf45 --- /dev/null +++ b/src/components/protocol_handler/src/handshake_handler.cc @@ -0,0 +1,201 @@ +/* + * 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. + */ + +#include "protocol_handler/handshake_handler.h" + +#include <bson_object.h> + +#include "protocol_handler/protocol_handler_impl.h" +#include "protocol_handler/protocol_packet.h" +#include "security_manager/security_manager.h" +#include "protocol_handler/session_observer.h" + +namespace protocol_handler { + +CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler") + +HandshakeHandler::HandshakeHandler( + ProtocolHandlerImpl& protocol_handler, + SessionObserver& session_observer, + uint32_t connection_key, + ConnectionID connection_id, + uint8_t session_id, + uint8_t protocol_version, + uint32_t hash_id, + ServiceType service_type, + const std::vector<int>& force_protected_service, + const bool is_new_service, + ProtocolPacket::ProtocolVersion& full_version, + std::shared_ptr<uint8_t> payload) + : protocol_handler_(protocol_handler) + , session_observer_(session_observer) + , context_() + , full_version_(full_version) + , protocol_version_(protocol_version) + , payload_(payload) {} + +HandshakeHandler::HandshakeHandler( + ProtocolHandlerImpl& protocol_handler, + SessionObserver& session_observer, + ProtocolPacket::ProtocolVersion& full_version, + const SessionContext& context, + const uint8_t protocol_version, + std::shared_ptr<uint8_t> payload) + : protocol_handler_(protocol_handler) + , session_observer_(session_observer) + , context_(context) + , full_version_(full_version) + , protocol_version_(protocol_version) + , payload_(payload) {} + +HandshakeHandler::~HandshakeHandler() { + LOG4CXX_DEBUG(logger_, "Destroying of HandshakeHandler: " << this); +} + +uint32_t HandshakeHandler::connection_key() const { + return session_observer_.KeyFromPair(context_.connection_id_, + context_.new_session_id_); +} + +bool HandshakeHandler::GetPolicyCertificateData(std::string& data) const { + return false; +} + +void HandshakeHandler::OnCertificateUpdateRequired() {} + +bool HandshakeHandler::OnHandshakeDone( + uint32_t connection_key, + security_manager::SSLContext::HandshakeResult result) { + LOG4CXX_AUTO_TRACE(logger_); + + if (connection_key != this->connection_key()) { + LOG4CXX_DEBUG(logger_, + "Listener " << this + << " expects notification for connection id: " + << this->connection_key() + << ". Received notification for connection id " + << connection_key << " will be ignored"); + return false; + } + + const bool success = + result == security_manager::SSLContext::Handshake_Result_Success; + + BsonObject params; + if (payload_) { + params = bson_object_from_bytes(payload_.get()); + } else { + bson_object_initialize_default(¶ms); + } + + if (success) { + ProcessSuccessfulHandshake(connection_key, params); + } else { + ProcessFailedHandshake(params); + } + + bson_object_deinitialize(¶ms); + return true; +} + +void HandshakeHandler::ProcessSuccessfulHandshake(const uint32_t connection_key, + BsonObject& params) { + LOG4CXX_AUTO_TRACE(logger_); + const std::vector<int>& force_unprotected = + protocol_handler_.get_settings().force_unprotected_service(); + + const bool can_be_protected = + std::find(force_unprotected.begin(), + force_unprotected.end(), + context_.service_type_) == force_unprotected.end(); + + const bool is_service_already_protected = + session_observer_.GetSSLContext(connection_key, context_.service_type_) != + NULL; + + LOG4CXX_DEBUG(logger_, + "Service can be protected: " << can_be_protected + << " and service was protected: " + << is_service_already_protected); + + if (can_be_protected && !is_service_already_protected) { + session_observer_.SetProtectionFlag(connection_key, context_.service_type_); + protocol_handler_.SendStartSessionAck(context_.connection_id_, + context_.new_session_id_, + protocol_version_, + context_.hash_id_, + context_.service_type_, + can_be_protected, + full_version_, + params); + } else { + protocol_handler_.SendStartSessionNAck(context_.connection_id_, + context_.new_session_id_, + protocol_version_, + context_.service_type_); + } +} + +void HandshakeHandler::ProcessFailedHandshake(BsonObject& params) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Handshake failed"); + const std::vector<int>& force_protected = + protocol_handler_.get_settings().force_protected_service(); + + const bool can_be_unprotected = + std::find(force_protected.begin(), + force_protected.end(), + context_.service_type_) == force_protected.end(); + + LOG4CXX_DEBUG(logger_, + "Service can be unprotected: " << can_be_unprotected + << " and this is a new service: " + << context_.is_new_service_); + + if (can_be_unprotected && context_.is_new_service_) { + protocol_handler_.SendStartSessionAck(context_.connection_id_, + context_.new_session_id_, + protocol_version_, + context_.hash_id_, + context_.service_type_, + PROTECTION_OFF, + full_version_, + params); + } else { + protocol_handler_.SendStartSessionNAck(context_.connection_id_, + context_.new_session_id_, + protocol_version_, + context_.service_type_); + } +} + +} // namespace protocol_handler diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 23ac2927ef..47d546657f 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -77,8 +77,9 @@ ProtocolHandlerImpl::ProtocolHandlerImpl( security_manager_(NULL) , #endif // ENABLE_SECURITY - raw_ford_messages_from_mobile_( - "PH FromMobile", this, threads::ThreadOptions(kStackSize)) + is_ptu_triggered_(false) + , raw_ford_messages_from_mobile_( + "PH FromMobile", this, threads::ThreadOptions(kStackSize)) , raw_ford_messages_to_mobile_( "PH ToMobile", this, threads::ThreadOptions(kStackSize)) , start_session_frame_map_lock_() @@ -838,6 +839,59 @@ void ProtocolHandlerImpl::OnConnectionClosed( multiframe_builder_.RemoveConnection(connection_id); } +void ProtocolHandlerImpl::OnPTUFinished(const bool ptu_result) { + LOG4CXX_AUTO_TRACE(logger_); + +#ifdef ENABLE_SECURITY + sync_primitives::AutoLock lock(ptu_handlers_lock_); + + if (!is_ptu_triggered_) { + LOG4CXX_ERROR(logger_, + "PTU was not triggered by service starting. Ignored"); + return; + } + + const bool is_cert_expired = security_manager_->IsCertificateUpdateRequired(); + for (auto handler : ptu_pending_handlers_) { + security_manager::SSLContext* ssl_context = + is_cert_expired + ? NULL + : security_manager_->CreateSSLContext(handler->connection_key()); + + if (!ssl_context) { + const std::string error("CreateSSLContext failed"); + LOG4CXX_ERROR(logger_, error); + security_manager_->SendInternalError( + handler->connection_key(), + security_manager::SecurityManager::ERROR_INTERNAL, + error); + + handler->OnHandshakeDone( + handler->connection_key(), + security_manager::SSLContext::Handshake_Result_Fail); + + continue; + } + + if (ssl_context->IsInitCompleted()) { + handler->OnHandshakeDone( + handler->connection_key(), + security_manager::SSLContext::Handshake_Result_Success); + } else { + security_manager_->AddListener(new HandshakeHandler(*handler)); + if (!ssl_context->IsHandshakePending()) { + // Start handshake process + security_manager_->StartHandshake(handler->connection_key()); + } + } + } + + LOG4CXX_DEBUG(logger_, "Handshake handlers were notified"); + ptu_pending_handlers_.clear(); + is_ptu_triggered_ = false; +#endif // ENABLE_SECURITY +} + RESULT_CODE ProtocolHandlerImpl::SendFrame(const ProtocolFramePtr packet) { LOG4CXX_AUTO_TRACE(logger_); if (!packet) { @@ -1173,12 +1227,12 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK( LOG4CXX_AUTO_TRACE(logger_); const uint8_t current_session_id = packet.session_id(); - const uint32_t hash_id = get_hash_id(packet); + uint32_t hash_id = get_hash_id(packet); const ServiceType service_type = ServiceTypeFromByte(packet.service_type()); const ConnectionID connection_id = packet.connection_id(); const uint32_t session_key = session_observer_.OnSessionEndedCallback( - connection_id, current_session_id, hash_id, service_type); + connection_id, current_session_id, &hash_id, service_type); if (0 == session_key) { LOG4CXX_WARN(logger_, "Refused to end service"); @@ -1188,126 +1242,9 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK( return RESULT_OK; } -#ifdef ENABLE_SECURITY -namespace { -/** - * \brief SecurityManagerListener for send Ack/NAck on success or fail - * SSL handshake - */ -class StartSessionHandler : public security_manager::SecurityManagerListener { - public: - StartSessionHandler(uint32_t connection_key, - ProtocolHandlerImpl* protocol_handler, - SessionObserver& session_observer, - ConnectionID connection_id, - int32_t session_id, - uint8_t protocol_version, - uint32_t hash_id, - ServiceType service_type, - const std::vector<int>& force_protected_service) - : connection_key_(connection_key) - , protocol_handler_(protocol_handler) - , session_observer_(session_observer) - , connection_id_(connection_id) - , session_id_(session_id) - , protocol_version_(protocol_version) - , hash_id_(hash_id) - , service_type_(service_type) - , force_protected_service_(force_protected_service) - , full_version_() - , payload_(NULL) {} - StartSessionHandler(uint32_t connection_key, - ProtocolHandlerImpl* protocol_handler, - SessionObserver& session_observer, - ConnectionID connection_id, - int32_t session_id, - uint8_t protocol_version, - uint32_t hash_id, - ServiceType service_type, - const std::vector<int>& force_protected_service, - ProtocolPacket::ProtocolVersion& full_version, - uint8_t* payload) - : connection_key_(connection_key) - , protocol_handler_(protocol_handler) - , session_observer_(session_observer) - , connection_id_(connection_id) - , session_id_(session_id) - , protocol_version_(protocol_version) - , hash_id_(hash_id) - , service_type_(service_type) - , force_protected_service_(force_protected_service) - , full_version_(full_version) - , payload_(payload) {} - - bool OnHandshakeDone( - const uint32_t connection_key, - security_manager::SSLContext::HandshakeResult result) OVERRIDE { - if (connection_key != connection_key_) { - delete[] payload_; - return false; - } - const bool success = - result == security_manager::SSLContext::Handshake_Result_Success; - // check current service protection - const bool was_service_protection_enabled = - session_observer_.GetSSLContext(connection_key_, service_type_) != NULL; - if (was_service_protection_enabled) { - if (!success) { - protocol_handler_->SendStartSessionNAck( - connection_id_, session_id_, protocol_version_, service_type_); - } else { - // Could not be success handshake and not already protected service - NOTREACHED(); - } - } else { - if (success) { - session_observer_.SetProtectionFlag(connection_key_, service_type_); - } - BsonObject params; - if (payload_ != NULL) { - params = bson_object_from_bytes(payload_); - } else { - bson_object_initialize_default(¶ms); - } - protocol_handler_->SendStartSessionAck(connection_id_, - session_id_, - protocol_version_, - hash_id_, - service_type_, - success, - full_version_, - params); - bson_object_deinitialize(¶ms); - } - delete[] payload_; - delete this; - return true; - } - - void OnCertificateUpdateRequired() OVERRIDE {} - - virtual const std::vector<int>& force_protected_service() const { - return force_protected_service_; - } - - private: - const uint32_t connection_key_; - ProtocolHandlerImpl* protocol_handler_; - SessionObserver& session_observer_; - - const ConnectionID connection_id_; - const int32_t session_id_; - const uint8_t protocol_version_; - const uint32_t hash_id_; - const ServiceType service_type_; - const std::vector<int> force_protected_service_; - ProtocolPacket::ProtocolVersion full_version_; - uint8_t* payload_; -}; -} // namespace -#endif // ENABLE_SECURITY - -// DEPRECATED +// Suppress warning for deprecated method used within another deprecated method +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( const ProtocolPacket& packet) { LOG4CXX_AUTO_TRACE(logger_); @@ -1402,17 +1339,18 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( *fullVersion); } else { security_manager_->AddListener( - new StartSessionHandler(connection_key, - this, - session_observer_, - connection_id, - session_id, - packet.protocol_version(), - hash_id, - service_type, - get_settings().force_protected_service(), - *fullVersion, - NULL)); + new HandshakeHandler(*this, + session_observer_, + connection_key, + connection_id, + session_id, + packet.protocol_version(), + hash_id, + service_type, + get_settings().force_protected_service(), + false, + *fullVersion, + NULL)); if (!ssl_context->IsHandshakePending()) { // Start handshake process security_manager_->StartHandshake(connection_key); @@ -1461,6 +1399,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( } return RESULT_OK; } +#pragma GCC diagnostic pop RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession( const ProtocolFramePtr packet) { @@ -1509,11 +1448,25 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( uint32_t hash_id, bool protection, std::vector<std::string>& rejected_params) { + LOG4CXX_AUTO_TRACE(logger_); + protocol_handler::SessionContext context(connection_id, + session_id, + generated_session_id, + ServiceType::kInvalidServiceType, + hash_id, + protection); + NotifySessionStarted(context, rejected_params); +} + +void ProtocolHandlerImpl::NotifySessionStarted( + const SessionContext& context, std::vector<std::string>& rejected_params) { + LOG4CXX_AUTO_TRACE(logger_); + ProtocolFramePtr packet; { sync_primitives::AutoLock auto_lock(start_session_frame_map_lock_); StartSessionFrameMap::iterator it = start_session_frame_map_.find( - std::make_pair(connection_id, session_id)); + std::make_pair(context.connection_id_, context.initial_session_id_)); if (it == start_session_frame_map_.end()) { LOG4CXX_ERROR(logger_, "Cannot find Session Started packet"); return; @@ -1525,11 +1478,11 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( const ServiceType service_type = ServiceTypeFromByte(packet->service_type()); const uint8_t protocol_version = packet->protocol_version(); - if (0 == generated_session_id) { + if (0 == context.new_session_id_) { LOG4CXX_WARN(logger_, "Refused by session_observer to create service " << static_cast<int32_t>(service_type) << " type."); - SendStartSessionNAck(connection_id, + SendStartSessionNAck(context.connection_id_, packet->session_id(), protocol_version, packet->service_type(), @@ -1537,8 +1490,9 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( return; } - BsonObject start_session_ack_params; - bson_object_initialize_default(&start_session_ack_params); + std::shared_ptr<BsonObject> start_session_ack_params( + new BsonObject(), [](BsonObject* obj) { bson_object_deinitialize(obj); }); + bson_object_initialize_default(start_session_ack_params.get()); // when video service is successfully started, copy input parameters // ("width", "height", "videoProtocol", "videoCodec") to the ACK packet if (packet->service_type() == kMobileNav && packet->data() != NULL) { @@ -1547,13 +1501,13 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( if ((element = bson_object_get(&req_param, strings::height)) != NULL && element->type == TYPE_INT32) { - bson_object_put_int32(&start_session_ack_params, + bson_object_put_int32(start_session_ack_params.get(), strings::height, bson_object_get_int32(&req_param, strings::height)); } if ((element = bson_object_get(&req_param, strings::width)) != NULL && element->type == TYPE_INT32) { - bson_object_put_int32(&start_session_ack_params, + bson_object_put_int32(start_session_ack_params.get(), strings::width, bson_object_get_int32(&req_param, strings::width)); } @@ -1561,17 +1515,17 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( bson_object_get_string(&req_param, strings::video_protocol); if (protocol != NULL) { bson_object_put_string( - &start_session_ack_params, strings::video_protocol, protocol); + start_session_ack_params.get(), strings::video_protocol, protocol); } char* codec = bson_object_get_string(&req_param, strings::video_codec); if (codec != NULL) { bson_object_put_string( - &start_session_ack_params, strings::video_codec, codec); + start_session_ack_params.get(), strings::video_codec, codec); } bson_object_deinitialize(&req_param); } - ProtocolPacket::ProtocolVersion* fullVersion; + std::shared_ptr<ProtocolPacket::ProtocolVersion> fullVersion; // Can't check protocol_version because the first packet is v1, but there // could still be a payload, in which case we can get the real protocol @@ -1581,24 +1535,68 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( char* version_param = bson_object_get_string(&request_params, strings::protocol_version); std::string version_string(version_param == NULL ? "" : version_param); - fullVersion = new ProtocolPacket::ProtocolVersion(version_string); + fullVersion = + std::make_shared<ProtocolPacket::ProtocolVersion>(version_string); // Constructed payloads added in Protocol v5 if (fullVersion->majorVersion < PROTOCOL_VERSION_5) { rejected_params.push_back(std::string(strings::protocol_version)); } bson_object_deinitialize(&request_params); } else { - fullVersion = new ProtocolPacket::ProtocolVersion(); + fullVersion = std::make_shared<ProtocolPacket::ProtocolVersion>(); } #ifdef ENABLE_SECURITY // for packet is encrypted and security plugin is enable - if (protection && security_manager_) { - const uint32_t connection_key = - session_observer_.KeyFromPair(connection_id, generated_session_id); + if (context.is_protected_ && security_manager_) { + const uint32_t connection_key = session_observer_.KeyFromPair( + context.connection_id_, context.new_session_id_); + + std::shared_ptr<uint8_t> bson_object_bytes( + bson_object_to_bytes(start_session_ack_params.get()), + [](uint8_t* p) { delete[] p; }); + + std::shared_ptr<HandshakeHandler> handler = + std::make_shared<HandshakeHandler>(*this, + session_observer_, + *fullVersion, + context, + packet->protocol_version(), + bson_object_bytes); + + const bool is_certificate_empty = + security_manager_->IsPolicyCertificateDataEmpty(); + + const bool is_certificate_expired = + is_certificate_empty || + security_manager_->IsCertificateUpdateRequired(); + + if (context.is_ptu_required_ && is_certificate_empty) { + LOG4CXX_DEBUG(logger_, + "PTU for StartSessionHandler " + << handler.get() + << " is required and certificate data is empty"); + + sync_primitives::AutoLock lock(ptu_handlers_lock_); + if (!is_ptu_triggered_) { + LOG4CXX_DEBUG(logger_, + "PTU is not triggered yet. " + << "Starting PTU and postponing SSL handshake"); + + ptu_pending_handlers_.push_back(handler); + is_ptu_triggered_ = true; + security_manager_->NotifyOnCertificateUpdateRequired(); + } else { + LOG4CXX_DEBUG(logger_, "PTU has been triggered. Added to pending."); + ptu_pending_handlers_.push_back(handler); + } + return; + } security_manager::SSLContext* ssl_context = - security_manager_->CreateSSLContext(connection_key); + is_certificate_expired + ? NULL + : security_manager_->CreateSSLContext(connection_key); if (!ssl_context) { const std::string error("CreateSSLContext failed"); LOG4CXX_ERROR(logger_, error); @@ -1606,22 +1604,15 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( connection_key, security_manager::SecurityManager::ERROR_INTERNAL, error); - // Start service without protection - SendStartSessionAck(connection_id, - generated_session_id, - packet->protocol_version(), - hash_id, - packet->service_type(), - PROTECTION_OFF, - *fullVersion, - start_session_ack_params); - delete fullVersion; - bson_object_deinitialize(&start_session_ack_params); + + handler->OnHandshakeDone( + connection_key, security_manager::SSLContext::Handshake_Result_Fail); + return; } if (!rejected_params.empty()) { - SendStartSessionNAck(connection_id, + SendStartSessionNAck(context.connection_id_, packet->session_id(), protocol_version, packet->service_type(), @@ -1630,36 +1621,21 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( // mark service as protected session_observer_.SetProtectionFlag(connection_key, service_type); // Start service as protected with current SSLContext - SendStartSessionAck(connection_id, - generated_session_id, + SendStartSessionAck(context.connection_id_, + context.new_session_id_, packet->protocol_version(), - hash_id, + context.hash_id_, packet->service_type(), PROTECTION_ON, *fullVersion, - start_session_ack_params); + *start_session_ack_params); } else { - // Need a copy because fullVersion will be deleted - ProtocolPacket::ProtocolVersion fullVersionCopy(*fullVersion); - security_manager_->AddListener(new StartSessionHandler( - connection_key, - this, - session_observer_, - connection_id, - generated_session_id, - packet->protocol_version(), - hash_id, - service_type, - get_settings().force_protected_service(), - fullVersionCopy, - bson_object_to_bytes(&start_session_ack_params))); + security_manager_->AddListener(new HandshakeHandler(*handler)); if (!ssl_context->IsHandshakePending()) { // Start handshake process security_manager_->StartHandshake(connection_key); } } - delete fullVersion; - bson_object_deinitialize(&start_session_ack_params); LOG4CXX_DEBUG(logger_, "Protection establishing for connection " << connection_key << " is in progress"); @@ -1667,23 +1643,21 @@ void ProtocolHandlerImpl::NotifySessionStartedResult( } #endif // ENABLE_SECURITY if (rejected_params.empty()) { - SendStartSessionAck(connection_id, - generated_session_id, + SendStartSessionAck(context.connection_id_, + context.new_session_id_, packet->protocol_version(), - hash_id, + context.hash_id_, packet->service_type(), PROTECTION_OFF, *fullVersion, - start_session_ack_params); + *start_session_ack_params); } else { - SendStartSessionNAck(connection_id, + SendStartSessionNAck(context.connection_id_, packet->session_id(), protocol_version, packet->service_type(), rejected_params); } - delete fullVersion; - bson_object_deinitialize(&start_session_ack_params); } RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat( @@ -1895,11 +1869,11 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) { connection_key, security_manager::SecurityManager::ERROR_ENCRYPTION_FAILED, error_text); + + uint32_t hash_id = packet->message_id(); // Close session to prevent usage unprotected service/session - session_observer_.OnSessionEndedCallback(packet->connection_id(), - packet->session_id(), - packet->message_id(), - kRpc); + session_observer_.OnSessionEndedCallback( + packet->connection_id(), packet->session_id(), &hash_id, kRpc); return RESULT_OK; } LOG4CXX_DEBUG(logger_, @@ -1948,11 +1922,11 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) { connection_key, security_manager::SecurityManager::ERROR_DECRYPTION_FAILED, error_text); + + uint32_t hash_id = packet->message_id(); // Close session to prevent usage unprotected service/session - session_observer_.OnSessionEndedCallback(packet->connection_id(), - packet->session_id(), - packet->message_id(), - kRpc); + session_observer_.OnSessionEndedCallback( + packet->connection_id(), packet->session_id(), &hash_id, kRpc); return RESULT_ENCRYPTION_FAILED; } LOG4CXX_DEBUG(logger_, diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc index d7850e4df1..cb11eca887 100644 --- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc +++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc @@ -105,6 +105,7 @@ using ::testing::An; using ::testing::AnyOf; using ::testing::ByRef; using ::testing::DoAll; +using ::testing::SaveArg; using ::testing::Eq; using ::testing::_; using ::testing::Invoke; @@ -114,12 +115,14 @@ using ::testing::SetArgPointee; typedef std::vector<uint8_t> UCharDataVector; // custom action to call a member function with 6 arguments -ACTION_P8(InvokeMemberFuncWithArg6, ptr, memberFunc, a, b, c, d, e, f) { - (ptr->*memberFunc)(a, b, c, d, e, f); +ACTION_P4(InvokeMemberFuncWithArg2, ptr, memberFunc, a, b) { + (ptr->*memberFunc)(a, b); } namespace { const uint32_t kAsyncExpectationsTimeout = 10000u; +const uint32_t kMicrosecondsInMillisecond = 1000u; +const uint32_t kAddSessionWaitTimeMs = 100u; } class ProtocolHandlerImplTest : public ::testing::Test { @@ -145,6 +148,13 @@ class ProtocolHandlerImplTest : public ::testing::Test { .WillByDefault(Return(malformd_max_messages)); ON_CALL(protocol_handler_settings_mock, multiframe_waiting_timeout()) .WillByDefault(Return(multiframe_waiting_timeout)); +#ifdef ENABLE_SECURITY + ON_CALL(protocol_handler_settings_mock, force_protected_service()) + .WillByDefault(ReturnRefOfCopy(force_protected_services)); + ON_CALL(protocol_handler_settings_mock, force_unprotected_service()) + .WillByDefault(ReturnRefOfCopy(force_unprotected_services)); +#endif + protocol_handler_impl.reset( new ProtocolHandlerImpl(protocol_handler_settings_mock, session_observer_mock, @@ -189,6 +199,21 @@ class ProtocolHandlerImplTest : public ::testing::Test { connection_id); } + protocol_handler::SessionContext GetSessionContext( + const transport_manager::ConnectionUID connection_id, + const uint8_t initial_session_id, + const uint8_t new_session_id, + const protocol_handler::ServiceType service_type, + const uint32_t hash_id, + const bool protection_flag) { + return protocol_handler::SessionContext(connection_id, + initial_session_id, + new_session_id, + service_type, + hash_id, + protection_flag); + } + void AddSession(const ::utils::SharedPtr<TestAsyncWaiter>& waiter, uint32_t& times) { using namespace protocol_handler; @@ -206,6 +231,14 @@ class ProtocolHandlerImplTest : public ::testing::Test { const bool callback_protection_flag = PROTECTION_OFF; #endif // ENABLE_SECURITY + const protocol_handler::SessionContext context = + GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + callback_protection_flag); + // Expect ConnectionHandler check EXPECT_CALL(session_observer_mock, OnSessionStartedCallback(connection_id, @@ -215,16 +248,12 @@ class ProtocolHandlerImplTest : public ::testing::Test { An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll(NotifyTestAsyncWaiter(waiter), - InvokeMemberFuncWithArg6( - protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - callback_protection_flag, - ByRef(empty_rejected_param_)))); + WillOnce(DoAll( + NotifyTestAsyncWaiter(waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + context, + ByRef(empty_rejected_param_)))); times++; // Expect send Ack with PROTECTION_OFF (on no Security Manager) @@ -236,6 +265,8 @@ class ProtocolHandlerImplTest : public ::testing::Test { SendControlMessage( PROTECTION_ON, start_service, NEW_SESSION_ID, FRAME_DATA_START_SERVICE); + + usleep(kAddSessionWaitTimeMs * kMicrosecondsInMillisecond); } #ifdef ENABLE_SECURITY @@ -316,6 +347,8 @@ class ProtocolHandlerImplTest : public ::testing::Test { testing::NiceMock<security_manager_test::MockSecurityManager> security_manager_mock; testing::NiceMock<security_manager_test::MockSSLContext> ssl_context_mock; + std::vector<int> force_protected_services; + std::vector<int> force_unprotected_services; #endif // ENABLE_SECURITY std::vector<std::string> empty_rejected_param_; }; @@ -371,6 +404,7 @@ TEST_F(ProtocolHandlerImplTest, TestAsyncWaiter waiter; uint32_t times = 0; + ServiceType service_type; // Expect ConnectionHandler check EXPECT_CALL( session_observer_mock, @@ -382,16 +416,18 @@ TEST_F(ProtocolHandlerImplTest, .Times(call_times) . // Return sessions start rejection - WillRepeatedly(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - SESSION_START_REJECT, - HASH_ID_WRONG, - PROTECTION_OFF, - ByRef(empty_rejected_param_)))); + WillRepeatedly( + DoAll(NotifyTestAsyncWaiter(&waiter), + SaveArg<2>(&service_type), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + SESSION_START_REJECT, + service_type, + HASH_ID_WRONG, + PROTECTION_OFF), + ByRef(empty_rejected_param_)))); times += call_times; // Expect send NAck @@ -436,6 +472,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) { TestAsyncWaiter waiter; uint32_t times = 0; + ServiceType service_type; // Expect ConnectionHandler check EXPECT_CALL( session_observer_mock, @@ -449,13 +486,15 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) { // Return sessions start rejection WillRepeatedly(DoAll( NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - SESSION_START_REJECT, - HASH_ID_WRONG, - callback_protection_flag, + SaveArg<2>(&service_type), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + SESSION_START_REJECT, + service_type, + HASH_ID_WRONG, + callback_protection_flag), ByRef(empty_rejected_param_)))); times += call_times; @@ -501,16 +540,17 @@ TEST_F(ProtocolHandlerImplTest, An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_OFF, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_OFF), + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -614,7 +654,7 @@ TEST_F(ProtocolHandlerImplTest, start_service, PROTECTION_OFF, An<const BsonObject*>())) - // don't call NotifySessionStartedResult() immediately, instead call it + // don't call NotifySessionStartedContext() immediately, instead call it // after second OnSessionStartedCallback() .WillOnce(NotifyTestAsyncWaiter(&waiter)); times++; @@ -640,21 +680,23 @@ TEST_F(ProtocolHandlerImplTest, An<const BsonObject*>())) .WillOnce(DoAll( NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id2, - session_id2, - SESSION_START_REJECT, - HASH_ID_WRONG, - PROTECTION_OFF, + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id2, + session_id2, + SESSION_START_REJECT, + start_service, + HASH_ID_WRONG, + PROTECTION_OFF), ByRef(rejected_param_list)), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id1, - session_id1, - generated_session_id1, - HASH_ID_WRONG, - PROTECTION_OFF, + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id1, + session_id1, + generated_session_id1, + start_service, + HASH_ID_WRONG, + PROTECTION_OFF), ByRef(empty_rejected_param_)))); times++; @@ -802,10 +844,6 @@ TEST_F(ProtocolHandlerImplTest, EndSession_Success) { } #ifdef ENABLE_SECURITY -/* - * ProtocolHandler shall not call Security logics with Protocol version 1 - * Check session_observer with PROTECTION_OFF and Ack with PROTECTION_OFF - */ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) { using namespace protocol_handler; ::utils::SharedPtr<TestAsyncWaiter> waiter = @@ -826,16 +864,17 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) { An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_OFF, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_OFF), + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -881,16 +920,17 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) { An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_OFF, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_OFF), + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -917,6 +957,15 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) { TestAsyncWaiter waiter; uint32_t times = 0; + + protocol_handler::SessionContext context = GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_ON); + context.is_new_service_ = true; + // Expect ConnectionHandler check EXPECT_CALL(session_observer_mock, OnSessionStartedCallback(connection_id, @@ -926,16 +975,12 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) { An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_ON, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + context, + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -980,16 +1025,17 @@ TEST_F(ProtocolHandlerImplTest, An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_ON, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_ON), + ByRef(empty_rejected_param_)))); times++; SetProtocolVersion2(); @@ -1038,6 +1084,14 @@ TEST_F(ProtocolHandlerImplTest, TestAsyncWaiter waiter; uint32_t times = 0; + protocol_handler::SessionContext context = GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_ON); + context.is_new_service_ = true; + // Expect ConnectionHandler check EXPECT_CALL(session_observer_mock, OnSessionStartedCallback(connection_id, @@ -1047,24 +1101,20 @@ TEST_F(ProtocolHandlerImplTest, An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_ON, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + context, + ByRef(empty_rejected_param_)))); times++; std::vector<int> services; // TODO(AKutsan) : APPLINK-21398 use named constants instead of magic numbers services.push_back(0x0A); services.push_back(0x0B); - ON_CALL(protocol_handler_settings_mock, force_protected_service()) - .WillByDefault(ReturnRefOfCopy(services)); + EXPECT_CALL(protocol_handler_settings_mock, force_protected_service()) + .WillOnce(ReturnRefOfCopy(services)); // call new SSLContext creation EXPECT_CALL(security_manager_mock, CreateSSLContext(connection_key)) @@ -1093,13 +1143,6 @@ TEST_F(ProtocolHandlerImplTest, connection_key, security_manager::SSLContext::Handshake_Result_Fail))); - // Listener check SSLContext - EXPECT_CALL(session_observer_mock, - GetSSLContext(connection_key, start_service)) - . - // Emulate protection for service is not enabled - WillOnce(ReturnNull()); - // Expect send Ack with PROTECTION_OFF (on fail handshake) EXPECT_CALL(transport_manager_mock, SendMessageToDevice( @@ -1139,16 +1182,17 @@ TEST_F(ProtocolHandlerImplTest, An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_ON, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_ON), + ByRef(empty_rejected_param_)))); times++; // call new SSLContext creation @@ -1236,16 +1280,17 @@ TEST_F( An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_ON, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_ON), + ByRef(empty_rejected_param_)))); times++; // call new SSLContext creation @@ -1331,16 +1376,17 @@ TEST_F(ProtocolHandlerImplTest, An<const BsonObject*>())) . // Return sessions start success - WillOnce(DoAll( - NotifyTestAsyncWaiter(&waiter), - InvokeMemberFuncWithArg6(protocol_handler_impl.get(), - &ProtocolHandler::NotifySessionStartedResult, - connection_id, - NEW_SESSION_ID, - session_id, - HASH_ID_WRONG, - PROTECTION_ON, - ByRef(empty_rejected_param_)))); + WillOnce( + DoAll(NotifyTestAsyncWaiter(&waiter), + InvokeMemberFuncWithArg2(protocol_handler_impl.get(), + &ProtocolHandler::NotifySessionStarted, + GetSessionContext(connection_id, + NEW_SESSION_ID, + session_id, + start_service, + HASH_ID_WRONG, + PROTECTION_ON), + ByRef(empty_rejected_param_)))); times++; // call new SSLContext creation diff --git a/src/components/qt_hmi/CMakeLists.txt b/src/components/qt_hmi/CMakeLists.txt deleted file mode 100644 index ee30f2b468..0000000000 --- a/src/components/qt_hmi/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) 2014, Ford Motor Company -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following -# disclaimer in the documentation and/or other materials provided with the -# distribution. -# -# Neither the name of the Ford Motor Company nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -add_subdirectory(./qml_plugins) - -if (CMAKE_SYSTEM_NAME STREQUAL "QNX") - add_subdirectory(./qml_model_qt4) -else () - add_subdirectory(./qml_model_qt5) -endif () - -if(HMI STREQUAL "qt" AND BUILD_TESTS) - add_subdirectory(test) -endif()
\ No newline at end of file diff --git a/src/components/qt_hmi/Readme.txt b/src/components/qt_hmi/Readme.txt deleted file mode 100644 index 55e85db8ec..0000000000 --- a/src/components/qt_hmi/Readme.txt +++ /dev/null @@ -1,7 +0,0 @@ -How to view QML HMI. - -1) Run setup_env.sh from root folder of SDL project (this will install right version of Qt and CMake) -2) Run CMake with option HMI2=ON “cmake -DHMI2=ON <root_SDL_folder>” (this will build core+dbus adapter and QML HMI+ dbus adapter) -3) Run “<QT510_INSTALL_PATH>/qmlscene <root_SDL_folder>/src/components/qt_hmi/qml_model_qt5/MainWindow.qml” -4) Run SDL - diff --git a/src/components/qt_hmi/References/Look/.DS_Store b/src/components/qt_hmi/References/Look/.DS_Store Binary files differdeleted file mode 100644 index c84f3ca965..0000000000 --- a/src/components/qt_hmi/References/Look/.DS_Store +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-Lt.ttf b/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-Lt.ttf Binary files differdeleted file mode 100644 index 4ae24370af..0000000000 --- a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-Lt.ttf +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-LtCn.ttf b/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-LtCn.ttf Binary files differdeleted file mode 100644 index 2186efad6c..0000000000 --- a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-LtCn.ttf +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-ThCn.ttf b/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-ThCn.ttf Binary files differdeleted file mode 100644 index c0232d069d..0000000000 --- a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTCom-ThCn.ttf +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Bold.ttf b/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Bold.ttf Binary files differdeleted file mode 100644 index 8b82f0ae0c..0000000000 --- a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Bold.ttf +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Md.ttf b/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Md.ttf Binary files differdeleted file mode 100644 index 3595f70135..0000000000 --- a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Md.ttf +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Roman.ttf b/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Roman.ttf Binary files differdeleted file mode 100644 index 7be067d905..0000000000 --- a/src/components/qt_hmi/References/Look/Fonts/HelveticaNeueLTStd-Roman.ttf +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/ImageHardkey.qml b/src/components/qt_hmi/References/Look/ImageHardkey.qml deleted file mode 100644 index e39bb41605..0000000000 --- a/src/components/qt_hmi/References/Look/ImageHardkey.qml +++ /dev/null @@ -1,52 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FHardwareKey {
- width: 50
- height: 50
-
- property alias image : theImage.source
-
- Rectangle {
- anchors.fill: parent
- border.color: "black"
- border.width: 1
- radius: 10
- smooth: true
-
- gradient: Gradient {
- GradientStop {
- id: s1
- color: "#FF646464"
- position: 0.0
- }
- GradientStop {
- id: s2
- color: "#FF484848"
- position: 0.8
- }
- GradientStop {
- id: s3
- color: "#FF323232"
- position: 1.0
- }
- }
- }
-
- FWdgtImage {
- id: theImage
- //anchors.fill: parent
- anchors.centerIn: parent
- //fillMode: Image.PreserveAspectFit
- smooth: true
- }
-
-
- FViewUseCaseSimple {
- condition: pressed === true
- PropertyChanges { target: s1; position: 1.0 }
- PropertyChanges { target: s2; position: 0.2}
- PropertyChanges { target: s3; position: 0.0 }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/AlphaSortLayout.qml b/src/components/qt_hmi/References/Look/Layouts/AlphaSortLayout.qml deleted file mode 100644 index 3ee2761be9..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/AlphaSortLayout.qml +++ /dev/null @@ -1,378 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: alphaLayout
- width: 800
- height: 480
-
-
- property alias a: aBtn.touchBtn
- property alias b: bBtn.touchBtn
- property alias c: cBtn.touchBtn
- property alias d: dBtn.touchBtn
- property alias e: eBtn.touchBtn
- property alias f: fBtn.touchBtn
- property alias g: gBtn.touchBtn
- property alias h: hBtn.touchBtn
- property alias i: iBtn.touchBtn
- property alias j: jBtn.touchBtn
- property alias k: kBtn.touchBtn
- property alias l: lBtn.touchBtn
- property alias m: mBtn.touchBtn
- property alias n: nBtn.touchBtn
- property alias o: oBtn.touchBtn
- property alias p: pBtn.touchBtn
- property alias q: qBtn.touchBtn
- property alias r: rBtn.touchBtn
- property alias s: sBtn.touchBtn
- property alias t: tBtn.touchBtn
- property alias u: uBtn.touchBtn
- property alias v: vBtn.touchBtn
- property alias w: wBtn.touchBtn
- property alias xB: xBtn.touchBtn
- property alias yB: yBtn.touchBtn
- property alias zB: zBtn.touchBtn
- property alias num: numBtn.touchBtn
- property alias close: closeTouch
-
- property string phonEntry: ""
-
-// BaseText{
-// id: phoneEntry
-// x:25
-// y:115
-// text: phonEntry
-// theFont: "../Fonts/HelveticaNeueLTStd-Roman.ttf"
-// pxSize: 45
-// horAlignment: Text.AlignLeft
-// vertAlignment: Text.AlignTop
-// }
-
- TouchButtonClimatePCA{
- id: aBtn
- x:48
- y:131
- text: "A"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: jBtn
- x:48
- y:212
- text: "J"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: sBtn
- x:48
- y:293
- text: "S"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: bBtn
- x:129
- y:131
- text: "B"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: kBtn
- x:129
- y:212
- text: "K"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: tBtn
- x:129
- y:293
- text: "T"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: cBtn
- x:210
- y:131
- text: "C"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: lBtn
- x:210
- y:212
- text: "L"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: uBtn
- x:210
- y:293
- text: "U"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: dBtn
- x:291
- y:131
- text: "D"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: mBtn
- x:291
- y:212
- text: "M"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: vBtn
- x:291
- y:293
- text: "V"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: eBtn
- x:372
- y:131
- text: "E"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: nBtn
- x:372
- y:212
- text: "N"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: wBtn
- x:372
- y:293
- text: "W"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: fBtn
- x:453
- y:131
- text: "F"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: oBtn
- x:453
- y:212
- text: "O"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: xBtn
- x:453
- y:293
- text: "X"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: gBtn
- x:534
- y:131
- text: "G"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: pBtn
- x:534
- y:212
- text: "P"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: yBtn
- x:534
- y:293
- text: "Y"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: hBtn
- x:615
- y:131
- text: "H"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: qBtn
- x:615
- y:212
- text: "Q"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: zBtn
- x:615
- y:293
- text: "Z"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: iBtn
- x:696
- y:131
- text: "I"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: rBtn
- x:696
- y:212
- text: "R"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: numBtn
- x:696
- y:293
- text: "123"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- BaseText{
- id: closeTxt
- anchors.horizontalCenter: alphaLayout.horizontalCenter
- y:430
- horAlignment: Text.AlignHCenter
- vertAlignment: Text.AlignTop
- text: "CLOSE"
- color: "#1d81d5"
- pxSize: 22
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
-
- }
-
- FWdgtTouchArea{
- id: closeTouch
- height: 75
- width: 750
- y:430
- anchors.horizontalCenter: alphaLayout.horizontalCenter
- }
-
- FViewUseCase{condition: closeTouch.pressed === true
- //FActScriptCall { onScript: { FLogger.debug("Test color should change") } }
- PropertyChanges {
- target: closeTxt; color: "white"
- }
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/BlankLayout.qml b/src/components/qt_hmi/References/Look/Layouts/BlankLayout.qml deleted file mode 100644 index 2a1b2aa5f1..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/BlankLayout.qml +++ /dev/null @@ -1,9 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FLayout {
- width: 800
- height: 480
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/ChromeLayout.qml b/src/components/qt_hmi/References/Look/Layouts/ChromeLayout.qml deleted file mode 100644 index 14daa544b7..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/ChromeLayout.qml +++ /dev/null @@ -1,69 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: chromelayout
- width: 800
- height: 480
-
- property alias button1: button1
- property alias button2: button2
- property alias button3: button3
-
-
-
- FWdgtTouchArea {
- id: blockClockTouch
- anchors.top: chromelayout.top
- anchors.horizontalCenter: chromelayout.horizontalCenter
- height: 60
- width: 160
- }
-
- Rectangle{
- id: clockBackground
- anchors.fill: blockClockTouch
- color: "red"
- }
-
- BaseText{
- id: clock
- anchors.centerIn: blockClockTouch
- text: "clock"
- horAlignment: Text.AlignHCenter
- }
-
- TouchButton{
- id: button1
- anchors.top: blockClockTouch.top
- anchors.right: blockClockTouch.left
- anchors.rightMargin: -5
- height: blockClockTouch.height
- width: 75
- text: "Button 1"
- unpressedColor: "darkRed"
- }
-
- TouchButton{
- id: button2
- anchors.top: blockClockTouch.top
- anchors.left: blockClockTouch.right
- anchors.leftMargin: -5
- height:blockClockTouch.height
- width: 75
- text: "Button 2"
- unpressedColor:"darkRed"
- }
-
- TouchButton{
- id: button3
- anchors.bottom: chromelayout.bottom
- anchors.horizontalCenter: chromelayout.horizontalCenter
- height:blockClockTouch.height
- width: 225
- text: "Button 3"
- unpressedColor: "red"
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/ClimatePCALayout.qml b/src/components/qt_hmi/References/Look/Layouts/ClimatePCALayout.qml deleted file mode 100644 index 6b6a2761c5..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/ClimatePCALayout.qml +++ /dev/null @@ -1,111 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: climateLayout
- width: 800
- height: 480
-
- property alias dualBtn: dualBtn.touchBtn
- property alias drvHeatSeat: drvHeatSeat.touchBtn
- property alias drvCoolSeat: drvCoolSeat.touchBtn
- property alias passCoolSeat: passCoolSeat.touchBtn
- property alias passHeatSeat: passHeatSeat.touchBtn
- property alias heatWheel: heatWheel.touchBtn
- property alias heatWinSheild: heatWinSheild.touchBtn
- property alias defrost: defrost.touchBtn
- property alias pannel: pannel.touchBtn
- property alias floor: floor.touchBtn
-
- property alias dualBtnSt: dualBtn.selected
- property alias drvHeatSeatSt: drvHeatSeat.selected
- property alias drvCoolSeatSt: drvCoolSeat.selected
- property alias passCoolSeatSt: passCoolSeat.selected
- property alias passHeatSeatSt: passHeatSeat.selected
- property alias heatWheelSt: heatWheel.selected
- property alias heatWinSheildSt: heatWinSheild.selected
- property alias defrostSt: defrost.selected
- property alias pannelSt: pannel.selected
- property alias floorSt: floor.selected
-
-
-
- TouchButtonClimatePCA{
- id: drvHeatSeat
- x:105
- y:178
- bitmap: "climate/heated seat icon.png"
- bitmap2: "climate/heated seat iconBlack.png"
- }
- TouchButtonClimatePCA{
- id: drvCoolSeat
- x:105
- y:273
- bitmap: "climate/A_C icon.png"
- bitmap2: "climate/A_C iconBlack.png"
- }
- TouchButtonClimatePCA{
- id: heatWheel
- x:200
- y:178
- bitmap: "climate/wheel icon.png"
- bitmap2: "climate/wheel iconBlack.png"
- }
- TouchButtonClimatePCA{
- id: heatWinSheild
- x:200
- y:273
- bitmap: "climate/headed dashBlue.png"
- bitmap2: "climate/headed dash.png"
- }
-
- TouchButtonClimatePCA{
- id: defrost
- x:360
- y:130
- bitmap: "climate/defrost iconBlue.png"
- bitmap2: "climate/defrost icon.png"
- }
-
- TouchButtonClimatePCA{
- id: pannel
- x:360
- y:226
- bitmap: "climate/face icon.png"
- bitmap2: "climate/face iconBlack.png"
- }
-
- TouchButtonClimatePCA{
- id: floor
- x:360
- y:322
- bitmap: "climate/feet icon.png"
- bitmap2: "climate/feet iconBlack.png"
- }
-
-
- TouchButtonClimatePCA{
- id: dualBtn
- y:225
- x:528
- text: "Dual"
- }
-
- TouchButtonClimatePCA{
- id: passHeatSeat
- x:615
- y:178
- bitmap: "climate/heated seat icon.png"
- bitmap2: "climate/heated seat iconBlack.png"
- }
- TouchButtonClimatePCA{
- id: passCoolSeat
- x:615
- y:273
- bitmap: "climate/A_C icon.png"
- bitmap2: "climate/A_C iconBlack.png"
- }
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/ControlMirrorLayout.qml b/src/components/qt_hmi/References/Look/Layouts/ControlMirrorLayout.qml deleted file mode 100644 index 0abc7db4b7..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/ControlMirrorLayout.qml +++ /dev/null @@ -1,57 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: alphaLayout
- width: 800
- height: 480
-
-
- Item {
- id: _fg
-
- width: 800; height: 480
- x:0
- y:0
-
- FWdgtTouchArea{
- id: blockTouch
- x:0
- y:0
- height: 480
- width: 800
- }
-
- Rectangle{
- anchors.fill: blockTouch
- color: "black"
- opacity: 0.8
- }
-
- FWdgtImage{
- id: popupBg
- anchors.centerIn: blockTouch
- bitmap: "climate/ring.png"
- }
-
- BaseText{
- id:curTemp
- anchors.centerIn: popupBg
- text: dataPool.drvTemp + "\xBA"
- pxSize: 96
- }
-
- BaseText{
- id:drvPass
- anchors.horizontalCenter: popupBg.horizontalCenter
- anchors.bottom: curTemp.top
- horAlignment: Text.AlignHCenter
- text: "Driver"
- pxSize: 28
- }
-
- }
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/FMLayout.qml b/src/components/qt_hmi/References/Look/Layouts/FMLayout.qml deleted file mode 100644 index 8057ff2e7e..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/FMLayout.qml +++ /dev/null @@ -1,217 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: fmLayout
- width: 800
- height: 480
-
- property alias sourceBtn: sourceBtn
- property alias browseBtn: browseBtn
- property alias albumInfoBtn: albumInfoBtn
- property alias albumInfoImg: stationLogoImg
- property alias stationTxt: stationTxt
- property alias trackTxt: trackTxt
- property alias artistTxt: artistTxt
- property alias alertBtn: alertBtn
- property alias preset1Btn: preset1Btn
- property alias preset2Btn: preset2Btn
- property alias preset3Btn: preset3Btn
- property alias preset4Btn: preset4Btn
- property alias preset5Btn: preset5Btn
- property alias preset6Btn: preset6Btn
- property alias replayBtn: replayBtn
- property alias tuneBtn: tuneBtn
- property alias presetsBtn: presetsBtn
- property bool artShown: true
-
-
- TouchButton{
- id: sourceBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 140
- anchors.left: fmLayout.left
- anchors.leftMargin: 10
- height:25
- width: 130
- text: "Source"
- }
-
- TouchButton{
- id: browseBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 180
- anchors.left: fmLayout.left
- anchors.leftMargin: 10
- height:25
- width: 130
- text: "Browse"
- }
-
- TouchButton{
- id: albumInfoBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 95
- anchors.left: fmLayout.left
- anchors.leftMargin: 190
- height:130
- width: 130
- text: "Album"
- vis: false
-
- }
-
- FWdgtImage{
- id: stationLogoImg
- anchors.top: fmLayout.top
- anchors.topMargin: 95
- anchors.left: fmLayout.left
- anchors.leftMargin: 190
- height:70
- width: 130
- bitmap: ""
- }
-
- TouchButton{
- id: alertBtn
- anchors.top: albumInfoImg.bottom
- anchors.topMargin: 20
- anchors.left: albumInfoImg.left
- height:25
- width: 90
- text: "Alert"
- }
-
- BaseText{
- id: stationTxt
- anchors.verticalCenter: trackTxt.verticalCenter
- anchors.verticalCenterOffset: -45
- anchors.left: trackTxt.left
- text: "Ch 22 / Pearl Jam Radio"
- }
-
- BaseText{
- id: trackTxt
- anchors.verticalCenter: albumInfoBtn.verticalCenter
- anchors.left: albumInfoBtn.right
- anchors.leftMargin: 15
- pxSize: 34
- text: "State of Love ..."
-
- }
-
- BaseText{
- id: artistTxt
- anchors.verticalCenter: trackTxt.verticalCenter
- anchors.verticalCenterOffset: 45
- anchors.left: trackTxt.left
- text: "Pearl Jam"
- }
-
- TouchButton{
- id: preset1Btn
- anchors.top: fmLayout.top
- anchors.topMargin: 280
- anchors.left: browseBtn.left
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset2Btn
- anchors.top: preset1Btn.bottom
- anchors.left: preset1Btn.left
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset3Btn
- anchors.top: preset1Btn.top
- anchors.left: preset1Btn.right
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset4Btn
- anchors.top: preset2Btn.top
- anchors.left: preset2Btn.right
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset5Btn
- anchors.top: preset3Btn.top
- anchors.left: preset3Btn.right
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset6Btn
- anchors.top: preset4Btn.top
- anchors.left: preset4Btn.right
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: replayBtn
- anchors.verticalCenter: browseBtn.verticalCenter
- anchors.verticalCenterOffset: 35
- anchors.left: fmLayout.left
- anchors.leftMargin: 725
- height:40
- width: 55
- text: "rply"
- }
-
- TouchButton{
- id: tuneBtn
- anchors.top: preset1Btn.top
- anchors.right: replayBtn.right
- height:40
- width: 120
- text: "tune"
- }
-
- TouchButton{
- id: presetsBtn
- anchors.bottom: preset6Btn.bottom
- anchors.right: replayBtn.right
- height:60
- width: 120
- text: "presets"
- }
-
- FViewUseCaseGroup{
- FViewUseCase{
- condition: dataPool.hasArt === 0
- PropertyChanges { target: albumInfoBtn; vis: false;}
- PropertyChanges { target: albumInfoImg; visible: false;}
- PropertyChanges { target: trackTxt; anchors.left: albumInfoBtn.left;}
- PropertyChanges { target: alertBtn; vis: false;}
- }
- FViewUseCase{
- condition: dataPool.hasArt === 1
- PropertyChanges { target: albumInfoBtn; vis: false;}
- PropertyChanges { target: albumInfoImg; visible: false;}
- PropertyChanges { target: trackTxt; anchors.left: albumInfoBtn.left;}
- PropertyChanges { target: alertBtn; vis: false;}
- }
- FViewUseCase{
- condition: dataPool.hasArt === 2
- PropertyChanges { target: albumInfoImg; visible: true;}
- PropertyChanges { target: albumInfoBtn; vis: true;}
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/FMLayoutPCA.qml b/src/components/qt_hmi/References/Look/Layouts/FMLayoutPCA.qml deleted file mode 100644 index fd211b3c97..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/FMLayoutPCA.qml +++ /dev/null @@ -1,152 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: fmLayout
- width: 800
- height: 480
-
- property alias sourceBtn: sourceBtn
- property alias tuneBtn: tuneBtn
- property alias hdBtn: hdBtn
- property alias stationTxt: stationTxt.text
- property alias freqId: freqId.text
- property alias listModel: thePresets.listModel
- property alias artist: artistTxt.text
- property alias curHD: hdBtn.curHD
- property alias totHD: hdBtn.totHD
- property alias curPreset: thePresets.currPreset
- property alias moving: thePresets.moving
- property alias direction: thePresets.direction
- property bool page1: true
-
-
-
-
-
- FWdgtImage{
- bitmap: "Radio/Ford-HMI-PCA-audio_fm_sirius.png"
- visible: false
- }
-
- TouchButton_PCA{
- id: sourceBtn
- x:25
- y:80
- textWidth: 100
- text: "FM Radio"
-
- }
-
- TouchButton_PCA{
- id: tuneBtn
- anchors.right: fmLayout.right
- anchors.rightMargin: 25
- y:80
- textWidth: 55
- text: "Tune"
-
- }
-
- BaseText{
- id: stationTxt
- x:25
- y:155
- pxSize: 45
- text: "96.3"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTCom-Lt.ttf"
-
- }
-
- BaseText{
- id: freqId
- anchors.left: stationTxt.right
- anchors.leftMargin: 5
- anchors.bottom: stationTxt.bottom
- anchors.bottomMargin: 4
- text: "FM"
- color: "#1d81d5"
- pxSize: 22
- theFont: "../Fonts/HelveticaNeueLTCom-Lt.ttf"
-
- }
-
- BaseText{
- id: trackTxt
- x:25
- y:212
- text: "So Far Around The Bend"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- pxSize: 22
-
-
- }
-
- BaseText{
- id: artistTxt
- x:25
- y:240
- text: "The National"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- pxSize: 22
- }
-
- TouchButtonSpecial_PCA{
- id: hdBtn
- x:25
- y:288
- textWidth: 120
- bitmap: "Radio/HD Logo.png"
- bitmap2: "Radio/HD Logo1.png"
- imageShift: -9
- spacing: 0
- text: " 1 "
- text1: "2"
- text2: " 3 4"
-
- }
-
- Rectangle{
- x:25
- y: 365
- height:1
- width: 750
- color: "#1d81d5"
- }
-
-
- PresetsGridPCA{
- id: thePresets
- x:0
- y:365
-
- }
-
- FWdgtImage{
- id: swipeIcon1
- bitmap: "Radio/whiteBall.png"
- x: 389
- y: 381
- }
-
- FWdgtImage{
- id: swipeIcon2
- bitmap: "Radio/blueBall.png"
- x: 404
- y: 381
- }
-
- FViewUseCaseSimple{condition: fmLayout.page1===false
- PropertyChanges{
- target: swipeIcon2; bitmap: "Radio/whiteBall.png"
- }
- PropertyChanges{
- target: swipeIcon1; bitmap: "Radio/blueBall.png"
- }
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/HomeLayout.qml b/src/components/qt_hmi/References/Look/Layouts/HomeLayout.qml deleted file mode 100644 index 375f96894a..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/HomeLayout.qml +++ /dev/null @@ -1,61 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: home
- width: 800
- height: 480
-
- property alias button1: button1
- property alias button2: button2
- property alias button3: button3
- property alias button4: button4
-
-
-
-
- TouchButton{
- id: button1
- anchors.top: home.top
- anchors.left: home.left
- height:235
- width: 395
- text: "Button 1"
- }
-
- TouchButton{
- id: button2
- anchors.top: home.top
- anchors.right: home.right
- height:235
- width: 395
- text: "Button 2"
- }
-
- TouchButton{
- id: button3
- anchors.bottom: home.bottom
- anchors.left: home.left
- height:235
- width: 395
- text: "Button 3"
- }
-
- TouchButton{
- id: button4
- anchors.bottom: home.bottom
- anchors.right: home.right
- height:235
- width: 395
- text: "Button 4"
- }
-
- BaseText{
- id: title
- anchors.centerIn: home
- text: "Home"
- }
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/ListLayout.qml b/src/components/qt_hmi/References/Look/Layouts/ListLayout.qml deleted file mode 100644 index 326d4feb0b..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/ListLayout.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-
-FLayout {
-
- id: theLayout
- width: 800
- height: 480
- x:10
- y:10
- property alias list : theListView
- property alias list_itemWidget: theListView.itemWidget
- property alias list_data: theListView.data
- Rectangle{
- anchors.fill:parent
- color:"white"
-
- }
-
-
- FWdgtListView {
-
- id: theListView
- anchors.fill: parent
- clip: true
-
- }
- FWdgtListView {
- x:400
- id: filteredListView
- clip: true
- data:filtermodel
- itemWidget:list_itemWidget
- width:100
- height:400
- }
- TextInput{
- text:"HelloWorld"
- x:200
- y:20
- onTextChanged: {
-
- if(text.length > 0 ) {
- dataPool.filter = text
- console.log(dataPool.filter)
-
- sortList.fillFilterModel(theListView.data)//Just backup original
- sortList.updateFilterModel(text)
-
- } else {
- sortList.fillFilterModel(theListView.data)
- }
- }
-
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/NavInRouteLayout.qml b/src/components/qt_hmi/References/Look/Layouts/NavInRouteLayout.qml deleted file mode 100644 index d0f240f4b9..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/NavInRouteLayout.qml +++ /dev/null @@ -1,130 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: mapLayout
- width: 800
- height: 480
-
- property alias zoomIn: zoomIn.touchBtn
- property alias zoomOut: zoomOut.touchBtn
- property alias compass: compass.touchBtn
- property alias cancel: cancel.touchBtn
- property alias mute: mute.touchBtn
- property alias muteSt: mute.selected
- property alias options: options.touchBtn
-
-
-
- FWdgtImage{
- id: mapImg
- bitmap: "Nav/Map.png"
- anchors.fill: mapLayout
- }
-
- TouchButtonClimatePCA{
- id: zoomIn
- text: "+"
- x:25
- y:103
- image: "buttons/zoom_9_9.png"
- imageActive: "buttons/zoomSelected.png"
- imagePressed: "buttons/zoomPressed_9_9.png"
- txtColor: "white"
- txtSize: 40
-
- }
- TouchButtonClimatePCA{
- id: zoomOut
- text: "-"
- x:25
- y:223
- image: "buttons/zoom_9_9.png"
- imageActive: "buttons/zoomSelected.png"
- imagePressed: "buttons/zoomPressed_9_9.png"
- txtColor: "white"
- txtSize: 40
- }
- TouchButtonClimatePCA{
- id: options
- x:659
- y:80
- image: "Nav/Options_9_9.png"
- imageActive: "Nav/OptionsInActive.png"
- imagePressed: "Nav/OptionsPressed_9_9.png"
- }
- TouchButtonClimatePCA{
- id: compass
- x:34
- y:352
- image: "Nav/compass.png"
- imageActive: "Nav/compass.png"
- imagePressed: "Nav/compass.png"
- }
- TouchButtonClimatePCA{
- id: mute
- x:25
- y:419
- image: "buttons/mute_9_9.png"
- imageActive: "buttons/muteActive.png"
- imagePressed: "buttons/mutePressed_9_9.png"
- imageInActive: "buttons/muteInActive.png"
- }
- FWdgtImage{
- bitmap: "Nav/turnArrow.png"
- x:97
- y:428
- }
- BaseText{
- text: "0.2 mi on Cherry Hill Rd."
- pxSize: 22
- x:144
- y:434
- color: "white"
- }
-
- BaseText{
- text: "2 hrs 27 min"
- pxSize: 22
- anchors.right: cancel.left
- anchors.rightMargin: 26
- horAlignment: Text.AlignRight
- y:434
- color: "white"
- }
-
- TouchButtonSpecial_PCA{
- id: cancel
- x:621
- y:419
- textWidth: 110
- bitmap: "Nav/destIcon.png"
- bitmap2: "Nav/destIconBlack.png"
- imageShift: -9
- spacing: 0
- text: " Cancel"
- text1: ""
- text2: ""
- totHD: -1
-
- }
- FWdgtImage{
- id: currStBkgrnd
- bitmap: "Nav/current street.png"
- x:265
- y:349
- }
-
- BaseText{
- id: currentStreet
- x:312
- y:360
- text: "East Capital St. NE"
- pxSize: 18
- theFont: "../Fonts/HelveticaNeueLTCom-Lt.ttf"
- horAlignment: Text.AlignLeft
- vertAlignment: Text.AlignTop
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/NavKeyboardLayout.qml b/src/components/qt_hmi/References/Look/Layouts/NavKeyboardLayout.qml deleted file mode 100644 index 6c7a031175..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/NavKeyboardLayout.qml +++ /dev/null @@ -1,547 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: alphaLayout
- width: 800
- height: 480
- property alias list : theListView
- property alias list_itemWidget: theListView.itemWidget
- property alias list_data: theListView.data
-
- property alias a: aBtn.touchBtn
- property alias b: bBtn.touchBtn
- property alias c: cBtn.touchBtn
- property alias d: dBtn.touchBtn
- property alias e: eBtn.touchBtn
- property alias f: fBtn.touchBtn
- property alias g: gBtn.touchBtn
- property alias h: hBtn.touchBtn
- property alias i: iBtn.touchBtn
- property alias j: jBtn.touchBtn
- property alias k: kBtn.touchBtn
- property alias l: lBtn.touchBtn
- property alias m: mBtn.touchBtn
- property alias n: nBtn.touchBtn
- property alias o: oBtn.touchBtn
- property alias p: pBtn.touchBtn
- property alias q: qBtn.touchBtn
- property alias r: rBtn.touchBtn
- property alias s: sBtn.touchBtn
- property alias t: tBtn.touchBtn
- property alias u: uBtn.touchBtn
- property alias v: vBtn.touchBtn
- property alias w: wBtn.touchBtn
- property alias xB: xBtn.touchBtn
- property alias yB: yBtn.touchBtn
- property alias zB: zBtn.touchBtn
- property alias num: numBtn.touchBtn
- property alias sym: symBtn.touchBtn
- property alias del: delBtn.touchBtn
- property alias clr: clrBtn.touchBtn
- property alias space: spaceBtn.touchBtn
- property alias close: closeTouch
- property string entry: ""
- property alias go: goBtn.touchBtn
- property alias listOpen: listOpen
-
- FWdgtListView {
- id: theListView
- anchors.fill: parent
- clip: true
- visible:false
- }
-
- FWdgtListView {
- x:400
- id: filteredListView
- clip: true
- data:filtermodel
- itemWidget:list_itemWidget
- width:100
- height:400
- visible: true
- }
- TextInput{ //Little Trick for Update on List
- text:dataPool.navEnrty
- x:200
- y:20
- onTextChanged: {
-
- if(text.length > 0 ) {
- dataPool.filter = text
- console.log(dataPool.filter)
- sortList.fillFilterModel(theListView.data)//Just backup original
- sortList.updateFilterModel(text)
-
- } else {
- sortList.fillFilterModel(theListView.data)
- dataPool.navList1stItem=""
-
- }
-
-
- }
-
- }
- BaseText{
- id: navEntry
- x:25
- y:65
- text: entry
- theFont: "../Fonts/HelveticaNeueLTStd-Roman.ttf"
- pxSize: 45
- color: "#1d81d5"
- horAlignment: Text.AlignLeft
- vertAlignment: Text.AlignTop
- }
- BaseText{
- id: listFiltEntry
- x:25
- y:130
- color:"#1d81d5"
- text:dataPool.navList1stItem
- theFont: "../Fonts/HelveticaNeueLTStd-Roman.ttf"
- pxSize: 45
- horAlignment: Text.AlignLeft
- vertAlignment: Text.AlignTop
- }
- Rectangle{
- id:rect
- x:20
- y:120
- height: 60
- radius:10
- width:650
- color:"transparent"
- border.color: "#1d81d5"
- border.width: 1
- visible: false
- }
-
- FWdgtTouchArea{
- id: listOpen
- anchors.fill: rect
- enabled: rect.visible
- }
-
- TouchButton_PCA{
- id: goBtn
- x:690
- y:115
- textWidth: 40
- text: "Go"
-
- }
-
-
- TouchButtonClimatePCA{
- id: qBtn
- x:61
- y:211
- text: "Q"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: wBtn
- x:130
- y:211
- text: "W"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: eBtn
- x:199
- y:211
- text: "E"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: rBtn
- x:268
- y:211
- text: "R"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: tBtn
- x:337
- y:211
- text: "T"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: yBtn
- x:406
- y:211
- text: "Y"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: uBtn
- x:475
- y:211
- text: "U"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: iBtn
- x:544
- y:211
- text: "I"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: oBtn
- x:613
- y:211
- text: "O"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: pBtn
- x:682
- y:211
- text: "P"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: numBtn
- x:27
- y:272
- text: "123"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 22
- }
-
- TouchButtonClimatePCA{
- id: aBtn
- x:96
- y:272
- text: "A"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: sBtn
- x:165
- y:272
- text: "S"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: dBtn
- x:234
- y:272
- text: "D"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: fBtn
- x:303
- y:272
- text: "F"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: gBtn
- x:372
- y:272
- text: "G"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: hBtn
- x:441
- y:272
- text: "H"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: jBtn
- x:510
- y:272
- text: "J"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: kBtn
- x:579
- y:272
- text: "K"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: lBtn
- x:648
- y:272
- text: "L"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: delBtn
- x:717
- y:272
- bitmap: "Nav/deleteIcon.png"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- }
-
- TouchButtonClimatePCA{
- id: symBtn
- x:61
- y:333
- text: "!@#"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 22
- }
-
- TouchButtonClimatePCA{
- id: zBtn
- x:130
- y:333
- text: "Z"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: xBtn
- x:199
- y:333
- text: "X"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: cBtn
- x:268
- y:333
- text: "C"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: vBtn
- x:337
- y:333
- text: "V"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: bBtn
- x:406
- y:333
- text: "B"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: nBtn
- x:475
- y:333
- text: "N"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: mBtn
- x:544
- y:333
- text: "M"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- txtSize: 30
- }
-
- TouchButtonClimatePCA{
- id: clrBtn
- x:613
- y:333
- text: "Clear"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- newFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- txtSize: 16
- }
-
- TouchButtonClimatePCA{
- id: spaceBtn
- x:682
- y:333
- text: "Space"
- image: "buttons/key_9_9.png"
- imagePressed: "buttons/keyPressed_9_9.png"
- imageActive: "buttons/keySelected.png"
- imageInActive: "buttons/keySelected.png"
- newFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- txtSize: 16
- }
-
- BaseText{
- id: closeTxt
- anchors.horizontalCenter: alphaLayout.horizontalCenter
- y:430
- horAlignment: Text.AlignHCenter
- vertAlignment: Text.AlignTop
- text: "CLOSE"
- color: "#1d81d5"
- pxSize: 22
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
-
- }
-
- FWdgtTouchArea{
- id: closeTouch
- height: 75
- width: 750
- y:430
- anchors.horizontalCenter: alphaLayout.horizontalCenter
- }
-
- FViewUseCase{condition: closeTouch.pressed === true
- //FActScriptCall { onScript: { FLogger.debug("Test color should change") } }
- PropertyChanges {
- target: closeTxt; color: "white"
- }
- }
-
- FViewUseCaseSimple{condition: listFiltEntry.text !== ""
- PropertyChanges {
- target: rect; visible: true
- }
- }
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/NavNoRouteLayout.qml b/src/components/qt_hmi/References/Look/Layouts/NavNoRouteLayout.qml deleted file mode 100644 index 7c65e911a7..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/NavNoRouteLayout.qml +++ /dev/null @@ -1,78 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: mapLayout
- width: 800
- height: 480
-
- property alias zoomIn: zoomIn.touchBtn
- property alias zoomOut: zoomOut.touchBtn
- property alias compass: compass.touchBtn
- property alias destSearch: destSearch.touchBtn
- property alias options: options.touchBtn
-
-
-
- FWdgtImage{
- id: mapImg
- bitmap: "Nav/Map.png"
- anchors.fill: mapLayout
- }
-
- TouchButtonClimatePCA{
- id: zoomIn
- text: "+"
- x:25
- y:103
- image: "buttons/zoom_9_9.png"
- imageActive: "buttons/zoomSelected.png"
- imagePressed: "buttons/zoomPressed_9_9.png"
- txtColor: "white"
- txtSize: 40
-
- }
- TouchButtonClimatePCA{
- id: zoomOut
- text: "-"
- x:25
- y:223
- image: "buttons/zoom_9_9.png"
- imageActive: "buttons/zoomSelected.png"
- imagePressed: "buttons/zoomPressed_9_9.png"
- txtColor: "white"
- txtSize: 40
- }
- TouchButtonClimatePCA{
- id: options
- x:659
- y:80
- image: "Nav/Options_9_9.png"
- imageActive: "Nav/OptionsInActive.png"
- imagePressed: "Nav/OptionsPressed_9_9.png"
- }
- TouchButtonClimatePCA{
- id: compass
- x:34
- y:352
- image: "Nav/compass.png"
- imageActive: "Nav/compass.png"
- imagePressed: "Nav/compass.png"
- }
- TouchButtonSpecial_PCA{
- id: destSearch
- x:601
- y:419
- textWidth: 130
- bitmap: "Nav/destIcon.png"
- bitmap2: "Nav/destIconBlack.png"
- imageShift: -9
- spacing: 0
- text: " Destination"
- text1: ""
- text2: ""
- totHD: -1
-
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/OffLayout.qml b/src/components/qt_hmi/References/Look/Layouts/OffLayout.qml deleted file mode 100644 index f5cc5d57a6..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/OffLayout.qml +++ /dev/null @@ -1,71 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FLayout {
- width: 800
- height: 480
-
- property alias offTouch: offTouch
-
- Rectangle {
- id: bk
- anchors.fill: parent
- color: "black"
- }
-
- FWdgtTouchArea{
- id: offTouch
- anchors.fill: bk
- }
-
-/* RectangularGlow {
- id: effect
- anchors.fill: rect
- glowRadius: 4
- spread: 0.7
- color: "#1d81d5"
- cornerRadius: rect.radius //+ glowRadius
- }
-
- Rectangle {
- id: rect
- color: "black"
- x:40
- y:40
- width: 160
- height: 45
- radius: 23
- border.width: 1
- border.color: "#1d81d5"
- }
-
- FWdgtImage{
- id: img
- x:40
- y:90
- bitmap: "OButton.png"
- }
-
- FWdgtImage{
- id: img
- x:40
- y:40
- bitmap: "Radio/ButtonEnd_8_8.png"
- }
-
- FWdgtImage{
- id: img1
- anchors.left: img.right
- anchors.top: img.top
- width:2
- fillMode: Image.Stretch
- bitmap: "Radio/ButtonCenter_0_8.png"
- }
-
- FWdgtImage{
- id: img2
- anchors.left: img1.right
- anchors.top: img1.top
- bitmap: "Radio/ButtonOtherEnd_8_8.png"
- }*/
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/PCAstatusBarLayout.qml b/src/components/qt_hmi/References/Look/Layouts/PCAstatusBarLayout.qml deleted file mode 100644 index 1236ea4201..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/PCAstatusBarLayout.qml +++ /dev/null @@ -1,123 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: statusLayout
- width: 800
- height: 480
-
- property alias menuTouch: menuTouch
-
- Rectangle{
- id: ln1
- anchors.horizontalCenter: statusLayout.horizontalCenter
- y:15
- height:1
- width: 14
- color: "#1d81d5"
- }
- Rectangle{
- id: ln2
- anchors.horizontalCenter: statusLayout.horizontalCenter
- y:19
- height:1
- width: 14
- color: "#1d81d5"
- }
- Rectangle{
- id: ln3
- anchors.horizontalCenter: statusLayout.horizontalCenter
- y:23
- height:1
- width: 14
- color: "#1d81d5"
- }
-
-
-
- BaseText{
- id: menuTxt
- anchors.horizontalCenter: statusLayout.horizontalCenter
- anchors.bottom: statusLayout.top
- anchors.bottomMargin: -50
- horAlignment: Text.AlignHCenter
- vertAlignment: Text.AlignBottom
- text: "MENU"
- color: "#1d81d5"
- pxSize: 22
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
-
- }
-
- BaseText{
- id: tempTxt
- x:25
- anchors.bottom: statusLayout.top
- anchors.bottomMargin: -50
- horAlignment: Text.AlignLeft
- vertAlignment: Text.AlignBottom
- text: "75" + "\xBA"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTStd-Roman.ttf"
- pxSize: 28
-
-
- }
-
- BaseText{
- id: clockTxt
- anchors.right: statusLayout.right
- anchors.rightMargin: 25
- anchors.bottom: statusLayout.top
- anchors.bottomMargin: -50
- horAlignment: Text.AlignRight
- vertAlignment: Text.AlignBottom
- text: "12:45"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTStd-Roman.ttf"
- pxSize: 28
- }
-
- FWdgtTouchArea{
- id: menuTouch
- height: 75
- width: 80
- y:0
- anchors.horizontalCenter: statusLayout.horizontalCenter
- }
-
- FViewUseCase{condition: menuTouch.pressed === true
- //FActScriptCall { onScript: { FLogger.debug("Test color should change") } }
- PropertyChanges {
- target: ln1; color: "white"
- }
- PropertyChanges {
- target: ln2; color: "white"
- }
- PropertyChanges {
- target: ln3; color: "white"
- }
- PropertyChanges {
- target: menuTxt; color: "white"
- }
- }
-
- FViewUseCase{
- condition: dataPool.mainPCAmenuShown ===true
- PropertyChanges {
- target: ln1; visible: false
- }
- PropertyChanges {
- target: ln2; visible: false
- }
- PropertyChanges {
- target: ln3; visible: false
- }
- PropertyChanges {
- target: menuTxt; visible: false
- }
- }
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/PhoneContactsLayout.qml b/src/components/qt_hmi/References/Look/Layouts/PhoneContactsLayout.qml deleted file mode 100644 index 9e119d9900..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/PhoneContactsLayout.qml +++ /dev/null @@ -1,40 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-
-FLayout {
-
- id: theLayout
- width: 800
- height: 480
-
- property alias list : theListPhoneView
- property alias list_itemWidget: theListPhoneView.itemWidget
- property alias list_data: theListPhoneView.data
- property alias back: back.touchBtn
- TouchButtonClimatePCA{
- id: back
- text: "+"
- x:25
- y:80
- image: "buttons/zoom_9_9.png"
- imageActive: "buttons/zoomSelected.png"
- imagePressed: "buttons/zoomPressed_9_9.png"
- txtColor: "white"
- txtSize: 40
- visible: false
-
- }
- FWdgtListView {
-
- width:600
- height:400
- id: theListPhoneView
- x:150
- y:80
- clip: true
- visible:true
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/SiriusLayout.qml b/src/components/qt_hmi/References/Look/Layouts/SiriusLayout.qml deleted file mode 100644 index e275c055a7..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/SiriusLayout.qml +++ /dev/null @@ -1,195 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: fmLayout
- width: 800
- height: 480
-
- property alias sourceBtn: sourceBtn
- property alias browseBtn: browseBtn
- property alias albumInfoBtn: albumInfoBtn
- property alias albumInfoImg: stationLogoImg
- property alias stationTxt: stationTxt
- property alias trackTxt: trackTxt
- property alias artistTxt: artistTxt
- property alias alertBtn: alertBtn
- property alias preset1Btn: preset1Btn
- property alias preset2Btn: preset2Btn
- property alias preset3Btn: preset3Btn
- property alias preset4Btn: preset4Btn
- property alias preset5Btn: preset5Btn
- property alias preset6Btn: preset6Btn
- property alias replayBtn: replayBtn
- property alias tuneBtn: tuneBtn
- property alias presetsBtn: presetsBtn
-
-
- TouchButton{
- id: sourceBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 140
- anchors.left: fmLayout.left
- anchors.leftMargin: 10
- height:25
- width: 130
- text: "Source"
- }
-
- TouchButton{
- id: browseBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 180
- anchors.left: fmLayout.left
- anchors.leftMargin: 10
- height:25
- width: 130
- text: "Browse"
- }
-
- TouchButton{
- id: albumInfoBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 95
- anchors.left: fmLayout.left
- anchors.leftMargin: 190
- height:130
- width: 130
- text: "Album"
- vis: false
-
- }
-
- FWdgtImage{
- id: stationLogoImg
- anchors.top: fmLayout.top
- anchors.topMargin: 95
- anchors.left: fmLayout.left
- anchors.leftMargin: 190
- height:70
- width: 130
- bitmap: ""
- }
-
- TouchButton{
- id: alertBtn
- anchors.top: albumInfoImg.bottom
- anchors.topMargin: 20
- anchors.left: albumInfoImg.left
- height:25
- width: 90
- text: "Alert"
- }
-
- BaseText{
- id: stationTxt
- anchors.verticalCenter: trackTxt.verticalCenter
- anchors.verticalCenterOffset: -45
- anchors.left: trackTxt.left
- text: "Ch 22 / Pearl Jam Radio"
- }
-
- BaseText{
- id: trackTxt
- anchors.verticalCenter: albumInfoBtn.verticalCenter
- anchors.left: albumInfoBtn.right
- anchors.leftMargin: 15
- pxSize: 34
- text: "State of Love ..."
-
- }
-
- BaseText{
- id: artistTxt
- anchors.verticalCenter: trackTxt.verticalCenter
- anchors.verticalCenterOffset: 45
- anchors.left: trackTxt.left
- text: "Pearl Jam"
- }
-
- TouchButton{
- id: preset1Btn
- anchors.top: fmLayout.top
- anchors.topMargin: 280
- anchors.left: browseBtn.left
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset2Btn
- anchors.top: preset1Btn.bottom
- anchors.left: preset1Btn.left
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset3Btn
- anchors.top: preset1Btn.top
- anchors.left: preset1Btn.right
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset4Btn
- anchors.top: preset2Btn.top
- anchors.left: preset2Btn.right
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset5Btn
- anchors.top: preset3Btn.top
- anchors.left: preset3Btn.right
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: preset6Btn
- anchors.top: preset4Btn.top
- anchors.left: preset4Btn.right
- height:60
- width: 208
- text: "WWWWWWWW"
- }
-
- TouchButton{
- id: replayBtn
- anchors.verticalCenter: browseBtn.verticalCenter
- anchors.verticalCenterOffset: 35
- anchors.left: fmLayout.left
- anchors.leftMargin: 725
- height:40
- width: 55
- text: "rply"
- }
-
- TouchButton{
- id: tuneBtn
- anchors.top: preset1Btn.top
- anchors.right: replayBtn.right
- height:40
- width: 120
- text: "tune"
- }
-
- TouchButton{
- id: presetsBtn
- anchors.bottom: preset6Btn.bottom
- anchors.right: replayBtn.right
- height:60
- width: 120
- text: "presets"
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/StartLayout.qml b/src/components/qt_hmi/References/Look/Layouts/StartLayout.qml deleted file mode 100644 index 3968438447..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/StartLayout.qml +++ /dev/null @@ -1,30 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: chrome
- width: 800
- height: 480
-
- //property alias bg: _bg
- //property alias btnIndicatorState: button1.indicatorState
- property alias button1: button1
-
-
-
-
- BaseText{
- id: title
- anchors.centerIn: chrome
- text: "Chrome"
- }
-
- TouchButton{
- id: button1
- anchors.top: title.bottom
- anchors.horizontalCenter: title.horizontalCenter
- text: "Button 1"
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/TC1_B1_Grid.qml b/src/components/qt_hmi/References/Look/Layouts/TC1_B1_Grid.qml deleted file mode 100644 index d898a0c07f..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/TC1_B1_Grid.qml +++ /dev/null @@ -1,37 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- width: 800
- height: 480
-
- property alias m1: m1.children
- property alias list: listView
- property alias list_data: listView.list_data
- property alias list_itemWidget: listView.list_itemWidget
- property alias listWrap: listView.listWrap
- property alias fg: _fg
-
-
-
- Item {
- id: _fg
-
- width: 800; height: 480
-
- GridViewWidget {
- id: listView
- x: 135; y: 170
- width: 530; height: 200
- gridItemHeight: 100; gridItemWidth: 180
-
- }
-
- FWdgtContainer {
- id: m1
- width: 530; height: 55
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/TileBackImgLayoutPCA.qml b/src/components/qt_hmi/References/Look/Layouts/TileBackImgLayoutPCA.qml deleted file mode 100644 index a1a0d32538..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/TileBackImgLayoutPCA.qml +++ /dev/null @@ -1,76 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: layout
- width: 800
- height: 480
-
- property alias m1: m1.children
- property alias list: listView
- property alias list_data: listView.list_data
- property alias list_itemWidget: listView.list_itemWidget
- property alias listWrap: listView.listWrap
- property alias fg: _fg
- property alias theX: listView.x
- property alias theY: listView.y
- property alias theWidth: listView.width
- property alias theHeight: listView.height
- property alias itemWidth: listView.gridItemWidth
- property alias itemHeight: listView.gridItemHeight
- property alias close: closeTouch
- property bool useClose: false
-
-
- Item {
- id: _fg
-
- width: 800; height: 480
-
-
- GridViewWidget {
- id: listView
- x: 0; y: 75
- width: 800; height: 356
- gridItemHeight: 178; gridItemWidth: 200
-
- }
-
- FWdgtContainer {
- id: m1
- width: 530; height: 55
- }
- }
- BaseText{
- id: closeTxt
- anchors.horizontalCenter: layout.horizontalCenter
- y:430
- horAlignment: Text.AlignHCenter
- vertAlignment: Text.AlignTop
- text: "CLOSE"
- color: "#1d81d5"
- pxSize: 22
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- visible: useClose
-
- }
-
- FWdgtTouchArea{
- id: closeTouch
- height: 75
- width: 750
- y:430
- anchors.horizontalCenter: layout.horizontalCenter
- visible: useClose
- enabled: useClose
- }
-
- FViewUseCase{condition: closeTouch.pressed === true
- //FActScriptCall { onScript: { FLogger.debug("Test color should change") } }
- PropertyChanges {
- target: closeTxt; color: "white"
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/TileBackLayout.qml b/src/components/qt_hmi/References/Look/Layouts/TileBackLayout.qml deleted file mode 100644 index 0aed708e35..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/TileBackLayout.qml +++ /dev/null @@ -1,107 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: tileLayout
- width: 800
- height: 480
-
- property alias button1: button1
- property alias button2: button2
- property alias button3: button3
- property alias button4: button4
- property alias button5: button5
- property alias button6: button6
- property alias button7: button7
- property alias button8: button8
- property alias backBtn: backBtn
-
-
-
- Grid {
- id: theGrid
- flow: Grid.TopToBottom
- anchors.top: tileLayout.top
- anchors.topMargin: 130
- anchors.horizontalCenter: tileLayout.horizontalCenter
- anchors.leftMargin: 100
- columns: 4
- spacing: 20
- TouchButton{
- id: button1
- height:125
- width: 135
- text: "Button 1"
- }
-
- TouchButton{
- id: button2
- height:125
- width: 135
- text: "Button 2"
- }
-
- TouchButton{
- id: button3
- height:125
- width: 135
- text: "Button 3"
- }
-
- TouchButton{
- id: button4
- height:125
- width: 135
- text: "Button 4"
- }
-
- TouchButton{
- id: button5
- height:125
- width: 135
- text: "Button 5"
- }
-
- TouchButton{
- id: button6
- height:125
- width: 135
- text: "Button 6"
- }
-
- TouchButton{
- id: button7
- height:125
- width: 135
- text: "Button 7"
- }
-
- TouchButton{
- id: button8
- height:125
- width: 135
- text: "Button 8"
- }
- }
-
-
-
- BaseText{
- id: title
- anchors.top: tileLayout.top
- anchors.topMargin: 80
- anchors.horizontalCenter: tileLayout.horizontalCenter
- text: "Select a Source"
- }
-
- TouchButton{
- id: backBtn
- anchors.verticalCenter: title.verticalCenter
- anchors.left: tileLayout.left
- anchors.leftMargin: 20
- height:40
- width: 60
- text: "<"
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/TileBackLayoutPCA.qml b/src/components/qt_hmi/References/Look/Layouts/TileBackLayoutPCA.qml deleted file mode 100644 index bc7545b6fd..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/TileBackLayoutPCA.qml +++ /dev/null @@ -1,73 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: layout
- width: 800
- height: 480
-
- property alias m1: m1.children
- property alias list: listView
- property alias list_data: listView.list_data
- property alias list_itemWidget: listView.list_itemWidget
- property alias listWrap: listView.listWrap
- property alias fg: _fg
- property alias theX: listView.x
- property alias theY: listView.y
- property alias theWidth: listView.width
- property alias theHeight: listView.height
- property alias itemWidth: listView.gridItemWidth
- property alias itemHeight: listView.gridItemHeight
- property alias close: closeTouch
- property bool useClose: true
-
-
-
-
- Item {
- id: _fg
-
- width: 800; height: 480
-
- GridViewWidget {
- id: listView
- x: 130; y: 170
- width: 540; height: 200
- gridItemHeight: 100; gridItemWidth: 180
-
- }
-
- FWdgtContainer {
- id: m1
- width: 530; height: 55
- }
-
-
- }
-
- BaseText{
- id: closeTxt
- anchors.horizontalCenter: layout.horizontalCenter
- y:430
- horAlignment: Text.AlignHCenter
- vertAlignment: Text.AlignTop
- text: "CLOSE"
- color: "#1d81d5"
- pxSize: 22
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- visible: useClose
-
- }
-
- FWdgtTouchArea{
- id: closeTouch
- height: 75
- width: 750
- y:430
- anchors.horizontalCenter: layout.horizontalCenter
- visible: useClose
- enabled: useClose
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/USBLayout.qml b/src/components/qt_hmi/References/Look/Layouts/USBLayout.qml deleted file mode 100644 index 178fe6fc1a..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/USBLayout.qml +++ /dev/null @@ -1,132 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: fmLayout
- width: 800
- height: 480
-
- property alias sourceBtn: sourceBtn
- property alias browseBtn: browseBtn
- property alias albumInfoBtn: albumInfoBtn
- property alias stationTxt: stationTxt
- property alias trackTxt: trackTxt
- property alias artistTxt: artistTxt
- property alias seekBkBtn: seekBkBtn
- property alias playBtn: playBtn
- property alias seekFdBtn: seekFdBtn
- property alias repeatBtn: repeatBtn
- property alias shuffleBtn: shuffleBtn
-
-
- TouchButton{
- id: sourceBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 140
- anchors.left: fmLayout.left
- anchors.leftMargin: 10
- height:25
- width: 130
- text: "Source"
- }
-
- TouchButton{
- id: browseBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 290
- anchors.left: fmLayout.left
- anchors.leftMargin: 10
- height:25
- width: 130
- text: "Browse"
- }
-
- TouchButton{
- id: albumInfoBtn
- anchors.top: fmLayout.top
- anchors.topMargin: 95
- anchors.left: fmLayout.left
- anchors.leftMargin: 190
- height:130
- width: 130
- text: "Album"
- }
-
- BaseText{
- id: stationTxt
- anchors.verticalCenter: trackTxt.verticalCenter
- anchors.verticalCenterOffset: -45
- anchors.left: trackTxt.left
- text: "Ch 22 / Pearl Jam Radio"
- }
-
- BaseText{
- id: trackTxt
- anchors.verticalCenter: albumInfoBtn.verticalCenter
- anchors.left: albumInfoBtn.right
- anchors.leftMargin: 15
- pxSize: 34
- text: "State of Love ..."
-
- }
-
- BaseText{
- id: artistTxt
- anchors.verticalCenter: trackTxt.verticalCenter
- anchors.verticalCenterOffset: 45
- anchors.left: trackTxt.left
- text: "Pearl Jam"
- }
-
- TouchButton{
- id: seekBkBtn
- anchors.verticalCenter: browseBtn.verticalCenter
- anchors.horizontalCenter: playBtn.horizontalCenter
- anchors.horizontalCenterOffset: -150
- height:100
- width: 100
- text: "<<"
- }
-
- TouchButton{
- id: playBtn
- anchors.verticalCenter: browseBtn.verticalCenter
- anchors.horizontalCenter: fmLayout.horizontalCenter
- height:120
- width: 120
- text: "||"
- }
-
- TouchButton{
- id: seekFdBtn
- anchors.verticalCenter: browseBtn.verticalCenter
- anchors.horizontalCenter: playBtn.horizontalCenter
- anchors.horizontalCenterOffset: 150
- height:100
- width: 100
- text: ">>"
- }
-
- TouchButton{
- id: repeatBtn
- anchors.verticalCenter: browseBtn.verticalCenter
- anchors.verticalCenterOffset: -35
- anchors.left: fmLayout.left
- anchors.leftMargin: 670
- height:40
- width: 55
- text: "rpt"
- }
-
- TouchButton{
- id: shuffleBtn
- anchors.verticalCenter: browseBtn.verticalCenter
- anchors.verticalCenterOffset: 35
- anchors.left: repeatBtn.left
- height:40
- width: 55
- text: "sfl"
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Layouts/USBLayoutPCA.qml b/src/components/qt_hmi/References/Look/Layouts/USBLayoutPCA.qml deleted file mode 100644 index d82077b555..0000000000 --- a/src/components/qt_hmi/References/Look/Layouts/USBLayoutPCA.qml +++ /dev/null @@ -1,155 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: fmLayout
- width: 800
- height: 480
-
- property alias sourceBtn: sourceBtn
- property alias browseBtn: browseBtn
- property alias trackNumTxt: trackNumTxt.text
- property alias artist: artistTxt.text
- property alias play: play.touchBtn
- property alias pause: pause.touchBtn
- property bool playing: true
-
-
-
-
- FWdgtImage{
- id: albumArt
- x:25
- y:176
- bitmap: "USB/albumArt.png"
- }
-
- TouchButton_PCA{
- id: sourceBtn
- x:25
- y:80
- textWidth: 100
- text: "FM Radio"
-
- }
-
- TouchButton_PCA{
- id: browseBtn
- anchors.right: fmLayout.right
- anchors.rightMargin: 25
- y:80
- textWidth: 75
- text: "Browse"
-
- }
-
- BaseText{
- id: trackNumTxt
- x:181
- y:188
- pxSize: 22
- text: "Track 13/ 16"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTCom-Lt.ttf"
-
- }
-
- BaseText{
- id: trackTxt
- x:181
- y:225
- text: "The Dog Days Are Over"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- pxSize: 45
-
-
- }
-
- BaseText{
- id: artistTxt
- x:181
- y:280
- text: "Florence and the Machine"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- pxSize: 22
- }
-
-
- TouchButtonClimatePCA{
- id: play
- x:367
- y:390
- image: "USB/play_9_9.png"
- imagePressed: "USB/playPressed_9_9.png"
- visible: playing
- enabled: playing
- }
-
- TouchButtonClimatePCA{
- id: pause
- x:367
- y:390
- image: "USB/pause_9_9.png"
- imagePressed: "USB/pausePressed_9_9.png"
- visible: !playing
- enabled: !playing
- }
-
- TouchButtonClimatePCA{
- id: seekBack
- x:287
- y:399
- image: "USB/Prev_9_9.png"
- imagePressed: "USB/PrevPressed_9_9.png"
- }
-
- TouchButtonClimatePCA{
- id: seekNext
- x:463
- y:399
- image: "USB/Next_9_9.png"
- imagePressed: "USB/NextPressed_9_9.png"
- }
-
- Rectangle{
- x:92
- y: 365
- height:1
- width: 616
- color: "#1d81d5"
- }
-
- Rectangle{
- x:92
- y: 365
- height:1
- width: 138
- color: "white"
- }
-
- BaseText{
- id: elapsedTime
- x:25
- y:358
- text: "02:36"
- color: "white"
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- pxSize: 18
- }
-
- BaseText{
- id: totTime
- y:358
- anchors.right: fmLayout.right
- anchors.rightMargin: 25
- horAlignment: Text.AlignRight
- text: "04:23"
- color: "#1d81d5"
- theFont: "../Fonts/HelveticaNeueLTStd-Md.ttf"
- pxSize: 18
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/PCA_HMI_v1_0.qml b/src/components/qt_hmi/References/Look/PCA_HMI_v1_0.qml deleted file mode 100644 index 22e408c716..0000000000 --- a/src/components/qt_hmi/References/Look/PCA_HMI_v1_0.qml +++ /dev/null @@ -1,373 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "Models"
-import "Widgets"
-import "Styles"
-
-Rectangle {
- width: 1360
- height: 768
- color: "black"
-
- // global events
- FEvent { id: cornerClicked }
- FEvent { id: closeNormalScreens }
-
- //global timers
- FTimer {id: testTimer; interval: 5000; repeat: false}
-
- // global datapools
- FDataPool {
- id: dataPool
-
- property string version: "V1.0.0"
- property string currSource: "FM"
- property string currStation: "91.9"
- property string currStatText: "WUOM"
- property string currSong: "Fresh Air"
- property string currAlbumArt: "album artRazorFish.png"
- property int layout: 2 //AM/FM:0, AMhd:1, FMhd:2, Sirius:3, USB:4, BT:5
- property int currFMpreset: 2
- property int currAMpreset: 1
- property int currSATpreset: 3
- property string curStationDT: ""
- property int statusBarChange: 0
- property int curFanSpeed: 1
- property int drvTemp: 70
- property int passTemp: 70
-
- property bool mainPCAmenuShown: false
-
-
- property string fm1pre1: "101.1"
- property string fm1pre2: "97.1"
- property string fm1pre3: "94.7"
- property string fm1pre4: "91.7"
- property string fm1pre5: "101.9"
- property string fm1pre6: "88.7"
-
- property string fm1stat1: "WRIF"
- property string fm1stat2: "WXYT"
- property string fm1stat3: "WCSX"
- property string fm1stat4: "WUOM"
- property string fm1stat5: "WDET"
- property string fm1stat6: "CIMX"
-
- property string fm1song1: "Ace of Spades"
- property string fm1song2: "Sports Talk"
- property string fm1song3: "Born to Run"
- property string fm1song4: "Fresh Air"
- property string fm1song5: "The Craig Fahle Show"
- property string fm1song6: "State of Love and Trust"
-
- property string fm2pre1: "101.1"
- property string fm2pre2: "97.1"
- property string fm2pre3: "94.7"
- property string fm2pre4: "91.7"
- property string fm2pre5: "101.9"
- property string fm2pre6: "88.7"
-
- property string fm2stat1: "WRIF"
- property string fm2stat2: "WXYT"
- property string fm2stat3: "WCSX"
- property string fm2stat4: "WUOM"
- property string fm2stat5: "WDET"
- property string fm2stat6: "CIMX"
-
- property string fm2song1: "Ace of Spades"
- property string fm2song2: "Sports Talk"
- property string fm2song3: "Born to Run"
- property string fm2song4: "Fresh Air"
- property string fm2song5: "The Craig Fahle Show"
- property string fm2song6: "State of Love and Trust"
-
- property string fm3pre1: "101.1"
- property string fm3pre2: "97.1"
- property string fm3pre3: "94.7"
- property string fm3pre4: "91.7"
- property string fm3pre5: "101.9"
- property string fm3pre6: "88.7"
-
- property string fm3stat1: "WRIF"
- property string fm3stat2: "WXYT"
- property string fm3stat3: "WCSX"
- property string fm3stat4: "WUOM"
- property string fm3stat5: "WDET"
- property string fm3stat6: "CIMX"
-
- property string fm3song1: "Ace of Spades"
- property string fm3song2: "Sports Talk"
- property string fm3song3: "Born to Run"
- property string fm3song4: "Fresh Air"
- property string fm3song5: "The Craig Fahle Show"
- property string fm3song6: "State of Love and Trust"
-
-
- /*List Filtered Variables*/
- property string navEnrty:""
- property string filter: ""
- property variant uniqueChars: undefined
- property string navList1stItem:""
- property string filterPhone:""
- }
-
- // global conditions
- FConditionPool {
- id: condPool
-
- property bool amfmActiveSource: true
- property bool settingsOpen: false
- property bool dualBtnSt: true
- property bool drvHeatSeatSt: false
- property bool drvCoolSeatSt: false
- property bool passCoolSeatSt: false
- property bool passHeatSeatSt: false
- property bool heatWheelSt: false
- property bool heatWinSheildSt: true
- property bool defrostSt: true
- property bool pannelSt: false
- property bool floorSt: false
-
- property bool showMenu: true
-
- }
-
-
- Component.onCompleted: {
- FThemeProvider.resourcePath = Qt.resolvedUrl("Resources");
- FThemeProvider.theme = "Theme1";
-
-
- }
- property QtObject filtermodel: ListModel {
- ListElement { staticItem: "Five Guys" }
- ListElement { staticItem: "Archers Of Loaf" }
- ListElement { staticItem: "Bob Mould" }
- ListElement { staticItem: "Cat Power" }
- ListElement { staticItem: "Cloud Nothings"}
- ListElement { staticItem: "Dentist"}
- ListElement { staticItem: "Dirty Frank's" }
- ListElement { staticItem: "Grouplove" }
- ListElement { staticItem: "Hudson Bell"}
- ListElement { staticItem: "Japandroids" }
- ListElement { staticItem: "Macklemore & Ryan Lewis"}
- ListElement { staticItem: "The National"}
- ListElement { staticItem: "Titus Andronicus" }
- ListElement { staticItem: "Tito" }
- ListElement { staticItem: "Tamal" }
- ListElement { staticItem: "Taco" }
- }
-
- QtObject{
- id:sortList
-
- //Check if char exist on Phone DataModel
- function existChar(model, character){
- //console.log(model.get(3).staticItem.charAt(0).toLowerCase())
- for (var i = 0; i < model.count; i++) {
- var u =model.get(i).staticItem.charAt(0).toLowerCase()
- if (character=== u){
- console.log(i)
- return i;
- }
-
- }
-
- }
-
- // Check whether given character exists in array
- function exist(array, character) {
- console.log(array[0]);
- for (var i = 0; i < array.length; i++) {
-
- if (array[i] == character) return true;
- }
- return false;
- }
-
- // Check whether given filter matches the string (e.g. "ce" would match "Cecilia")
- // The check is case-insensitive
- function checkFilter(filter, string) {
- if (filter.length > string.length) return false;
-
- var filterlower = filter.toLowerCase();
- var stringlower = string.toLowerCase();
-
- for (var i = 0; i < filter.length; i++) {
- if (filterlower[i] != stringlower[i])
- return false;
- }
-
- return true;
- }
-
- // Updates the filtermodel based on the current filter
- function updateFilterModel(name) {
- if (dataPool.filter.length > 0) {
- for (var i = filtermodel.count-1; i >= 0; i--) {
- if (!checkFilter(dataPool.filter, filtermodel.get(i).staticItem))
- filtermodel.remove(i)
- }
- }
-
- updateUniqueChars()
- }
-
- // Updates the array of unique first letters in the current index of the model
- function updateUniqueChars() {
-
- if (filtermodel.get(0) === undefined)
- {
- dataPool.navList1stItem=""
- return;
-
- }
-
- var characters = new Array();
-
- // If filter model has at most 1 item in it, no point in going
- // any further with filtering
- dataPool.navList1stItem=filtermodel.get(0).staticItem
- if (filtermodel.count > 1) {
-
- for (var i = 0; i < filtermodel.count; i++) {
- var name = filtermodel.get(i).staticItem;
-
- if (!exist(characters, name[dataPool.filter.length])) {
- characters.push(name[dataPool.filter.length])
- }
- }
-
- characters.sort()
-
-
- }
-
-
- dataPool.uniqueChars = characters
-
- }
-
-
- // Fills the filtermodel with contents from the source list's model
- function fillFilterModel(fullModel) {
- if (fullModel === undefined) return;
- filtermodel.clear();
- for (var i = 0; i < fullModel.count; i++) {
- filtermodel.append(fullModel.get(i))
- }
-
- }
-
- }
-
- FDisplay {
-
- /* modelPath:Qt.resolvedUrl(".")
- id: display
- //activeVariant: "ClassicTop"
- //activeVariant: "ClassicBottom"
- //activeVariant: "Tangier"
- viewCacheSize:0
-
- //width: 800
- //height: 480
-// xPixel: 800
-// yPixel: 480
- anchors.fill: parent
-// anchors { left: parent.left; top: parent.top;}
-
- priorityLayerCount: 9
- //initialView: "AutocompleteList"
- initialView: "Off"*/
-
-
-
- modelPath:Qt.resolvedUrl(".")
- id: display
- //activeVariant: "ClassicTop"
- //activeVariant: "ClassicBottom"
- //activeVariant: "Tangier"
- viewCacheSize:0
-
-
- width: 800
- height: 480
-
- xPixel: 800
- yPixel: 480
-
- anchors {
- horizontalCenter: parent.horizontalCenter;
- verticalCenter: parent.verticalCenter;
- verticalCenterOffset: 55
- }
-
- priorityLayerCount: 9
- initialView: "Off"
- //initialView: "NavTilesView"
- }
-
- Item
- {
- id: fHardwareKeybezel1
- width: 800
- height: 375
- x:10
- y:500
-
- // function keys
- TextHardkey {
- id: hk_OnOff
- width: 100
- height: 50
- anchors.left: parent.left
- anchors.leftMargin: 0
- anchors.top: parent.top
- anchors.topMargin: 0
- label: "On/Off"
- }
-
- BaseText {
- id: info
- text: dataPool.version
- color: "black"
- anchors.top: hk_OnOff.top
- anchors.left: hk_OnOff.right
- anchors.leftMargin: 20
- }
-
-
- FHardwareKey {
- id: buttonUp
- hardwareControlID: "buttonUp"
- //commName: "buttonBack"
-
- x:0
- y:0
- width: 60
- height:25
-
-
- keyboardKey: Qt.Key_Up
- visible: false
- }
-
- FHardwareKey {
- id: buttonDown
- hardwareControlID: "buttonDown"
- //commName: "buttonBack"
-
- x:0
- y:0
- width: 60
- height:25
-
-
- keyboardKey: Qt.Key_Down
- visible: false
- }
-
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/PCA_HMI_v1_0.qmlproject b/src/components/qt_hmi/References/Look/PCA_HMI_v1_0.qmlproject deleted file mode 100644 index e9402cbac7..0000000000 --- a/src/components/qt_hmi/References/Look/PCA_HMI_v1_0.qmlproject +++ /dev/null @@ -1,20 +0,0 @@ -/* File generated by Qt Creator, version 2.6.1 */
-
-import QmlProject 1.1
-
-Project {
- mainFile: "PCA_HMI_v1_0.qml"
-
- /* Include .qml, .js, and image files from current directory and subdirectories */
- QmlFiles {
- directory: "."
- }
- JavaScriptFiles {
- directory: "."
- }
- ImageFiles {
- directory: "."
- }
- /* List of plugin directories passed to QML runtime */
- importPaths: [ "plugins" ]
-}
diff --git a/src/components/qt_hmi/References/Look/Resources/CButton.png b/src/components/qt_hmi/References/Look/Resources/CButton.png Binary files differdeleted file mode 100644 index aeebdb64ca..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/CButton.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Ford-HMI-PCA-phone_contacts.psd b/src/components/qt_hmi/References/Look/Resources/Ford-HMI-PCA-phone_contacts.psd Binary files differdeleted file mode 100644 index 982bd5882c..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Ford-HMI-PCA-phone_contacts.psd +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/HierarchicalListBG.png b/src/components/qt_hmi/References/Look/Resources/HierarchicalListBG.png Binary files differdeleted file mode 100644 index 805236eaf6..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/HierarchicalListBG.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/Map.png b/src/components/qt_hmi/References/Look/Resources/Nav/Map.png Binary files differdeleted file mode 100644 index 4b39af9b22..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/Map.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/OptionsInActive.png b/src/components/qt_hmi/References/Look/Resources/Nav/OptionsInActive.png Binary files differdeleted file mode 100644 index 601b242bbe..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/OptionsInActive.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/OptionsPressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/Nav/OptionsPressed_9_9.png Binary files differdeleted file mode 100644 index 42c352a7e8..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/OptionsPressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/Options_9_9.png b/src/components/qt_hmi/References/Look/Resources/Nav/Options_9_9.png Binary files differdeleted file mode 100644 index 46887f1061..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/Options_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/compass.png b/src/components/qt_hmi/References/Look/Resources/Nav/compass.png Binary files differdeleted file mode 100644 index b78041307b..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/compass.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/deleteIcon.png b/src/components/qt_hmi/References/Look/Resources/Nav/deleteIcon.png Binary files differdeleted file mode 100644 index 826b5faacf..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/deleteIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/deleteIconBlack.png b/src/components/qt_hmi/References/Look/Resources/Nav/deleteIconBlack.png Binary files differdeleted file mode 100644 index 56e35c759b..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/deleteIconBlack.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/destIcon.png b/src/components/qt_hmi/References/Look/Resources/Nav/destIcon.png Binary files differdeleted file mode 100644 index dadcfe25cf..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/destIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/destIconBlack.png b/src/components/qt_hmi/References/Look/Resources/Nav/destIconBlack.png Binary files differdeleted file mode 100644 index 75c99bc4aa..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/destIconBlack.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Nav/turnArrow.png b/src/components/qt_hmi/References/Look/Resources/Nav/turnArrow.png Binary files differdeleted file mode 100644 index f37731f5af..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Nav/turnArrow.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/OButton.png b/src/components/qt_hmi/References/Look/Resources/OButton.png Binary files differdeleted file mode 100644 index 2811770953..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/OButton.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/ButtonCenter_0_8.png b/src/components/qt_hmi/References/Look/Resources/Radio/ButtonCenter_0_8.png Binary files differdeleted file mode 100644 index 9933dbcc72..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/ButtonCenter_0_8.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/ButtonEnd_8_8.png b/src/components/qt_hmi/References/Look/Resources/Radio/ButtonEnd_8_8.png Binary files differdeleted file mode 100644 index 672e57bf39..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/ButtonEnd_8_8.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/ButtonOtherEnd_8_8.png b/src/components/qt_hmi/References/Look/Resources/Radio/ButtonOtherEnd_8_8.png Binary files differdeleted file mode 100644 index cc9cb83ede..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/ButtonOtherEnd_8_8.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/Ford-HMI-PCA-audio_fm_sirius.png b/src/components/qt_hmi/References/Look/Resources/Radio/Ford-HMI-PCA-audio_fm_sirius.png Binary files differdeleted file mode 100644 index efe0b7b586..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/Ford-HMI-PCA-audio_fm_sirius.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/HDBtn_8_8.png b/src/components/qt_hmi/References/Look/Resources/Radio/HDBtn_8_8.png Binary files differdeleted file mode 100644 index 6ed0293aab..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/HDBtn_8_8.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/SourceBtn_8_8.png b/src/components/qt_hmi/References/Look/Resources/Radio/SourceBtn_8_8.png Binary files differdeleted file mode 100644 index 375195bec3..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/SourceBtn_8_8.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/TuneBtn_8_8.png b/src/components/qt_hmi/References/Look/Resources/Radio/TuneBtn_8_8.png Binary files differdeleted file mode 100644 index 99f5e90c3d..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/TuneBtn_8_8.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/blueBall.png b/src/components/qt_hmi/References/Look/Resources/Radio/blueBall.png Binary files differdeleted file mode 100644 index d4db3f96ae..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/blueBall.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/menuIcon_2_2.png b/src/components/qt_hmi/References/Look/Resources/Radio/menuIcon_2_2.png Binary files differdeleted file mode 100644 index 1422e00b42..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/menuIcon_2_2.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/perlJamIcon_0_0.png b/src/components/qt_hmi/References/Look/Resources/Radio/perlJamIcon_0_0.png Binary files differdeleted file mode 100644 index 3c1cad7c33..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/perlJamIcon_0_0.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Radio/whiteBall.png b/src/components/qt_hmi/References/Look/Resources/Radio/whiteBall.png Binary files differdeleted file mode 100644 index 952714ebe6..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Radio/whiteBall.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/NextPressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/USB/NextPressed_9_9.png Binary files differdeleted file mode 100644 index aab3df8914..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/NextPressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/Next_9_9.png b/src/components/qt_hmi/References/Look/Resources/USB/Next_9_9.png Binary files differdeleted file mode 100644 index c432068d4a..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/Next_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/PrevPressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/USB/PrevPressed_9_9.png Binary files differdeleted file mode 100644 index c6eefc09c9..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/PrevPressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/Prev_9_9.png b/src/components/qt_hmi/References/Look/Resources/USB/Prev_9_9.png Binary files differdeleted file mode 100644 index acc2a71de3..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/Prev_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/albumArt.png b/src/components/qt_hmi/References/Look/Resources/USB/albumArt.png Binary files differdeleted file mode 100644 index 9000680276..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/albumArt.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/pause.png b/src/components/qt_hmi/References/Look/Resources/USB/pause.png Binary files differdeleted file mode 100644 index 71a7574d25..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/pause.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/pausePressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/USB/pausePressed_9_9.png Binary files differdeleted file mode 100644 index a26cf2e4ea..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/pausePressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/pause_9_9.png b/src/components/qt_hmi/References/Look/Resources/USB/pause_9_9.png Binary files differdeleted file mode 100644 index 417bdbf248..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/pause_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/playPressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/USB/playPressed_9_9.png Binary files differdeleted file mode 100644 index ecbb4f2ef0..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/playPressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/USB/play_9_9.png b/src/components/qt_hmi/References/Look/Resources/USB/play_9_9.png Binary files differdeleted file mode 100644 index f185e94461..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/USB/play_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Vehicle/cal.png b/src/components/qt_hmi/References/Look/Resources/Vehicle/cal.png Binary files differdeleted file mode 100644 index 94d5d44b5a..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Vehicle/cal.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Vehicle/folders.png b/src/components/qt_hmi/References/Look/Resources/Vehicle/folders.png Binary files differdeleted file mode 100644 index c5985043df..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Vehicle/folders.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Vehicle/key_car.png b/src/components/qt_hmi/References/Look/Resources/Vehicle/key_car.png Binary files differdeleted file mode 100644 index a8e5d9d66c..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Vehicle/key_car.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/Vehicle/sun.png b/src/components/qt_hmi/References/Look/Resources/Vehicle/sun.png Binary files differdeleted file mode 100644 index 6424d9d210..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/Vehicle/sun.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/keyPressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/buttons/keyPressed_9_9.png Binary files differdeleted file mode 100644 index b0f8863423..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/keyPressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/keySelected.png b/src/components/qt_hmi/References/Look/Resources/buttons/keySelected.png Binary files differdeleted file mode 100644 index d264e201ad..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/keySelected.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/key_9_9.png b/src/components/qt_hmi/References/Look/Resources/buttons/key_9_9.png Binary files differdeleted file mode 100644 index 3add8dd21c..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/key_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/muteActive.png b/src/components/qt_hmi/References/Look/Resources/buttons/muteActive.png Binary files differdeleted file mode 100644 index e14b9fb751..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/muteActive.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/muteInActive.png b/src/components/qt_hmi/References/Look/Resources/buttons/muteInActive.png Binary files differdeleted file mode 100644 index a2c1cb831a..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/muteInActive.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/mutePressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/buttons/mutePressed_9_9.png Binary files differdeleted file mode 100644 index 9a9ae59346..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/mutePressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/mute_9_9.png b/src/components/qt_hmi/References/Look/Resources/buttons/mute_9_9.png Binary files differdeleted file mode 100644 index f7306d96ae..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/mute_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/presetPressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/buttons/presetPressed_9_9.png Binary files differdeleted file mode 100644 index fd7606fbd6..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/presetPressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/presetSelected.png b/src/components/qt_hmi/References/Look/Resources/buttons/presetSelected.png Binary files differdeleted file mode 100644 index 2b567e237e..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/presetSelected.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/preset_9_9.png b/src/components/qt_hmi/References/Look/Resources/buttons/preset_9_9.png Binary files differdeleted file mode 100644 index 58c296a4e4..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/preset_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/zoomPressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/buttons/zoomPressed_9_9.png Binary files differdeleted file mode 100644 index c67d2c7c55..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/zoomPressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/zoomSelected.png b/src/components/qt_hmi/References/Look/Resources/buttons/zoomSelected.png Binary files differdeleted file mode 100644 index 36bba93d8c..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/zoomSelected.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/buttons/zoom_9_9.png b/src/components/qt_hmi/References/Look/Resources/buttons/zoom_9_9.png Binary files differdeleted file mode 100644 index 0df4d25109..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/buttons/zoom_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/climate/ButtonActive_0_0.png b/src/components/qt_hmi/References/Look/Resources/climate/ButtonActive_0_0.png Binary files differdeleted file mode 100644 index 55e2cac50a..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/climate/ButtonActive_0_0.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/climate/ButtonInActive_0_0.png b/src/components/qt_hmi/References/Look/Resources/climate/ButtonInActive_0_0.png Binary files differdeleted file mode 100644 index 9f84a139e6..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/climate/ButtonInActive_0_0.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/climate/ButtonPressed_9_9.png b/src/components/qt_hmi/References/Look/Resources/climate/ButtonPressed_9_9.png Binary files differdeleted file mode 100644 index 691f6e3bf8..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/climate/ButtonPressed_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/climate/Button_9_9.png b/src/components/qt_hmi/References/Look/Resources/climate/Button_9_9.png Binary files differdeleted file mode 100644 index 411f003938..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/climate/Button_9_9.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/climate/ring.png b/src/components/qt_hmi/References/Look/Resources/climate/ring.png Binary files differdeleted file mode 100644 index 9908bf71be..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/climate/ring.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/dn-arrow.png b/src/components/qt_hmi/References/Look/Resources/dn-arrow.png Binary files differdeleted file mode 100644 index bb1322277d..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/dn-arrow.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/g136p.png b/src/components/qt_hmi/References/Look/Resources/g136p.png Binary files differdeleted file mode 100644 index 1d49f184a1..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/g136p.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/g137p.png b/src/components/qt_hmi/References/Look/Resources/g137p.png Binary files differdeleted file mode 100644 index 8e674d75b7..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/g137p.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/menu/arrow.png b/src/components/qt_hmi/References/Look/Resources/menu/arrow.png Binary files differdeleted file mode 100644 index 4c215b2bf7..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/menu/arrow.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/menu/car.png b/src/components/qt_hmi/References/Look/Resources/menu/car.png Binary files differdeleted file mode 100644 index 18a21656d0..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/menu/car.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/menu/gear.png b/src/components/qt_hmi/References/Look/Resources/menu/gear.png Binary files differdeleted file mode 100644 index b1eeba091c..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/menu/gear.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/menu/notes.png b/src/components/qt_hmi/References/Look/Resources/menu/notes.png Binary files differdeleted file mode 100644 index 8b4a92fffc..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/menu/notes.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/menu/phone.png b/src/components/qt_hmi/References/Look/Resources/menu/phone.png Binary files differdeleted file mode 100644 index 346f36cc33..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/menu/phone.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/menu/snow.png b/src/components/qt_hmi/References/Look/Resources/menu/snow.png Binary files differdeleted file mode 100644 index 54756bb2f6..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/menu/snow.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/phone/DNDoff.png b/src/components/qt_hmi/References/Look/Resources/phone/DNDoff.png Binary files differdeleted file mode 100644 index 04bb2476c1..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/phone/DNDoff.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/phone/DNDon.png b/src/components/qt_hmi/References/Look/Resources/phone/DNDon.png Binary files differdeleted file mode 100644 index 56b9fe7065..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/phone/DNDon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/phone/contacts.png b/src/components/qt_hmi/References/Look/Resources/phone/contacts.png Binary files differdeleted file mode 100644 index a16d518ba8..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/phone/contacts.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/phone/keypad.png b/src/components/qt_hmi/References/Look/Resources/phone/keypad.png Binary files differdeleted file mode 100644 index 1792c8fac8..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/phone/keypad.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/phone/messages.png b/src/components/qt_hmi/References/Look/Resources/phone/messages.png Binary files differdeleted file mode 100644 index b5cbb8e8af..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/phone/messages.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/phone/more.png b/src/components/qt_hmi/References/Look/Resources/phone/more.png Binary files differdeleted file mode 100644 index 908ebf654e..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/phone/more.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/phone/recent.png b/src/components/qt_hmi/References/Look/Resources/phone/recent.png Binary files differdeleted file mode 100644 index db54c2f16e..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/phone/recent.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/phone/texts.png b/src/components/qt_hmi/References/Look/Resources/phone/texts.png Binary files differdeleted file mode 100644 index 31c024b1df..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/phone/texts.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/scrollbar.png b/src/components/qt_hmi/References/Look/Resources/scrollbar.png Binary files differdeleted file mode 100644 index c849382ae2..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/scrollbar.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/slider.png b/src/components/qt_hmi/References/Look/Resources/slider.png Binary files differdeleted file mode 100644 index 83c54f854a..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/slider.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/Resources/up-arrow.png b/src/components/qt_hmi/References/Look/Resources/up-arrow.png Binary files differdeleted file mode 100644 index b0e710a409..0000000000 --- a/src/components/qt_hmi/References/Look/Resources/up-arrow.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/TextHardkey.qml b/src/components/qt_hmi/References/Look/TextHardkey.qml deleted file mode 100644 index b73b991164..0000000000 --- a/src/components/qt_hmi/References/Look/TextHardkey.qml +++ /dev/null @@ -1,52 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "Widgets"
-
-FHardwareKey {
- width: 50
- height: 50
-
- property alias label : theText.text
-
- Rectangle {
- anchors.fill: parent
- border.color: "black"
- border.width: 1
- radius: 10
- smooth: true
-
- gradient: Gradient {
- GradientStop {
- id: s1
- color: "#FF646464"
- position: 0.0
- }
- GradientStop {
- id: s2
- color: "#FF484848"
- position: 0.8
- }
- GradientStop {
- id: s3
- color: "#FF323232"
- position: 1.0
- }
- }
- }
-
- CondText {
- id: theText
- anchors.fill: parent
- horizontalAlignment: Text.AlignHCenter
-
- }
-
-
- FViewUseCaseSimple {
- condition: pressed === true
- PropertyChanges { target: s1; position: 1.0 }
- PropertyChanges { target: s2; position: 0.2}
- PropertyChanges { target: s3; position: 0.0 }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Views/AM.qml b/src/components/qt_hmi/References/Look/Views/AM.qml deleted file mode 100644 index 2ed7d8085d..0000000000 --- a/src/components/qt_hmi/References/Look/Views/AM.qml +++ /dev/null @@ -1,86 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: FMLayout {
- id:home
- albumInfoBtn.vis: false
- albumInfoImg.visible: false
- alertBtn.vis: false
- browseBtn.vis: false
- replayBtn.vis: false
- preset1Btn.text: "WJR"
- preset2Btn.text: "1130"
- preset3Btn.text: "950"
- preset4Btn.text: "WWJ"
- preset5Btn.text: "WXYZ"
- preset6Btn.text: "1330"
- artistTxt.text: ""
- stationTxt.text: ""
- trackTxt.text: "950"
-
-
- }
-
-
- }
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChange" }
- },
- FTrgTouchArea { touchArea:home.browseBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.albumInfoBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset1Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset2Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset3Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset4Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset5Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset6Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.replayBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.tuneBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.presetsBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/AMPCA.qml b/src/components/qt_hmi/References/Look/Views/AMPCA.qml deleted file mode 100644 index 9a0a99f832..0000000000 --- a/src/components/qt_hmi/References/Look/Views/AMPCA.qml +++ /dev/null @@ -1,122 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- attachedViews: ["PCAstatusBar"]
-
-
-
-
- view: FView {
- id: v
-
- layout: FMLayoutPCA {
- id:home
- sourceBtn.text: "AM Radio"
- freqId: "AM"
- sourceBtn.textWidth: 100
- curPreset: dataPool.currAMpreset
- hdBtn.visible: false
-
- listModel: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- }
-
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: preset1; menuText: "1130"; menuData: false; }
- FMenuElement { id: preset2; menuText: "950"; menuData: false }
- FMenuElement { id: preset3; menuText: "760"; menuData: true }
- FMenuElement { id: preset4; menuText: "1270"; menuData: false }
- FMenuElement { id: preset5; menuText: "1310"; menuData: false }
- FMenuElement { id: preset6; menuText: "800"; menuData: false }
- FMenuElement { id: preset7; menuText: "610"; menuData: false }
- FMenuElement { id: preset8; menuText: "820"; menuData: false}
- }
- }
-
-
-
- triggers: [
-
-
-
- FTrgEntry{
- FGrdCondition{condition: dataPool.currAMpreset === 1
- FActScriptCall { onScript: home.stationTxt = "1130" }
- }
- FGrdCondition{condition: dataPool.currAMpreset === 2
- FActScriptCall { onScript: home.stationTxt = "950" }
- }
- FGrdCondition{condition: dataPool.currAMpreset === 3
- FActScriptCall { onScript: home.stationTxt = "760" }
- }
- FGrdCondition{condition: dataPool.currAMpreset === 4
- FActScriptCall { onScript: home.stationTxt = "1270" }
- }
- FGrdCondition{condition: dataPool.currAMpreset === 5
- FActScriptCall { onScript: home.stationTxt = "1310" }
- }
- FGrdCondition{condition: dataPool.currAMpreset === 6
- FActScriptCall { onScript: home.stationTxt = "800" }
- }
- FGrdCondition{condition: dataPool.currAMpreset === 7
- FActScriptCall { onScript: home.stationTxt = "610" }
- }
- FGrdCondition{condition: dataPool.currAMpreset === 8
- FActScriptCall { onScript: home.stationTxt = "820" }
- }
- },
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChangePCA" }
- },
- FTrgMenuElement { menuElement: preset1
- FActScriptCall { onScript: home.stationTxt = "1130" }
- FActScriptCall { onScript: dataPool.currAMpreset = 1 }
- },
- FTrgMenuElement { menuElement: preset2
- FActScriptCall { onScript: home.stationTxt = "950" }
- FActScriptCall { onScript: dataPool.currAMpreset = 2 }
- },
- FTrgMenuElement { menuElement: preset3
- FActScriptCall { onScript: home.stationTxt = "760" }
- FActScriptCall { onScript: dataPool.currAMpreset = 3 }
- },
- FTrgMenuElement { menuElement: preset4
- FActScriptCall { onScript: home.stationTxt = "1270" }
- FActScriptCall { onScript: dataPool.currAMpreset = 4 }
- },
- FTrgMenuElement { menuElement: preset5
- FActScriptCall { onScript: home.stationTxt = "1310" }
- FActScriptCall { onScript: dataPool.currAMpreset = 5 }
- },
- FTrgMenuElement { menuElement: preset6
- FActScriptCall { onScript: home.stationTxt = "800" }
- FActScriptCall { onScript: dataPool.currAMpreset = 6 }
- },
- FTrgMenuElement { menuElement: preset7
- FActScriptCall { onScript: home.stationTxt = "610" }
- FActScriptCall { onScript: dataPool.currAMpreset = 7 }
- },
- FTrgMenuElement { menuElement: preset8
- FActScriptCall { onScript: home.stationTxt = "820" }
- FActScriptCall { onScript: dataPool.currAMpreset = 8 }
- },
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/AlphaSortPCA.qml b/src/components/qt_hmi/References/Look/Views/AlphaSortPCA.qml deleted file mode 100644 index 0158451113..0000000000 --- a/src/components/qt_hmi/References/Look/Views/AlphaSortPCA.qml +++ /dev/null @@ -1,151 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- attachedViews: ["PCAstatusBar"]
-
-
-
-
- view: FView {
- id: v
-
- layout: AlphaSortLayout {
- id:home
- phonEntry: dataPool.filterPhone
-
- }
-
-
- }
-
- triggers: [
-
- FTrgEntry{
- FActScriptCall { onScript: dataPool.filterPhone= ""}
- },
- FTrgTouchArea { touchArea:home.a; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "a"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.b; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "b"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.c; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "c"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.d; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "d"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.e; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "e"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.f; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "f"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.g; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "g"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.h; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "h"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.i; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "i"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.j; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "j"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.k; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "k"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.l; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "l"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.m; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "m"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.n; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "n"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.o; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "o"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.p; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "p"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.q; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "q"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.r; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "r"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.s; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "s"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.t; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "t"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.u; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "u"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.v; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "v"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.w; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "w"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.xB; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "x"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.yB; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "y"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.zB; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "z"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.num; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.filterPhone= "a"}
- FActViewShow { view: "PhoneContactsListView" }
- },
- FTrgTouchArea { touchArea:home.close; touchAction: TA.Out
-
- FActViewShow { view: "PhonePCA" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-
-}
diff --git a/src/components/qt_hmi/References/Look/Views/AuxPCA.qml b/src/components/qt_hmi/References/Look/Views/AuxPCA.qml deleted file mode 100644 index 478d1e55d9..0000000000 --- a/src/components/qt_hmi/References/Look/Views/AuxPCA.qml +++ /dev/null @@ -1,41 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: FMLayoutPCA {
- id:home
- sourceBtn.text: "Line In"
- sourceBtn.textWidth: 90
- }
-
-
- }
-
-
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChangePCA" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/BT_AudioPCA.qml b/src/components/qt_hmi/References/Look/Views/BT_AudioPCA.qml deleted file mode 100644 index 83a83147f0..0000000000 --- a/src/components/qt_hmi/References/Look/Views/BT_AudioPCA.qml +++ /dev/null @@ -1,48 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: USBLayoutPCA {
- id:home
- sourceBtn.text: "BT Audio"
- sourceBtn.textWidth: 100
- playing: true
- }
-
-
- }
-
-
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChangePCA" }
- },
- FTrgTouchArea { touchArea:home.play; touchAction: TA.Out
- FActScriptCall { onScript: home.playing = false }
- },
- FTrgTouchArea { touchArea:home.pause; touchAction: TA.Out
- FActScriptCall { onScript: home.playing = true }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/CDPCA.qml b/src/components/qt_hmi/References/Look/Views/CDPCA.qml deleted file mode 100644 index bc6e6ab2fd..0000000000 --- a/src/components/qt_hmi/References/Look/Views/CDPCA.qml +++ /dev/null @@ -1,48 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: USBLayoutPCA {
- id:home
- sourceBtn.text: "CD"
- sourceBtn.textWidth: 40
- playing: true
- }
-
-
- }
-
-
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChangePCA" }
- },
- FTrgTouchArea { touchArea:home.play; touchAction: TA.Out
- FActScriptCall { onScript: home.playing = false }
- },
- FTrgTouchArea { touchArea:home.pause; touchAction: TA.Out
- FActScriptCall { onScript: home.playing = true }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/Chrome.qml b/src/components/qt_hmi/References/Look/Views/Chrome.qml deleted file mode 100644 index e8029fb10a..0000000000 --- a/src/components/qt_hmi/References/Look/Views/Chrome.qml +++ /dev/null @@ -1,55 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 8
-
-
-
- view: FView {
- id: v
-
- layout: ChromeLayout {
- id:chrome
- button2.indicatorState: condPool.settingsOpen
-
- }
-
-
- }
-
- /*FViewUseCaseSimple{condition:condPool.settingsOpen
- PropertyChanges {
- target: chrome.button2; indicatorState: true
- }
- }*/
-
- triggers: [
- FTrgEntry {
-
- },
-
- FTrgHardwareKey { hardkeys: hk_OnOff; keyAction: HK.In
- FActEventFire { event: closeNormalScreens }
- FActViewShow { view: "Off" }
- },
- FTrgTouchArea { touchArea:chrome.button1; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:chrome.button2; touchAction: TA.Out
- FActViewShow { view: "List" }
- },
- FTrgTouchArea { touchArea:chrome.button3; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/ClimatePCA.qml b/src/components/qt_hmi/References/Look/Views/ClimatePCA.qml deleted file mode 100644 index 812e6afac3..0000000000 --- a/src/components/qt_hmi/References/Look/Views/ClimatePCA.qml +++ /dev/null @@ -1,74 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
-
-
- view: FView {
- id: v
-
- layout: ClimatePCALayout {
- id:climate
- dualBtnSt: condPool.dualBtnSt
- drvHeatSeatSt: condPool.drvHeatSeatSt
- drvCoolSeatSt: condPool.drvCoolSeatSt
- passCoolSeatSt: condPool.passCoolSeatSt
- passHeatSeatSt: condPool.passHeatSeatSt
- heatWheelSt: condPool.heatWheelSt
- heatWinSheildSt: condPool.heatWinSheildSt
- defrostSt: condPool.defrostSt
- pannelSt: condPool.pannelSt
- floorSt: condPool.floorSt
-
- }
-
- }
-
-
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:climate.dualBtn; touchAction: TA.Out
- FActScriptCall { onScript: condPool.dualBtnSt = !condPool.dualBtnSt }
- },
- FTrgTouchArea { touchArea:climate.drvHeatSeat; touchAction: TA.Out
- FActScriptCall { onScript: condPool.drvHeatSeatSt = !condPool.drvHeatSeatSt }
- },
- FTrgTouchArea { touchArea:climate.drvCoolSeat; touchAction: TA.Out
- FActScriptCall { onScript: condPool.drvCoolSeatSt = !condPool.drvCoolSeatSt }
- },
- FTrgTouchArea { touchArea:climate.passCoolSeat; touchAction: TA.Out
- FActScriptCall { onScript: condPool.passCoolSeatSt = !condPool.passCoolSeatSt }
- },
- FTrgTouchArea { touchArea:climate.passHeatSeat; touchAction: TA.Out
- FActScriptCall { onScript: condPool.passHeatSeatSt = !condPool.passHeatSeatSt }
- },
- FTrgTouchArea { touchArea:climate.heatWheel; touchAction: TA.Out
- FActScriptCall { onScript: condPool.heatWheelSt = !condPool.heatWheelSt }
- },
- FTrgTouchArea { touchArea:climate.heatWinSheild; touchAction: TA.Out
- FActScriptCall { onScript: condPool.heatWinSheildSt = !condPool.heatWinSheildSt }
- },
- FTrgTouchArea { touchArea:climate.defrost; touchAction: TA.Out
- FActScriptCall { onScript: condPool.defrostSt = !condPool.defrostSt }
- },
- FTrgTouchArea { touchArea:climate.pannel; touchAction: TA.Out
- FActScriptCall { onScript: condPool.pannelSt = !condPool.pannelSt }
- },
- FTrgTouchArea { touchArea:climate.floor; touchAction: TA.Out
- FActScriptCall { onScript: condPool.floorSt = !condPool.floorSt }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/ControlMirror.qml b/src/components/qt_hmi/References/Look/Views/ControlMirror.qml deleted file mode 100644 index 4cd1472c0d..0000000000 --- a/src/components/qt_hmi/References/Look/Views/ControlMirror.qml +++ /dev/null @@ -1,55 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 5
- property string dirTuneEntry: ""
-
-
- FTimer { id: popupEnd; interval: 2500; repeat: false }
-
- view: FView {
- id: v
-
- layout: ControlMirrorLayout {
- id:home
- }
-
-
- }
-
-
-
-
- triggers: [
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- },
- FTrgEntry{
- FActTimer { timer: popupEnd; action: TM.Start }
- },
- FTrgTimer{timer: popupEnd
- FActTimer { timer: popupEnd; action: TM.Stop }
- FActViewHide { }
- },
- FTrgHardwareKey { hardkeys: buttonUp; keyAction: HK.In
- FActTimer { timer: popupEnd; action: TM.Restart }
- // FActScriptCall { onScript: condPool.climateOnOff = true }
- FGrdCondition { condition: dataPool.drvTemp !== 80
- FActScriptCall { onScript: dataPool.drvTemp = (dataPool.drvTemp+1) }
- }
- },
- FTrgHardwareKey { hardkeys: buttonDown; keyAction: HK.In
- FActTimer { timer: popupEnd; action: TM.Restart }
- // FActScriptCall { onScript: condPool.climateOnOff = true }
- FGrdCondition { condition: dataPool.drvTemp !== 65
- FActScriptCall { onScript: dataPool.drvTemp = (dataPool.drvTemp-1) }
- }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/FM.qml b/src/components/qt_hmi/References/Look/Views/FM.qml deleted file mode 100644 index 6aa98303bd..0000000000 --- a/src/components/qt_hmi/References/Look/Views/FM.qml +++ /dev/null @@ -1,94 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: FMLayout {
- id:home
- preset1Btn.text: dataPool.fm1pre1
- preset2Btn.text: dataPool.fm1pre2
- preset3Btn.text: dataPool.fm1pre3
- preset4Btn.text: dataPool.fm1pre4
- preset5Btn.text: dataPool.fm1pre5
- preset6Btn.text: dataPool.fm1pre6
- trackTxt.text: dataPool.currStation
- stationTxt.text: dataPool.currStatText
- artistTxt.text: dataPool.currSong
- albumInfoBtn.bitmap: dataPool.currAlbumArt
- }
-
-
- }
-
-
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChange" }
- },
- FTrgTouchArea { touchArea:home.browseBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.albumInfoBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset1Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre1 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat1}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song1 }
- },
- FTrgTouchArea { touchArea:home.preset2Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre2 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat2}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song2 }
- },
- FTrgTouchArea { touchArea:home.preset3Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre3 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat3}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song3 }
- },
- FTrgTouchArea { touchArea:home.preset4Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre4 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat4}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song4 }
- },
- FTrgTouchArea { touchArea:home.preset5Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre5 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat5}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song5 }
- },
- FTrgTouchArea { touchArea:home.preset6Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre6 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat6}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song6 }
- },
- FTrgTouchArea { touchArea:home.replayBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.tuneBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.presetsBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/FMPCA.qml b/src/components/qt_hmi/References/Look/Views/FMPCA.qml deleted file mode 100644 index 1e9a46a0b3..0000000000 --- a/src/components/qt_hmi/References/Look/Views/FMPCA.qml +++ /dev/null @@ -1,175 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- attachedViews: ["PCAstatusBar"]
- property int currHD: 1
- property int totalHD: 4
-
-
-
- view: FView {
- id: v
-
- layout: FMLayoutPCA {
- id:home
- sourceBtn.text: "FM Radio"
- sourceBtn.textWidth: 100
- freqId: "FM"
- curHD: currHD
- totHD: totalHD
- curPreset: dataPool.currFMpreset
-
- listModel: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- }
-
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: preset1; menuText: "96.3"; menuData: false; }
- FMenuElement { id: preset2; menuText: "107.9"; menuData: false }
- FMenuElement { id: preset3; menuText: "104.3"; menuData: false }
- FMenuElement { id: preset4; menuText: "101.9"; menuData: false }
- FMenuElement { id: preset5; menuText: "97.1"; menuData: false }
- FMenuElement { id: preset6; menuText: "91.7"; menuData: false }
- FMenuElement { id: preset7; menuText: "101.1"; menuData: false }
- FMenuElement { id: preset8; menuText: "91.9"; menuData: false}
- }
- }
-
-
- triggers: [
-
- FTrgCondition{ condition: home.moving === true
- FActScriptCall { onScript: home.page1=!home.page1 }
- },
- FTrgEntry{
- FGrdCondition{condition: dataPool.currFMpreset === 1
- FActScriptCall { onScript: home.stationTxt = "96.3" }
- }
- FGrdCondition{condition: dataPool.currFMpreset === 2
- FActScriptCall { onScript: home.stationTxt = "107.9" }
- }
- FGrdCondition{condition: dataPool.currFMpreset === 3
- FActScriptCall { onScript: home.stationTxt = "104.3" }
- }
- FGrdCondition{condition: dataPool.currFMpreset === 4
- FActScriptCall { onScript: home.stationTxt = "101.9" }
- }
- FGrdCondition{condition: dataPool.currFMpreset === 5
- FActScriptCall { onScript: home.stationTxt = "97.1" }
- }
- FGrdCondition{condition: dataPool.currFMpreset === 6
- FActScriptCall { onScript: home.stationTxt = "91.7" }
- }
- FGrdCondition{condition: dataPool.currFMpreset === 7
- FActScriptCall { onScript: home.stationTxt = "101.1" }
- }
- FGrdCondition{condition: dataPool.currFMpreset === 8
- FActScriptCall { onScript: home.stationTxt = "91.9" }
- }
- },
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChangePCA" }
- },
- FTrgTouchArea { touchArea:home.hdBtn.touchBtn; touchAction: TA.Out
- FGrdCondition { condition: currHD === totalHD
- FActScriptCall { onScript: currHD = 1 }
- }
- FGrdCondition { condition: currHD !== totalHD
- FActScriptCall { onScript: currHD ++}
- }
- },
- FTrgMenuElement { menuElement: preset1
- FActScriptCall { onScript: home.stationTxt = "96.3" }
- FActScriptCall { onScript: dataPool.currFMpreset = 1 }
- },
- FTrgMenuElement { menuElement: preset2
- FActScriptCall { onScript: home.stationTxt = "107.9" }
- FActScriptCall { onScript: dataPool.currFMpreset = 2 }
- },
- FTrgMenuElement { menuElement: preset3
- FActScriptCall { onScript: home.stationTxt = "104.3" }
- FActScriptCall { onScript: dataPool.currFMpreset = 3 }
- },
- FTrgMenuElement { menuElement: preset4
- FActScriptCall { onScript: home.stationTxt = "101.9" }
- FActScriptCall { onScript: dataPool.currFMpreset = 4 }
- },
- FTrgMenuElement { menuElement: preset5
- FActScriptCall { onScript: home.stationTxt = "97.1" }
- FActScriptCall { onScript: dataPool.currFMpreset = 5 }
- },
- FTrgMenuElement { menuElement: preset6
- FActScriptCall { onScript: home.stationTxt = "91.7" }
- FActScriptCall { onScript: dataPool.currFMpreset = 6 }
- },
- FTrgMenuElement { menuElement: preset7
- FActScriptCall { onScript: home.stationTxt = "101.1" }
- FActScriptCall { onScript: dataPool.currFMpreset = 7 }
- },
- FTrgMenuElement { menuElement: preset8
- FActScriptCall { onScript: home.stationTxt = "91.9" }
- FActScriptCall { onScript: dataPool.currFMpreset = 8 }
- },
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- },
- /*FTrgTouchArea { touchArea:home.browseBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.albumInfoBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset1Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre1 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat1}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song1 }
- },
- FTrgTouchArea { touchArea:home.preset2Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre2 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat2}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song2 }
- },
- FTrgTouchArea { touchArea:home.preset3Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre3 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat3}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song3 }
- },
- FTrgTouchArea { touchArea:home.preset4Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre4 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat4}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song4 }
- },
- FTrgTouchArea { touchArea:home.preset5Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre5 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat5}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song5 }
- },
- FTrgTouchArea { touchArea:home.preset6Btn; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currStation = dataPool.fm1pre6 }
- FActScriptCall { onScript:dataPool.currStatText = dataPool.fm1stat6}
- FActScriptCall { onScript:dataPool.currSong=dataPool.fm1song6 }
- },
- FTrgTouchArea { touchArea:home.replayBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
-
- FTrgTouchArea { touchArea:home.presetsBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },*/
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/GenListHandling.qml b/src/components/qt_hmi/References/Look/Views/GenListHandling.qml deleted file mode 100644 index 9abdb899fc..0000000000 --- a/src/components/qt_hmi/References/Look/Views/GenListHandling.qml +++ /dev/null @@ -1,14 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-
-FState {
-
-
- triggers: [
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/GridMenuPCA.qml b/src/components/qt_hmi/References/Look/Views/GridMenuPCA.qml deleted file mode 100644 index fd43775f0d..0000000000 --- a/src/components/qt_hmi/References/Look/Views/GridMenuPCA.qml +++ /dev/null @@ -1,87 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-
-FStateView {
- id:sv
- priority: 2
-
- view: FView {
- //viewClass: baseScreen
- layout: TileBackImgLayoutPCA {
- id:l
- itemWidth: 266
-
-
-
- listWrap: false
- list_data: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- list_itemWidget: GridViewImgItemWidget {
- width: 266
- }
- }
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: climate; menuIcon: "menu/snow.png"}
- FMenuElement { id: phone; menuIcon: "menu/phone.png" }
- FMenuElement { id: navigation; menuIcon: "menu/arrow.png" }
- FMenuElement { id: myVeh; menuIcon: "menu/car.png" }
- FMenuElement { id: entertainment; menuIcon: "menu/notes.png" }
- FMenuElement { id: settings; menuIcon: "menu/gear.png" }
- }
-
- FViewUseCaseSimple { condition: sv.isInEntry
- PropertyChanges { target: l; list_data: null }
- }
- }
-
- baseBehavior: GenListHandling {}
-
- triggers: [
- // Example for a menu element trigger. This will only work for FMenuModels.
- FTrgMenuElement { menuElement: climate
- FActViewShow { view: "ClimatePCA" }
- },
- FTrgMenuElement { menuElement: phone
- FActViewShow { view: "PhonePCA" }
- },
- FTrgMenuElement { menuElement: navigation
- FActViewShow { view: "NavNoRoute" }
- },
- FTrgMenuElement { menuElement: myVeh
- FActViewShow { view: "MyVehiclePCA" }
- },
- FTrgMenuElement { menuElement: entertainment
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: settings
- },
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- },
- FTrgEntry {
- FActScriptCall { onScript: dataPool.mainPCAmenuShown = true }
- FActScriptCall { onScript: { FLogger.debug("Test", "Entry") } }
- },
- FTrgEntryComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "EntryComplete") } }
- },
- FTrgExit {
- FActScriptCall { onScript: dataPool.mainPCAmenuShown = false }
- FActScriptCall { onScript: { FLogger.debug("Test", "Exit") } }
- },
- FTrgExitComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "ExitComplete") } }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/Home.qml b/src/components/qt_hmi/References/Look/Views/Home.qml deleted file mode 100644 index 3a7edc353d..0000000000 --- a/src/components/qt_hmi/References/Look/Views/Home.qml +++ /dev/null @@ -1,50 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: HomeLayout {
- id:home
-
- }
-
-
- }
-
- triggers: [
-
-
- /*FTrgHardwareKey { hardkeys: hk_OnOff; keyAction: HK.In
- FActEventFire { event: closeNormalScreens }
- FActViewShow { view: "Off" }
- },*/
- FTrgTouchArea { touchArea:home.button1; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.button2; touchAction: TA.Out
- FActViewShow { view: "RadioEventHandling" }
- },
- FTrgTouchArea { touchArea:home.button3; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.button4; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/List.qml b/src/components/qt_hmi/References/Look/Views/List.qml deleted file mode 100644 index 5f63b77461..0000000000 --- a/src/components/qt_hmi/References/Look/Views/List.qml +++ /dev/null @@ -1,74 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
-
-
-
- view: FView {
- id: v
-
- layout: ListLayout {
- id:list
-
-
- listWrap: true
- list_data: menuItemData
- list_itemWidget: MenuListItemWidget { }
-
- }
-
-
- }
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: menuAudio; menuText: "Audio Settings"; menuType: FMenuElement.Submenu
- FMenuElement { id: menuAudio1; menuText: "Audio 1"; menuType: FMenuElement.Submenu
- FMenuElement { id: menuAudio11; menuText: "Audio 11"; menuType: FMenuElement.Popup }
- FMenuElement { id: menuAudio12; menuText: "Audio 12"; menuType: FMenuElement.Popup }
- }
- FMenuElement { id: menuAudio2; menuText: "Audio 2"; menuType: FMenuElement.Popup }
- FMenuElement { id: menuAudio3; menuText: "Audio 3"; menuType: FMenuElement.Popup }
- }
- FMenuElement { id: menuVehicle; menuText: "Vehicle Settings"; menuType: FMenuElement.Submenu; isVisible: false }
- FMenuElement { id: menuClock; menuText: "Clock Settings"; menuType: FMenuElement.Submenu }
- FMenuElement { id: menuDisplay; menuText: "Display Settings"; menuType: FMenuElement.Submenu }
- FMenuElement { id: menuMC; menuText: "Message Centre"; menuType: FMenuElement.Popup }
- }
-
- triggers: [
- FTrgEntry {
- FActScriptCall {onScript: condPool.settingsOpen=true}
-
- },
- FTrgExit {
- FActScriptCall {onScript: condPool.settingsOpen=false}
- },
-
- /*FTrgHardwareKey { hardkeys: hk_OnOff; keyAction: HK.In
- FActEventFire { event: closeNormalScreens }
- FActViewShow { view: "Off" }
- },*/
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- },
-
-
- // Example for a menu element trigger. This will only work for FMenuModels.
- FTrgMenuElement { menuElement: menuAudio
- FActScriptCall { onScript: menuAudio.isOpened = !menuAudio.isOpened }
- },
- // Example to use a list model trigger. This will work for all classes derived from FAbstractListModel (E.g. TreeModel, MenuModel)
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/MenuTopLevelGrid.qml b/src/components/qt_hmi/References/Look/Views/MenuTopLevelGrid.qml deleted file mode 100644 index ce477a12a7..0000000000 --- a/src/components/qt_hmi/References/Look/Views/MenuTopLevelGrid.qml +++ /dev/null @@ -1,85 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-
-FStateView {
- id:sv
- priority: 2
-
- view: FView {
- //viewClass: baseScreen
- layout: TC1_B1_Grid {
- id:l
-
-
- listWrap: false
- list_data: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- list_itemWidget: GridViewItemWidget {
-
- }
- }
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: menuAudio; menuText: "AM"; menuType: FMenuElement.Submenu}
- FMenuElement { id: menuVehicle; menuText: "FM"; menuType: FMenuElement.Submenu; isVisible: false}
- FMenuElement { id: menuClock; menuText: "Sirius"; menuType: FMenuElement.Submenu }
- FMenuElement { id: menuDisplay; menuText: "CD"; menuType: FMenuElement.Submenu }
- FMenuElement { id: menuMC; menuText: "BT Audio"; menuType: FMenuElement.Popup }
- FMenuElement { menuText: "USB"; menuType: FMenuElement.Popup }
- FMenuElement { menuText: "Dummy 2"; menuType: FMenuElement.Popup }
- FMenuElement { menuText: "Dummy 3"; menuType: FMenuElement.Popup }
- FMenuElement { menuText: "Dummy 4"; menuType: FMenuElement.Popup }
- FMenuElement { menuText: "Dummy 5"; menuType: FMenuElement.Popup }
- FMenuElement { menuText: "Dummy 6"; menuType: FMenuElement.Popup }
- FMenuElement { menuText: "Dummy 7"; menuType: FMenuElement.Popup }
- FMenuElement { menuText: "Dummy 8"; menuType: FMenuElement.Popup }
- }
-
- FViewUseCaseSimple { condition: sv.isInEntry
- PropertyChanges { target: l; list_data: null }
- }
- }
-
- baseBehavior: GenListHandling {}
-
- triggers: [
- // Example for a menu element trigger. This will only work for FMenuModels.
- FTrgMenuElement { menuElement: menuAudio
- FGrdCondition { condition: menuAudio.isEnabled
- FActViewShow { view: "MenuAudioSettings"; animation: "AnimWiperRight" }
- }
- },
- FTrgMenuElement { menuElement: menuClock
- FActViewShow { view: "MenuTopLevelMenu" }
- },
- FTrgMenuElement { menuElement: menuVehicle
- FActViewShow { view: "MenuTopLevelMenu"; animation: "AnimWiperRight" }
- },
- // Example to use a list model trigger. This will work for all classes derived from FAbstractListModel (E.g. TreeModel, MenuModel)
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- },
- FTrgEntry {
- FActScriptCall { onScript: { FLogger.debug("Test", "Entry") } }
- },
- FTrgEntryComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "EntryComplete") } }
- },
- FTrgExit {
- FActScriptCall { onScript: { FLogger.debug("Test", "Exit") } }
- },
- FTrgExitComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "ExitComplete") } }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/MyVehiclePCA.qml b/src/components/qt_hmi/References/Look/Views/MyVehiclePCA.qml deleted file mode 100644 index 6ecc512b60..0000000000 --- a/src/components/qt_hmi/References/Look/Views/MyVehiclePCA.qml +++ /dev/null @@ -1,85 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-
-FStateView {
- id:sv
- priority: 2
-
- view: FView {
- //viewClass: baseScreen
- layout: TileBackImgLayoutPCA {
- id:l
-
-
- //useClose: true
- listWrap: false
- list_data: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- list_itemWidget: GridViewImgItemWidget {
-
- }
- }
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: ev; menuIcon: "Vehicle/EV Icon.png"}
- FMenuElement { id: aLight; menuIcon: "Vehicle/Ambient Lighti Icon.png" }
- FMenuElement { id: mcs; menuIcon: "Vehicle/MCS Icon.png" }
- FMenuElement { id: weather; menuIcon: "Vehicle/sun.png" }
- FMenuElement { id: kepad; menuIcon: "Vehicle/key_car.png" }
- FMenuElement { id: calendar; menuIcon: "Vehicle/cal.png" }
- FMenuElement { id: browse; menuIcon: "Vehicle/folders.png" }
- FMenuElement { id: syncServices; menuIcon: "Vehicle/SYNC Services.png"}
- }
-
- FViewUseCaseSimple { condition: sv.isInEntry
- PropertyChanges { target: l; list_data: null }
- }
- }
-
- baseBehavior: GenListHandling {}
-
- triggers: [
- // Example for a menu element trigger. This will only work for FMenuModels.
- FTrgMenuElement { menuElement: ev
- },
- FTrgMenuElement { menuElement: aLight
- },
- FTrgMenuElement { menuElement: mcs
- },
- FTrgMenuElement { menuElement: weather
- },
- FTrgMenuElement { menuElement: kepad
- },
- FTrgMenuElement { menuElement: calendar
- },
- FTrgMenuElement { menuElement: browse
- },
- FTrgMenuElement { menuElement: syncServices
- },
- FTrgTouchArea { touchArea:l.close; touchAction: TA.Out
- FActViewShow { view: "GridMenuPCA" }
- },
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- },
- FTrgEntry {
- FActScriptCall { onScript: { FLogger.debug("Test", "Entry") } }
- },
- FTrgEntryComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "EntryComplete") } }
- },
- FTrgExit {
- FActScriptCall { onScript: { FLogger.debug("Test", "Exit") } }
- },
- FTrgExitComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "ExitComplete") } }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/NavInRoute.qml b/src/components/qt_hmi/References/Look/Views/NavInRoute.qml deleted file mode 100644 index e21d60a3cd..0000000000 --- a/src/components/qt_hmi/References/Look/Views/NavInRoute.qml +++ /dev/null @@ -1,38 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
-
-
- view: FView {
- id: v
-
- layout: NavInRouteLayout {
- id:map
-
-
- }
-
- }
-
-
-
- triggers: [
- FTrgTouchArea { touchArea:map.cancel; touchAction: TA.Out
- FActViewShow { view: "NavNoRoute" }
- },
- FTrgTouchArea { touchArea:map.mute; touchAction: TA.Out
- FActScriptCall { onScript: { map.muteSt = !map.muteSt} }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/NavKeyboardPCA.qml b/src/components/qt_hmi/References/Look/Views/NavKeyboardPCA.qml deleted file mode 100644 index a3499f89d3..0000000000 --- a/src/components/qt_hmi/References/Look/Views/NavKeyboardPCA.qml +++ /dev/null @@ -1,159 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- attachedViews: ["PCAstatusBar"]
-
-
- view: FView {
- id: v
-
- layout: NavKeyboardLayout {
- id:nav
- entry:dataPool.navEnrty
- list_data:sItemData
- list_itemWidget: VerySimpleListItemWidget {
- vis: false
-
- }
- }
-
- }
- ListModel
- {
-
- id:sItemData
- ListElement { staticItem: "Five Guys" }
- ListElement { staticItem: "Archers Of Loaf" }
- ListElement { staticItem: "Bob Mould" }
- ListElement { staticItem: "Cat Power" }
- ListElement { staticItem: "Cloud Nothings"}
- ListElement { staticItem: "Dentist"}
- ListElement { staticItem: "Dirty Frank's" }
- ListElement { staticItem: "Grouplove" }
- ListElement { staticItem: "Hudson Bell"}
- ListElement { staticItem: "Japandroids" }
- ListElement { staticItem: "Macklemore & Ryan Lewis"}
- ListElement { staticItem: "The National"}
- ListElement { staticItem: "Titus Andronicus" }
- ListElement { staticItem: "Tito" }
- ListElement { staticItem: "Tamal" }
- ListElement { staticItem: "Taco" }
-
- }
-
- triggers: [
-
- FTrgTouchArea { touchArea:nav.listOpen; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= ""}
- FActViewShow { view: "NavInRoute" }
- },
- FTrgTouchArea { touchArea:nav.a; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"a"}
- },
- FTrgTouchArea { touchArea:nav.b; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"b"}
- },
- FTrgTouchArea { touchArea:nav.c; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"c"}
- },
- FTrgTouchArea { touchArea:nav.d; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"d"}
- },
- FTrgTouchArea { touchArea:nav.e; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"e"}
- },
- FTrgTouchArea { touchArea:nav.f; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"f"}
- },
- FTrgTouchArea { touchArea:nav.g; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"g"}
- },
- FTrgTouchArea { touchArea:nav.h; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"h"}
- },
- FTrgTouchArea { touchArea:nav.i; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"i"}
- },
- FTrgTouchArea { touchArea:nav.j; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"j"}
- },
- FTrgTouchArea { touchArea:nav.k; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"k"}
- },
- FTrgTouchArea { touchArea:nav.l; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"l"}
- },
- FTrgTouchArea { touchArea:nav.m; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"m"}
- },
- FTrgTouchArea { touchArea:nav.n; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"n"}
- },
- FTrgTouchArea { touchArea:nav.o; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"o"}
- },
- FTrgTouchArea { touchArea:nav.p; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"p"}
- },
- FTrgTouchArea { touchArea:nav.q; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"q"}
- },
- FTrgTouchArea { touchArea:nav.r; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"r"}
- },
- FTrgTouchArea { touchArea:nav.s; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"s"}
- },
- FTrgTouchArea { touchArea:nav.t; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"t"}
- },
- FTrgTouchArea { touchArea:nav.u; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"u"}
- },
- FTrgTouchArea { touchArea:nav.v; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"v"}
- },
- FTrgTouchArea { touchArea:nav.w; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"w"}
- },
- FTrgTouchArea { touchArea:nav.xB; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"x"}
- },
- FTrgTouchArea { touchArea:nav.yB; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"y"}
- },
- FTrgTouchArea { touchArea:nav.zB; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+"z"}
- },
- FTrgTouchArea { touchArea:nav.num; touchAction: TA.Out
- },
- FTrgTouchArea { touchArea:nav.clr; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= ""}
- },
- FTrgTouchArea { touchArea:nav.space; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty+" "}
- },
- FTrgTouchArea { touchArea:nav.del; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.navEnrty= dataPool.navEnrty.substring(0,dataPool.navEnrty.length-1)}
- },
- FTrgTouchArea { touchArea:nav.sym; touchAction: TA.Out
- },
- FTrgTouchArea { touchArea:nav.go; touchAction: TA.Out
- FActViewShow { view: "NavInRoute" }
- },
- FTrgTouchArea { touchArea:nav.close; touchAction: TA.Out
- FActViewShow { view: "NavNoRoute" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/NavMenu.qml b/src/components/qt_hmi/References/Look/Views/NavMenu.qml deleted file mode 100644 index 8d22aa77ea..0000000000 --- a/src/components/qt_hmi/References/Look/Views/NavMenu.qml +++ /dev/null @@ -1,85 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-
-FStateView {
- id:sv
- priority: 2
-
- view: FView {
- //viewClass: baseScreen
- layout: TileBackLayoutPCA {
- id:l
-
-
- listWrap: false
- list_data: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- list_itemWidget: GridViewItemWidget {
-
- }
- }
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: sourceAM; menuText: "Home"; }
- FMenuElement { id: sourceFM; menuText: "Work"; }
- FMenuElement { id: sourceCD; menuText: "Keyboard"; }
- FMenuElement { id: sourceSat; menuText: "Recent"; }
- FMenuElement { id: sourceBt; menuText: "Favorites"; }
- FMenuElement { id: sourceIpod; menuText: "POI"; }
- FMenuElement { id: sourceUSB; menuText: "Scout"; }
- FMenuElement { id: sourceLineIn; menuText: "Waze";}
- }
-
- FViewUseCaseSimple { condition: sv.isInEntry
- PropertyChanges { target: l; list_data: null }
- }
- }
-
- baseBehavior: GenListHandling {}
-
- triggers: [
- // Example for a menu element trigger. This will only work for FMenuModels.
- FTrgMenuElement { menuElement: sourceAM
- },
- FTrgMenuElement { menuElement: sourceFM
- },
- FTrgMenuElement { menuElement: sourceSat
- },
- FTrgMenuElement { menuElement: sourceCD
- FActViewShow { view: "NavKeyboardPCA" }
- },
- FTrgMenuElement { menuElement: sourceBt
- },
- FTrgMenuElement { menuElement: sourceIpod
- },
- FTrgMenuElement { menuElement: sourceUSB
- },
- FTrgMenuElement { menuElement: sourceLineIn
- },
- FTrgTouchArea { touchArea:l.close; touchAction: TA.Out
- FActViewShow { view: "NavNoRoute" }
- },
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- },
- FTrgEntry {
- FActScriptCall { onScript: { FLogger.debug("Test", "Entry") } }
- },
- FTrgEntryComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "EntryComplete") } }
- },
- FTrgExit {
- FActScriptCall { onScript: { FLogger.debug("Test", "Exit") } }
- },
- FTrgExitComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "ExitComplete") } }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/NavNoRoute.qml b/src/components/qt_hmi/References/Look/Views/NavNoRoute.qml deleted file mode 100644 index 0299c182e8..0000000000 --- a/src/components/qt_hmi/References/Look/Views/NavNoRoute.qml +++ /dev/null @@ -1,35 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
-
-
- view: FView {
- id: v
-
- layout: NavNoRouteLayout {
- id:map
-
-
- }
-
- }
-
-
-
- triggers: [
- FTrgTouchArea { touchArea:map.destSearch; touchAction: TA.Out
- FActViewShow { view: "NavMenu" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/Off.qml b/src/components/qt_hmi/References/Look/Views/Off.qml deleted file mode 100644 index 3e75999c66..0000000000 --- a/src/components/qt_hmi/References/Look/Views/Off.qml +++ /dev/null @@ -1,34 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 1
-
- view: FView {
- layout: OffLayout {
- id:l
- }
- }
-
- triggers: [
- FTrgHardwareKey { hardkeys: hk_OnOff; keyAction: HK.In
- FActViewShow { view: "On" }
- },
- FTrgTouchArea { touchArea:l.offTouch; touchAction: TA.Out
- FActViewShow { view: "On" }
- },
- /*FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- },*/
- FTrgEntry {
- //FActScriptCall { onScript: dataPool.phoneCrnIcons = false}
- //FActScriptCall { onScript: dataPool.phonePaired = false}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/On.qml b/src/components/qt_hmi/References/Look/Views/On.qml deleted file mode 100644 index 6e09534309..0000000000 --- a/src/components/qt_hmi/References/Look/Views/On.qml +++ /dev/null @@ -1,38 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 1
-
- view: FView {
- layout: OffLayout {
- id:l
- offTouch.enabled: false
- }
- }
-
- triggers: [
- FTrgEntry {
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewShow { view: "Off" }
- },
- FTrgHardwareKey { hardkeys: hk_OnOff; keyAction: HK.In
- //FActViewShow { view: "Off" }
- FActEventFire{ event: closeNormalScreens }
- },
- FTrgHardwareKey { hardkeys: buttonUp; keyAction: HK.In
- FActViewShow { view: "ControlMirror" }
- },
- FTrgHardwareKey { hardkeys: buttonDown; keyAction: HK.In
- FActViewShow { view: "ControlMirror" }
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/PCAstatusBar.qml b/src/components/qt_hmi/References/Look/Views/PCAstatusBar.qml deleted file mode 100644 index e235f9c159..0000000000 --- a/src/components/qt_hmi/References/Look/Views/PCAstatusBar.qml +++ /dev/null @@ -1,37 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 8
-
-
- view: FView {
- id: v
-
- layout: PCAstatusBarLayout {
- id:statusBar
-
- }
-
- }
-
-
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:statusBar.menuTouch; touchAction: TA.Out
- FActViewShow { view: "GridMenuPCA" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/PhoneContactsListView.qml b/src/components/qt_hmi/References/Look/Views/PhoneContactsListView.qml deleted file mode 100644 index f64062f3ab..0000000000 --- a/src/components/qt_hmi/References/Look/Views/PhoneContactsListView.qml +++ /dev/null @@ -1,104 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-
-FStateView {
- priority: 2
- view: FView {
- layout: PhoneContactsLayout {
- id:l
- list_data:phoneItemData
- list_itemWidget: PhoneContactListItemWdgt {
- itemClicked: childClicked
-
- }
- }
- }
-
- FEvent {id: browseSelected}
-
- ListModel
- {
-
- id:phoneItemData
- ListElement { staticItem: "Aaron" ; staticNumber:"(614)555-2444";type:"Mobile"}
- ListElement { staticItem: "Adrian" ; staticNumber:"(740)245-3434";type:"Mobile" }
- ListElement { staticItem: "Albert" ; staticNumber:"(614)245-5584";type:"Mobile" }
- ListElement { staticItem: "Alice" ; staticNumber:"(313)878-3566";type:"Office"}
- ListElement { staticItem: "Alec" ; staticNumber:"(917)608-2418";type:"Mobile"}
- ListElement { staticItem: "Alexander" ; staticNumber:"(614)608-2400";type:"Home"}
- ListElement { staticItem: "Alexander" ; staticNumber:"(614)608-2400";type:"Mobile"}
- ListElement { staticItem: "Amber" ; staticNumber:"(614)608-2111";type:"Mobile"}
- ListElement { staticItem: "Amy" ; staticNumber:"(440)245-3434";type:"Mobile" }
- ListElement { staticItem: "Andy" ; staticNumber:"(313)245-3434";type:"Mobile" }
- ListElement { staticItem: "Antje" ; staticNumber:"(567)245-3434";type:"Home" }
- ListElement { staticItem: "Barry" ; staticNumber:"(313)555-2211";type:"Mobile" }
- ListElement { staticItem: "Bea" ; staticNumber:"(614)455-3434";type:"Mobile" }
- ListElement { staticItem: "Ben" ; staticNumber:"(614)882-1843";type:"Office" }
- ListElement { staticItem: "Blake" ; staticNumber:"(330)149-7778";type:"Mobile" }
- ListElement { staticItem: "Bob Mould" ; staticNumber:"(313)245-3434";type:"Mobile" }
- ListElement { staticItem: "Brian" ; staticNumber:"(614)332-7499";type:"Mobile" }
- ListElement { staticItem: "Calvin" ; staticNumber:"(614)442-9974";type:"Mobile" }
- ListElement { staticItem: "Carl" ; staticNumber:"(567)773-3434";type:"Home" }
- ListElement { staticItem: "Cat Power" ; staticNumber:"(313)608-3434";type:"Home"}
- ListElement { staticItem: "Cathy" ; staticNumber:"(313)444-456";type:"Home"}
- ListElement { staticItem: "Chris" ; staticNumber:"(734)997-6514";type:"Home" }
- ListElement { staticItem: "Cloud Nothings"; staticNumber:"(444)608-543";type:"Mobile"}
- ListElement { staticItem: "Cody" ; staticNumber:"(567)365-8413";type:"Home" }
- ListElement { staticItem: "Curtis" ; staticNumber:"(614)245-1547";type:"Office" }
- ListElement { staticItem: "Dakota" ; staticNumber:"(567)555-4444";type:"Home" }
- ListElement { staticItem: "Dale" ; staticNumber:"(567)723-1974";type:"Mobile" }
- ListElement { staticItem: "Dallas"; staticNumber:"(614)556-879";type:"Home"}
- ListElement { staticItem: "Damian" ; staticNumber:"(614)245-3434";type:"Office" }
- ListElement { staticItem: "Daniel"; staticNumber:"(614)556-879";type:"Home"}
- ListElement { staticItem: "Darina"; staticNumber:"(313)895-888";type:"Mobile"}
- ListElement { staticItem: "Dee "; staticNumber:"(313)432-3434";type:"Home"}
- ListElement { staticItem: "Edward" ; staticNumber:"(917)608-975";type:"Office"}
- ListElement { staticItem: "Ferdinand" ; staticNumber:"(917)879-795";type:"Mobile"}
- ListElement { staticItem: "Gomez" ; staticNumber:"(313)455-543";type:"Mobile"}
- ListElement { staticItem: "Harry Potter"; staticNumber:"(313)888-432";type:"Home"}
- ListElement { staticItem: "Ivan"; staticNumber:"(313)996-225";type:"Home"}
- ListElement { staticItem: "James" ; staticNumber:"(917)608-3434";type:"Mobile"}
- ListElement { staticItem: "Karen"; staticNumber:"(313)998-332";type:"Home"}
- ListElement { staticItem: "Luis Torres"; staticNumber:"(313)779-111";type:"Home"}
- ListElement { staticItem: "Mary"; staticNumber:"(313)234-098";type:"Mobile"}
- ListElement { staticItem: "Neil"; staticNumber:"(313)444-112";type:"Mobile"}
- ListElement { staticItem: "Oswald"; staticNumber:"(313)456-921";type:"Mobile"}
- ListElement { staticItem: "Oscar"; staticNumber:"(313)332-778";type:"Home"}
- ListElement { staticItem: "Patrice"; staticNumber:"(313)789-111";type:"Mobile"}
- ListElement { staticItem: "Queen Elizabeth"; staticNumber:"(313)897-666";type:"Mobile"}
- ListElement { staticItem: "Rose"; staticNumber:"(313)111-211";type:"Mobile"}
- ListElement { staticItem: "Susell"; staticNumber:"(313)345-122";type:"Home"}
- ListElement { staticItem: "Susell"; staticNumber:"(313)345-122";type:"Home"}
- ListElement { staticItem: "Thomas"; staticNumber:"(917)608-342";type:"Mobile"}
- ListElement { staticItem: "Titus Andronicus" ; staticNumber:"(917)608-321";type:"Office"}
- ListElement { staticItem: "Toretto" ; staticNumber:"(917)608-3434";type:"Home"}
- ListElement { staticItem: "Uhl" ; staticNumber:"(313)444-654";type:"Office"}
- ListElement { staticItem: "Zara" ; staticNumber:"(313)231-009";type:"Mobile"}
-
- }
- FEvent { id: childClicked }
-
- triggers:[
- FTrgEntry {
- FActScriptCall{onScript: l.list.positionViewAtIndex(sortList.existChar(phoneItemData,dataPool.filterPhone),l.list.Beginning)}
- },
- FTrgTouchArea { touchArea:l.back; touchAction: TA.Out
- FActViewShow { view: "AlphaSortPCA" }
- },
- FTrgEvent { id: trig2; event: childClicked
- FActScriptCall { onScript:console.log(trig2.data) }
- }
-
-
-
- ]
-
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Views/PhonePCA.qml b/src/components/qt_hmi/References/Look/Views/PhonePCA.qml deleted file mode 100644 index 40969a3a64..0000000000 --- a/src/components/qt_hmi/References/Look/Views/PhonePCA.qml +++ /dev/null @@ -1,85 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-
-FStateView {
- id:sv
- priority: 2
-
- view: FView {
- //viewClass: baseScreen
- layout: TileBackImgLayoutPCA {
- id:l
-
- //useClose: true
- listWrap: false
- list_data: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- list_itemWidget: GridViewImgItemWidget {
-
- }
- }
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: phone; menuIcon: "menu/phone.png"}
- FMenuElement { id: dnd; menuIcon: "phone/DNDoff.png" }
- FMenuElement { id: phoneBook; menuIcon: "phone/contacts.png" }
- FMenuElement { id: recent; menuIcon: "phone/recent.png" }
- FMenuElement { id: messages; menuIcon: "phone/messages.png" }
- FMenuElement { id: keyPad; menuIcon: "phone/keypad.png" }
- FMenuElement { id: textMsg; menuIcon: "phone/texts.png" }
- FMenuElement { id: more; menuIcon: "phone/more.png"}
- }
-
- FViewUseCaseSimple { condition: sv.isInEntry
- PropertyChanges { target: l; list_data: null }
- }
- }
-
- baseBehavior: GenListHandling {}
-
- triggers: [
- // Example for a menu element trigger. This will only work for FMenuModels.
- FTrgMenuElement { menuElement: phone
- },
- FTrgMenuElement { menuElement: dnd
- },
- FTrgMenuElement { menuElement: phoneBook
- FActViewShow { view: "AlphaSortPCA" }
- },
- FTrgMenuElement { menuElement: recent
- },
- FTrgMenuElement { menuElement: more
- },
- FTrgMenuElement { menuElement: messages
- },
- FTrgMenuElement { menuElement: keyPad
- },
- FTrgMenuElement { menuElement: textMsg
- },
- FTrgTouchArea { touchArea:l.close; touchAction: TA.Out
- FActViewShow { view: "GridMenuPCA" }
- },
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- },
- FTrgEntry {
- FActScriptCall { onScript: { FLogger.debug("Test", "Entry") } }
- },
- FTrgEntryComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "EntryComplete") } }
- },
- FTrgExit {
- FActScriptCall { onScript: { FLogger.debug("Test", "Exit") } }
- },
- FTrgExitComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "ExitComplete") } }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/RadioEventHandling.qml b/src/components/qt_hmi/References/Look/Views/RadioEventHandling.qml deleted file mode 100644 index ef693d924c..0000000000 --- a/src/components/qt_hmi/References/Look/Views/RadioEventHandling.qml +++ /dev/null @@ -1,37 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 0
-
- view: FView {
- layout: BlankLayout {
- id:l
- }
- }
-
- triggers: [
- FTrgEntry {
- FGrdCondition{ condition: dataPool.currSource==="FM"
- FActViewShow{ view: "FMPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="USB"
- FActViewShow{ view: "USB"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="AM"
- FActViewShow{ view: "AM"}
- FActViewHide{}
- }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/RadioEventHandlingPCA.qml b/src/components/qt_hmi/References/Look/Views/RadioEventHandlingPCA.qml deleted file mode 100644 index 90bf0a801a..0000000000 --- a/src/components/qt_hmi/References/Look/Views/RadioEventHandlingPCA.qml +++ /dev/null @@ -1,61 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 0
-
- view: FView {
- layout: BlankLayout {
- id:l
- }
- }
-
- triggers: [
- FTrgEntry {
- FGrdCondition{ condition: dataPool.currSource==="FM"
- FActViewShow{ view: "FMPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="USB"
- FActViewShow{ view: "USBPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="AM"
- FActViewShow{ view: "AMPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="Sirius"
- FActViewShow{ view: "SiriusPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="CD"
- FActViewShow{ view: "CDPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="BT_Audio"
- FActViewShow{ view: "BT_AudioPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="iPod"
- FActViewShow{ view: "iPodPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="LineIn"
- FActViewShow{ view: "AuxPCA"}
- FActViewHide{}
- }
- FGrdCondition{ condition: dataPool.currSource==="SDL_Music"
- FActViewShow{ view: "SDL_MusicPCA"}
- FActViewHide{}
- }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/SDL_MusicPCA.qml b/src/components/qt_hmi/References/Look/Views/SDL_MusicPCA.qml deleted file mode 100644 index a68956518b..0000000000 --- a/src/components/qt_hmi/References/Look/Views/SDL_MusicPCA.qml +++ /dev/null @@ -1,48 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5 -import QtQuick 2.0 -import com.ford.hmiframework 1.0 -import "../Layouts" -import "../Animations" -import "../Widgets" -import ".." - -FStateView { - priority: 2 - //attachedViews: ["Chrome"] - - - - view: FView { - id: v - - layout: USBLayoutPCA { - id:home - sourceBtn.text: "SDL Music" - sourceBtn.textWidth: 100 - playing: true - } - - - } - - - - triggers: [ - - - - FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out - FActViewShow { view: "SourceChangePCA" } - }, - FTrgTouchArea { touchArea:home.play; touchAction: TA.Out - FActScriptCall { onScript: home.playing = false } - }, - FTrgTouchArea { touchArea:home.pause; touchAction: TA.Out - FActScriptCall { onScript: home.playing = true } - }, - FTrgEvent { event: closeNormalScreens - FActViewHide{} - } - - ] -} diff --git a/src/components/qt_hmi/References/Look/Views/Sirius.qml b/src/components/qt_hmi/References/Look/Views/Sirius.qml deleted file mode 100644 index bf16b810a5..0000000000 --- a/src/components/qt_hmi/References/Look/Views/Sirius.qml +++ /dev/null @@ -1,71 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: SiriusLayout {
- id:home
-
- }
-
-
- }
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChange" }
- },
- FTrgTouchArea { touchArea:home.browseBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.albumInfoBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset1Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset2Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset3Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset4Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset5Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.preset6Btn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.replayBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.tuneBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.presetsBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/SiriusPCA.qml b/src/components/qt_hmi/References/Look/Views/SiriusPCA.qml deleted file mode 100644 index afb5c42fc7..0000000000 --- a/src/components/qt_hmi/References/Look/Views/SiriusPCA.qml +++ /dev/null @@ -1,115 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: FMLayoutPCA {
- id:home
- sourceBtn.text: "Sirius"
- sourceBtn.textWidth: 70
- freqId: ""
- curPreset: dataPool.currSATpreset
- hdBtn.visible: false
-
-
- listModel: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- }
-
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: preset1; menuText: "Lithium"; menuData: true; }
- FMenuElement { id: preset2; menuText: "Spectrum"; menuData: false }
- FMenuElement { id: preset3; menuText: "ESPN"; menuData: false }
- FMenuElement { id: preset4; menuText: "Alt Nation"; menuData: false }
- FMenuElement { id: preset5; menuText: "NHL"; menuData: false }
- FMenuElement { id: preset6; menuText: "the Highway"; menuData: false }
- FMenuElement { id: preset7; menuText: "SiriusXMU"; menuData: false }
- FMenuElement { id: preset8; menuText: "First Wave"; menuData: false}
- }
- }
-
- triggers: [
-
- FTrgEntry{
- FGrdCondition{condition: dataPool.currSATpreset === 1
- FActScriptCall { onScript: home.stationTxt = "Lithium" }
- }
- FGrdCondition{condition: dataPool.currSATpreset === 2
- FActScriptCall { onScript: home.stationTxt = "Spectrum" }
- }
- FGrdCondition{condition: dataPool.currSATpreset === 3
- FActScriptCall { onScript: home.stationTxt = "ESPN" }
- }
- FGrdCondition{condition: dataPool.currSATpreset === 4
- FActScriptCall { onScript: home.stationTxt = "Alt Nation" }
- }
- FGrdCondition{condition: dataPool.currSATpreset === 5
- FActScriptCall { onScript: home.stationTxt = "NHL" }
- }
- FGrdCondition{condition: dataPool.currSATpreset === 6
- FActScriptCall { onScript: home.stationTxt = "the Highway" }
- }
- FGrdCondition{condition: dataPool.currSATpreset === 7
- FActScriptCall { onScript: home.stationTxt = "SiriusXMU" }
- }
- FGrdCondition{condition: dataPool.currSATpreset === 8
- FActScriptCall { onScript: home.stationTxt = "First Wave" }
- }
- },
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChangePCA" }
- },
- FTrgMenuElement { menuElement: preset1
- FActScriptCall { onScript: home.stationTxt = "Lithium" }
- FActScriptCall { onScript: dataPool.currSATpreset = 1 }
- },
- FTrgMenuElement { menuElement: preset2
- FActScriptCall { onScript: home.stationTxt = "Spectrum" }
- FActScriptCall { onScript: dataPool.currSATpreset = 2 }
- },
- FTrgMenuElement { menuElement: preset3
- FActScriptCall { onScript: home.stationTxt = "ESPN" }
- FActScriptCall { onScript: dataPool.currSATpreset = 3 }
- },
- FTrgMenuElement { menuElement: preset4
- FActScriptCall { onScript: home.stationTxt = "Alt Nation" }
- FActScriptCall { onScript: dataPool.currSATpreset = 4 }
- },
- FTrgMenuElement { menuElement: preset5
- FActScriptCall { onScript: home.stationTxt = "NHL" }
- FActScriptCall { onScript: dataPool.currSATpreset = 5 }
- },
- FTrgMenuElement { menuElement: preset6
- FActScriptCall { onScript: home.stationTxt = "the Highway" }
- FActScriptCall { onScript: dataPool.currSATpreset = 6 }
- },
- FTrgMenuElement { menuElement: preset7
- FActScriptCall { onScript: home.stationTxt = "SiriusXMU" }
- FActScriptCall { onScript: dataPool.currSATpreset = 7 }
- },
- FTrgMenuElement { menuElement: preset8
- FActScriptCall { onScript: home.stationTxt = "First Wave" }
- FActScriptCall { onScript: dataPool.currSATpreset = 8 }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/SourceChange.qml b/src/components/qt_hmi/References/Look/Views/SourceChange.qml deleted file mode 100644 index 42680f9e80..0000000000 --- a/src/components/qt_hmi/References/Look/Views/SourceChange.qml +++ /dev/null @@ -1,73 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: TileBackLayout {
- id:source
- button1.text: "AM"
- button2.text: "FM"
- button3.text: "Sirius"
- button4.text: "USB"
- button5.text: "BT Audio"
- button6.text: "Line In"
- button7.vis: false
- button8.vis: false
- }
-
-
- }
-
- triggers: [
-
-
- /*FTrgHardwareKey { hardkeys: hk_OnOff; keyAction: HK.In
- FActEventFire { event: closeNormalScreens }
- FActViewShow { view: "Off" }
- },*/
- FTrgTouchArea { touchArea:source.button1; touchAction: TA.Out
- FActScriptCall { onScript: dataPool.currSource = "AM" }
- FActViewShow { view: "RadioEventHandling" }
- },
- FTrgTouchArea { touchArea:source.button2; touchAction: TA.Out
- FActViewShow { view: "FM" }
- },
- FTrgTouchArea { touchArea:source.button3; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:source.button4; touchAction: TA.Out
- FActViewShow { view: "USB" }
- },
- FTrgTouchArea { touchArea:source.button5; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:source.button6; touchAction: TA.Out
- FActViewShow { view: "RadioEventHandling" }
- },
- FTrgTouchArea { touchArea:source.button7; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:source.button8; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:source.backBtn; touchAction: TA.Out
- FActViewShow { view: "RadioEventHandling" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/SourceChangePCA.qml b/src/components/qt_hmi/References/Look/Views/SourceChangePCA.qml deleted file mode 100644 index bb87d41c2c..0000000000 --- a/src/components/qt_hmi/References/Look/Views/SourceChangePCA.qml +++ /dev/null @@ -1,105 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-
-FStateView {
- id:sv
- priority: 2
-
- view: FView {
- //viewClass: baseScreen
- layout: TileBackLayoutPCA {
- id:l
-
-
- listWrap: false
- list_data: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- list_itemWidget: GridViewItemWidget {
-
- }
- }
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: sourceAM; menuText: "AM"; }
- FMenuElement { id: sourceFM; menuText: "FM"; }
- FMenuElement { id: sourceSat; menuText: "Sirius"; }
- FMenuElement { id: sourceCD; menuText: "CD"; }
- FMenuElement { id: sourceBt; menuText: "BT Audio"; }
- FMenuElement { id: sourceIpod; menuText: "iPod"; }
- FMenuElement { id: sourceUSB; menuText: "USB"; }
- FMenuElement { id: sourceLineIn; menuText: "Line In";}
- FMenuElement { id: sourceSDL; menuText: "SDL Music";}
- }
-
- FViewUseCaseSimple { condition: sv.isInEntry
- PropertyChanges { target: l; list_data: null }
- }
- }
-
- baseBehavior: GenListHandling {}
-
- triggers: [
- // Example for a menu element trigger. This will only work for FMenuModels.
- FTrgMenuElement { menuElement: sourceAM
- FActScriptCall { onScript: dataPool.currSource = "AM" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: sourceFM
- FActScriptCall { onScript: dataPool.currSource = "FM" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: sourceSat
- FActScriptCall { onScript: dataPool.currSource = "Sirius" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: sourceCD
- FActScriptCall { onScript: dataPool.currSource = "CD" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: sourceBt
- FActScriptCall { onScript: dataPool.currSource = "BT_Audio" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: sourceIpod
- FActScriptCall { onScript: dataPool.currSource = "iPod" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: sourceUSB
- FActScriptCall { onScript: dataPool.currSource = "USB" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: sourceLineIn
- FActScriptCall { onScript: dataPool.currSource = "LineIn" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgMenuElement { menuElement: sourceSDL
- FActScriptCall { onScript: dataPool.currSource = "SDL_Music" }
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgTouchArea { touchArea:l.close; touchAction: TA.Out
- FActViewShow { view: "RadioEventHandlingPCA" }
- },
- FTrgListModel { id: trgList; model: menuItemData
- FActScriptCall { onScript: { FLogger.debug("Test", trgList.element.menuText + ", index: " + trgList.index) } }
- },
- FTrgEntry {
- FActScriptCall { onScript: { FLogger.debug("Test", "Entry") } }
- },
- FTrgEntryComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "EntryComplete") } }
- },
- FTrgExit {
- FActScriptCall { onScript: { FLogger.debug("Test", "Exit") } }
- },
- FTrgExitComplete {
- FActScriptCall { onScript: { FLogger.debug("Test", "ExitComplete") } }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/Start.qml b/src/components/qt_hmi/References/Look/Views/Start.qml deleted file mode 100644 index 4858474011..0000000000 --- a/src/components/qt_hmi/References/Look/Views/Start.qml +++ /dev/null @@ -1,43 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: StartLayout {
- id:corner
-
- }
-
-
- }
-
- triggers: [
- FTrgEntry {
-
- },
-
- /*FTrgHardwareKey { hardkeys: hk_OnOff; keyAction: HK.In
- FActEventFire { event: closeNormalScreens }
- FActViewShow { view: "Off" }
- },*/
- FTrgTouchArea { touchArea:corner.button1; touchAction: TA.Out
- FActViewShow { view: "Home" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/USB.qml b/src/components/qt_hmi/References/Look/Views/USB.qml deleted file mode 100644 index 8931d61ff8..0000000000 --- a/src/components/qt_hmi/References/Look/Views/USB.qml +++ /dev/null @@ -1,59 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: USBLayout {
- id:home
-
- }
-
-
- }
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChange" }
- },
- FTrgTouchArea { touchArea:home.browseBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.albumInfoBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.seekBkBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.seekFdBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.playBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.shuffleBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgTouchArea { touchArea:home.repeatBtn; touchAction: TA.Out
- FActViewShow { view: "Start" }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/USBPCA.qml b/src/components/qt_hmi/References/Look/Views/USBPCA.qml deleted file mode 100644 index 0b1b47270e..0000000000 --- a/src/components/qt_hmi/References/Look/Views/USBPCA.qml +++ /dev/null @@ -1,49 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
-
- view: FView {
- id: v
-
- layout: USBLayoutPCA {
- id:home
- sourceBtn.text: "USB"
- sourceBtn.textWidth: 50
- playing: true
- }
-
-
- }
-
-
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChangePCA" }
- },
- FTrgTouchArea { touchArea:home.play; touchAction: TA.Out
- FActScriptCall { onScript: home.playing = false }
- },
- FTrgTouchArea { touchArea:home.pause; touchAction: TA.Out
- FActScriptCall { onScript: home.playing = true }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Views/iPodPCA.qml b/src/components/qt_hmi/References/Look/Views/iPodPCA.qml deleted file mode 100644 index f4d3f68b78..0000000000 --- a/src/components/qt_hmi/References/Look/Views/iPodPCA.qml +++ /dev/null @@ -1,48 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Layouts"
-import "../Animations"
-import "../Widgets"
-import ".."
-
-FStateView {
- priority: 2
- //attachedViews: ["Chrome"]
-
-
-
- view: FView {
- id: v
-
- layout: USBLayoutPCA {
- id:home
- sourceBtn.text: "iPod"
- sourceBtn.textWidth: 50
- playing: true
- }
-
-
- }
-
-
-
- triggers: [
-
-
-
- FTrgTouchArea { touchArea:home.sourceBtn.touchBtn; touchAction: TA.Out
- FActViewShow { view: "SourceChangePCA" }
- },
- FTrgTouchArea { touchArea:home.play; touchAction: TA.Out
- FActScriptCall { onScript: home.playing = false }
- },
- FTrgTouchArea { touchArea:home.pause; touchAction: TA.Out
- FActScriptCall { onScript: home.playing = true }
- },
- FTrgEvent { event: closeNormalScreens
- FActViewHide{}
- }
-
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/FocusListViewLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/FocusListViewLayout.qml deleted file mode 100644 index 2e89924a20..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/FocusListViewLayout.qml +++ /dev/null @@ -1,34 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: theLayout
-
- property alias list : theListView
- property alias list_itemWidget: theListView.itemWidget
- property alias list_data: theListView.data
- property bool listWrap: false
-
- FWdgtListView {
- id: theListView
- anchors.fill: theLayout
- clip: true
- //interactive: false
- highlightFollowsCurrentItem: true
- highlightMoveDuration: 100
- highlightMoveVelocity: -1
- keyNavigationWraps: listWrap
- highlight:
- Rectangle {
- id: focus
- height: 51
- width: theLayout.width
- radius: 10
- color: "transparent"
- border { color: "white"; width: 2 }
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewImgItemLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewImgItemLayout.qml deleted file mode 100644 index cbe1737984..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewImgItemLayout.qml +++ /dev/null @@ -1,25 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: theItem
- width: 200
- height: 178
-
- property alias bitmap : _img.bitmap
- property alias touch: _touch
-
-
- FWdgtImage{
- id: _img
- anchors.centerIn: theItem
- }
-
- FWdgtTouchArea{
- id: _touch
- anchors.fill: theItem
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewItemLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewItemLayout.qml deleted file mode 100644 index 2e7712a65e..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewItemLayout.qml +++ /dev/null @@ -1,24 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: theItem
-
- property alias cx_text : _btn.text
- property int indentLevel: 0
- property alias touch: _btn.touchBtn
- property alias pressed: _btn.pressed
-
-
- TouchButton_PCA{
- id: _btn
- anchors.left: theItem.left
- anchors.leftMargin: 10
- anchors.top: theItem.top
- anchors.topMargin: 10
- textWidth: 100
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewLayout.qml deleted file mode 100644 index d5fb962461..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewLayout.qml +++ /dev/null @@ -1,56 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: theLayout
-
- property alias list : theGridView
- property alias list_itemWidget: theGridView.itemWidget
- property alias list_data: theGridView.data
- property bool listWrap: false
- property alias gridItemHeight: theGridView.cellHeight
- property alias gridItemWidth: theGridView.cellWidth
-
- FWdgtGridView {
- id: theGridView
- anchors.fill: theLayout
- clip: true
- highlightFollowsCurrentItem: true
- highlightMoveDuration: 100
- keyNavigationWraps: listWrap
- flow: GridView.TopToBottom
- snapMode: GridView.SnapOneRow
-
-
-
-
- populate: Transition {
- id: populateTransition
- SequentialAnimation {
- PropertyAction { property: "opacity"; value: 0 }
- PauseAnimation { duration: populateTransition.ViewTransition.index * 100 }
- NumberAnimation { properties: "opacity"; from: 0; to: 1; duration: 300 }
- }
- }
-
- add: Transition {
- NumberAnimation { properties: "opacity"; from: 0; to: 1; duration: 200 }
- }
-
- addDisplaced: Transition {
- NumberAnimation { properties: "x"; duration: 200 }
- }
-
- remove: Transition {
- NumberAnimation { properties: "opacity"; from: 1; to: 0; duration: 200 }
- }
-
- removeDisplaced: Transition {
- NumberAnimation { properties: "x"; duration: 200 }
- }
-
- }
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewPresetItemLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewPresetItemLayout.qml deleted file mode 100644 index 9b28e961f9..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewPresetItemLayout.qml +++ /dev/null @@ -1,22 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FLayout {
- id: theItem
-
- property alias presetName : _preset.presetName
- property alias presetNumber: _preset.presetNumber
- property alias pressed: _preset.active
- property alias touchBtn: _preset.touchBtn
-
-
- PresetPCA{
- id: _preset
- anchors.horizontalCenter: theItem.horizontalCenter
- anchors.horizontalCenterOffset: 0
- y:20
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewPresetLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewPresetLayout.qml deleted file mode 100644 index 82068b5560..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/GridViewPresetLayout.qml +++ /dev/null @@ -1,61 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: theLayout
-
- property alias list : theGridView
- property alias list_itemWidget: theGridView.itemWidget
- property alias list_data: theGridView.data
- property bool listWrap: false
- property alias gridItemHeight: theGridView.cellHeight
- property alias gridItemWidth: theGridView.cellWidth
- property alias curItem: theGridView.currentIndex
- property alias moving: theGridView.moving
- property alias direction: theGridView.flickDeceleration
-
-
- FWdgtGridView {
- id: theGridView
- anchors.fill: theLayout
- clip: true
- highlightFollowsCurrentItem: true
- highlightMoveDuration: 100
- keyNavigationWraps: listWrap
- flow: GridView.TopToBottom
- snapMode: GridView.SnapToRow
-
-
-
-
-
- /* populate: Transition {
- id: populateTransition
- SequentialAnimation {
- PropertyAction { property: "opacity"; value: 0 }
- PauseAnimation { duration: populateTransition.ViewTransition.index * 100 }
- NumberAnimation { properties: "opacity"; from: 0; to: 1; duration: 300 }
- }
- }
-
- add: Transition {
- NumberAnimation { properties: "opacity"; from: 0; to: 1; duration: 200 }
- }
-
- addDisplaced: Transition {
- NumberAnimation { properties: "x"; duration: 200 }
- }
-
- remove: Transition {
- NumberAnimation { properties: "opacity"; from: 1; to: 0; duration: 200 }
- }
-
- removeDisplaced: Transition {
- NumberAnimation { properties: "x"; duration: 200 }
- }*/
-
- }
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/PhoneListWdgtLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/PhoneListWdgtLayout.qml deleted file mode 100644 index ee2c0369f0..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/PhoneListWdgtLayout.qml +++ /dev/null @@ -1,50 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
-
- id: theItem
- height: 50; width: 50
-
- property alias cx_text: cx.text
- property alias cn_text: cn.text
- property alias ct_text: ct.text
- property alias touch:_touch
-
- FWdgtTouchArea {
- id: touch
- anchors.fill: theItem
- }
-
- Item{
-
-
- BaseText{
- color:"#9deaec"
- id: cx
- width: 100; height: 50
-
- }
- BaseText{
- color:"#9deaec"
- id: cn
- width: 302; height: 50
- x:300
- }
-
- BaseText{
- color:"#9deaec"
- id: ct
- width: 302; height: 50
- x:500
- }
-
- }
- FWdgtTouchArea {
- id: _touch
- height: 50; width: 600
- }
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/PresetGridLayoutPCA.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/PresetGridLayoutPCA.qml deleted file mode 100644 index c927433f16..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/PresetGridLayoutPCA.qml +++ /dev/null @@ -1,40 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- width: 800
- height: 115
-
- property alias m1: m1.children
- property alias list: listView
- property alias list_data: listView.list_data
- property alias list_itemWidget: listView.list_itemWidget
- property alias listWrap: listView.listWrap
- property alias fg: _fg
- property alias gridCurItem: listView.gridCurItem
- property alias moving: listView.moving
- property alias direction: listView.direction
-
-
-
- Item {
- id: _fg
-
- width: 800; height: 115
-
- GridViewPresetWidget {
- id: listView
- x: 0; y: 0
- width: 800; height: 115
- gridItemHeight: 115; gridItemWidth: 200
-
- }
-
- FWdgtContainer {
- id: m1
- width: 676; height: 115
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/PresetPCALayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/PresetPCALayout.qml deleted file mode 100644 index 2b832f4878..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/PresetPCALayout.qml +++ /dev/null @@ -1,40 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: button
- property alias active: presetBtn.selected
- property alias text: presetBtn.text
- property alias touchBtn: presetBtn
- property alias presetText: presetTxt.text
-
-
- TouchButtonClimatePCA{
- id: presetBtn
- text: "X"
- image: "buttons/preset_9_9.png"
- imageActive: "buttons/presetSelected.png"
- imagePressed: "buttons/presetPressed_9_9.png"
- }
-
- BaseText{
- id: presetTxt
- anchors.horizontalCenter: presetBtn.horizontalCenter
- anchors.horizontalCenterOffset: -16
- y:59
- horAlignment: Text.AlignHCenter
- text: "104.3"
- color: "#1d81d5"
- }
-
- FViewUseCaseSimple{
- condition: presetBtn.active === true
- PropertyChanges {
- target: presetTxt; color: "white"
- }
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/SimpleItemWdgLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/SimpleItemWdgLayout.qml deleted file mode 100644 index d2dc8092bd..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/SimpleItemWdgLayout.qml +++ /dev/null @@ -1,24 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
-
- id: theItem
- height: 50; width: 50
- property bool vis: true
-
- property alias cx_text : cx.text
-
- Item{
-
- FWdgtText{
- color:"White"
- id: cx
- width: 302; height: 45
- visible: vis
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/TGListItemLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/TGListItemLayout.qml deleted file mode 100644 index 7708d3ca56..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/TGListItemLayout.qml +++ /dev/null @@ -1,50 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: theItem
- height: 50; width: parent.width
-
- property alias cx_text : cx.text
- property alias cx_width : cx.width
- property alias ax_width : ax.width
- property alias ax_bitmap : ax.bitmap
- property alias activeMarker_visible: activeMarker.visible
- property alias touch: _touch
- property int indentLevel: 0
-
- Rectangle {
- id: activeMarker
- anchors.fill: theItem
- height: 50
- radius: 10
- color: "lightgray"
- }
-
- Item {
- x: 1; y: 0
- width: 502; height: 45
-
- BaseText {
- id: cx
- anchors.fill: parent
- anchors.leftMargin: 20*indentLevel+5
- vertAlignment: Text.AlignVCenter
- }
- }
-
- FWdgtImage {
- id: ax
- x: 549; y: 3
- width: 37; height: 45
- }
-
- FWdgtTouchArea {
- id: _touch
- width: 400
- height: 50
- }
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonBackGroundPCALayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonBackGroundPCALayout.qml deleted file mode 100644 index ff6671cef6..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonBackGroundPCALayout.qml +++ /dev/null @@ -1,97 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: button
- property string bitmap: ""
- property bool selected: false
- property string text: ""
- property alias touchBtn: myButton
- property string image: "climate/Button_9_9.png"
- property string imageActive: "climate/ButtonActive_0_0.png"
- property string imagePressed: "climate/ButtonPressed_9_9.png"
- property string imageInActive: "climate/ButtonInActive_0_0.png"
- property bool active: true
-
-
- FWdgtImage{
- id: img
- x:-9
- y:-9
- bitmap: "Radio/PresetBtnNotSelected_9_9.png"
- }
-
- FWdgtImage{
- id: imgSelected
- x:-9
- y:-9
- bitmap: "Radio/PresetBtn_9_9.png"
- visible: false
- }
-
- FWdgtTouchArea {
- id: myButton
- anchors.fill: img
- }
-
- Rectangle {
- id: btnFill
- color: "#1d81d5"
- anchors.centerIn: myButton
- height: 46
- width: 46
- radius: 23
- visible: false
- }
-
- BaseText {
- id: btnTxt
- anchors.centerIn: myButton
- text: button.text
- color: "#1d81d5"
- }
-
-
- FViewUseCaseSimple{
- condition: button.selected === true
- PropertyChanges {
- target: img; visible: false
- }
- PropertyChanges {
- target: imgSelected; visible: true
- }
- PropertyChanges {
- target: btnTxt; color: "white"
- }
- PropertyChanges {
- target: btnFill; color: "white"
- }
- }
-
-
-
- FViewUseCaseGroup{
- FViewUseCase{condition: myButton.pressed === true
- PropertyChanges {
- target: btnFill; visible: true
- }
- PropertyChanges {
- target: btnTxt; color: "black"
- }
- }
- FViewUseCase{condition: myButton.indicatorState === true
- /* PropertyChanges {
- target: buttonArea; color: pressedColor
- }*/
- }
- FViewUseCase{condition: myButton.pressed === false
- PropertyChanges {
- target: btnFill; visible: false
- }
- }
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonClimatePCALayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonClimatePCALayout.qml deleted file mode 100644 index c03f89c184..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonClimatePCALayout.qml +++ /dev/null @@ -1,143 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: button
- property string bitmap: ""
- property string bitmap2: ""
- property bool selected: false
- property alias touchBtn: myButton
- property string text: ""
- property string image: "climate/Button_9_9.png"
- property string imageActive: "climate/ButtonActive_0_0.png"
- property string imagePressed: "climate/ButtonPressed_9_9.png"
- property string imageInActive: "climate/ButtonInActive_0_0.png"
- property bool active: true
- property string newFont: "../Fonts/HelveticaNeueLTStd-Roman.ttf"
- property int txtSize: 24
- property string txtColor: "#1d81d5"
-
-
- FWdgtImage{
- id: img
- x:-9
- y:-9
- bitmap: image
- }
-
- FWdgtImage{
- id: imgSelected
- x:0
- y:0
- bitmap: imageActive
- visible: false
- }
-
- FWdgtImage{
- id: imgInBtn
- anchors.centerIn: imgSelected
- bitmap: button.bitmap
- visible: false
- //height: 10
- //width: 10
- }
-
- BaseText {
- id: btnTxt
- anchors.horizontalCenter: imgSelected.horizontalCenter
- anchors.verticalCenter: imgSelected.verticalCenter
- //anchors.verticalCenterOffset: -1
- vertAlignment: Text.AlignVCenter
- horAlignment: Text.AlignHCenter
- text: button.text
- color: button.txtColor
- visible: false
- theFont: button.newFont
- pxSize: button.txtSize
-
- }
-
- FWdgtTouchArea {
- id: myButton
- anchors.fill: imgSelected
- }
-
-
-
- FViewUseCaseSimple{
- condition: button.text !== ""
- PropertyChanges {
- target: btnTxt; visible: true
- }
- }
-
- FViewUseCaseSimple{
- condition: button.bitmap !== ""
- PropertyChanges {
- target: imgInBtn; visible: true
- }
- }
-
-
- FViewUseCaseGroup{
- FViewUseCase{condition: myButton.pressed === true
- PropertyChanges {
- target: img; bitmap: imagePressed
- }
- PropertyChanges {
- target: btnTxt; color: "black"
- }
- PropertyChanges {
- target: imgInBtn; bitmap: button.bitmap2
- }
- }
- FViewUseCase{
- condition: button.active === false
- PropertyChanges {
- target: img; visible: false
- }
- PropertyChanges {
- target: imgSelected; visible: true; bitmap: imageInActive
- }
- PropertyChanges {
- target: btnTxt; color: "black"
- }
- PropertyChanges {
- target: myButton; enabled: false
- }
- PropertyChanges {
- target: imgInBtn; bitmap: button.bitmap2
- }
- }
- FViewUseCase{
- condition: button.selected === true
- PropertyChanges {
- target: img; visible: false
- }
- PropertyChanges {
- target: imgSelected; visible: true
- }
- PropertyChanges {
- target: btnTxt; color: "black"
- }
- PropertyChanges {
- target: imgInBtn; bitmap: button.bitmap2
- }
- }
- FViewUseCase{condition: myButton.pressed === false
- PropertyChanges {
- target: img; bitmap: image
- }
- PropertyChanges {
- target: btnTxt; color: button.txtColor
- }
- PropertyChanges {
- target: imgInBtn; bitmap: button.bitmap
- }
- }
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonPCALayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonPCALayout.qml deleted file mode 100644 index db963dc752..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonPCALayout.qml +++ /dev/null @@ -1,95 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: button
- property string text: ""
- property int centerWidth: 2
- property alias touchBtn: myButton
- property alias pressed: myButton.pressed
-
- FWdgtImage{
- id: img
- x:-8
- y:-8
- bitmap: "Radio/ButtonEnd_8_8.png"
- }
-
- FWdgtImage{
- id: img1
- anchors.left: img.right
- anchors.top: img.top
- width: centerWidth
- fillMode: Image.Stretch
- bitmap: "Radio/ButtonCenter_0_8.png"
- }
-
- FWdgtImage{
- id: img2
- anchors.left: img1.right
- anchors.top: img1.top
- bitmap: "Radio/ButtonOtherEnd_8_8.png"
- }
-
- FWdgtTouchArea {
- id: myButton
- width:img1.width+44
- height: 46
- anchors.left: img1.left
- anchors.leftMargin: -22
- anchors.top: img1.top
- anchors.topMargin: 8
- }
-
- Rectangle {
- id: btnFill
- color: "#1d81d5"
- anchors.fill: myButton
- radius: 23
- border.width: 1
- border.color: "#1d81d5"
- visible: false
- }
-
- BaseText {
- id: btnTxt
- anchors.centerIn: btnFill
- text: button.text
- color: "#1d81d5"
- visible: false
- }
-
-
-
- FViewUseCaseSimple{
- condition: button.text !== ""
- PropertyChanges {
- target: btnTxt; visible: true
- }
- }
-
- FViewUseCaseGroup{
- FViewUseCase{condition: myButton.pressed === true
- PropertyChanges {
- target: btnFill; visible: true
- }
- PropertyChanges {
- target: btnTxt; color: "black"
- }
- }
- FViewUseCase{condition: indicatorState === true
- /* PropertyChanges {
- target: buttonArea; color: pressedColor
- }*/
- }
- FViewUseCase{condition: myButton.pressed === false
- PropertyChanges {
- target: btnFill; visible: false
- }
- }
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonPCASpecialLayout.qml b/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonPCASpecialLayout.qml deleted file mode 100644 index 35b27c056f..0000000000 --- a/src/components/qt_hmi/References/Look/WidgetLayouts/TouchButtonPCASpecialLayout.qml +++ /dev/null @@ -1,325 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-import "../Widgets"
-
-FLayout {
- id: button
- property string bitmap: ""
- property string bitmap2: ""
- property bool vis: true
- property string text: ""
- property string text1: ""
- property string text2: ""
- property int centerWidth: 2
- property alias touchBtn: myButton
- property int imageShift: 0
- property alias spacing: btnArea.spacing
- property alias pressed: myButton.pressed
- property int curHD: 4
- property int totHD: 4
-
- FWdgtImage{
- id: img
- x:-8
- y:-8
- bitmap: "Radio/ButtonEnd_8_8.png"
- }
-
- FWdgtImage{
- id: img1
- anchors.left: img.right
- anchors.top: img.top
- width: centerWidth
- fillMode: Image.Stretch
- bitmap: "Radio/ButtonCenter_0_8.png"
- }
-
- FWdgtImage{
- id: img2
- anchors.left: img1.right
- anchors.top: img1.top
- bitmap: "Radio/ButtonOtherEnd_8_8.png"
- }
-
- FWdgtTouchArea {
- id: myButton
- width:img1.width+44
- height: 46
- anchors.left: img1.left
- anchors.leftMargin: -22
- anchors.top: img1.top
- anchors.topMargin: 8
-
- }
-
- Rectangle {
- id: btnFill
- color: "#1d81d5"
- anchors.fill: myButton
- radius: 23
- border.width: 1
- border.color: "#1d81d5"
- visible: false
- }
-
-
- Row {
- id: btnArea
- anchors.fill: img1
- anchors.left: img1.left
- anchors.leftMargin: imageShift
- spacing: 2
-
-
- FWdgtImage{
- id: btnImg
- anchors.verticalCenter: btnArea.verticalCenter
- bitmap: button.bitmap
- visible: false
- }
-
- BaseText {
- id: btnTxt
- anchors.verticalCenter: btnArea.verticalCenter
- text: button.text
- color: "#1d81d5"
- visible: false
- }
-
- BaseText {
- id: btnTxt1
- anchors.verticalCenter: btnArea.verticalCenter
- text: button.text1
- color: "white"
- visible: false
- theFont: "../Fonts/HelveticaNeueLTStd-Bold.ttf"
- //boldTx: true
- }
-
- BaseText {
- id: btnTxt2
- anchors.verticalCenter: btnArea.verticalCenter
- text: button.text2
- color: "#1d81d5"
- visible: false
- }
-
-
- }
-
- FViewUseCaseSimple{
- condition: button.bitmap !== ""
- PropertyChanges {
- target: btnImg; visible: true
- }
- }
-
- FViewUseCaseSimple{
- condition: button.text !== ""
- PropertyChanges {
- target: btnTxt; visible: true
- }
- }
-
- FViewUseCaseSimple{
- condition: button.text1 !== ""
- PropertyChanges {
- target: btnTxt1; visible: true
- }
- }
-
- FViewUseCaseSimple{
- condition: button.text2 !== ""
- PropertyChanges {
- target: btnTxt2; visible: true
- }
- }
-
- FViewUseCaseGroup{
- FViewUseCase{condition: myButton.pressed === true
- PropertyChanges {
- target: btnFill; visible: true
- }
- PropertyChanges {
- target: btnTxt; color: "black"
- }
- PropertyChanges {
- target: btnTxt2; color: "black"
- }
- PropertyChanges {
- target: btnImg; bitmap: button.bitmap2
- }
- }
- FViewUseCase{condition: indicatorState === true
- /* PropertyChanges {
- target: buttonArea; color: pressedColor
- }*/
- }
- FViewUseCase{condition: myButton.pressed === false
- PropertyChanges {
- target: btnFill; visible: false
- }
- }
- }
-
-
- FViewUseCaseGroup{
- FViewUseCase{condition: totHD === -1
- PropertyChanges {
- target: button; visible: true
- }
- }
- FViewUseCase{condition: totHD === 0
- PropertyChanges {
- target: button; visible: false
- }
- }
- FViewUseCase{condition: totHD === 1
- PropertyChanges {
- target: myButton; enabled: false
- }
- PropertyChanges {
- target: btnTxt; text: ""
- }
- PropertyChanges {
- target: btnTxt1; text: ""
- }
- PropertyChanges {
- target: btnTxt2; text: ""
- }
- PropertyChanges {
- target: img1; width: 4
- }
- }
- FViewUseCase{condition: totHD === 2 && curHD === 1
- PropertyChanges {
- target: img1; width: 50
- }
- PropertyChanges {
- target: btnTxt; text: ""
- }
- PropertyChanges {
- target: btnTxt1; text: " 1"
- }
- PropertyChanges {
- target: btnTxt2; text: " 2"
- }
- }
- FViewUseCase{condition: totHD === 2 && curHD === 2
- PropertyChanges {
- target: img1; width: 50
- }
- PropertyChanges {
- target: btnTxt; text: " 1 "
- }
- PropertyChanges {
- target: btnTxt1; text: "2"
- }
- PropertyChanges {
- target: btnTxt2; text: ""
- }
- }
- FViewUseCase{condition: totHD === 3 && curHD === 1
- PropertyChanges {
- target: img1; width: 65
- }
- PropertyChanges {
- target: btnTxt; text: ""
- }
- PropertyChanges {
- target: btnTxt1; text: " 1"
- }
- PropertyChanges {
- target: btnTxt2; text: " 2 3"
- }
- }
- FViewUseCase{condition: totHD === 3 && curHD === 2
- PropertyChanges {
- target: img1; width: 65
- }
- PropertyChanges {
- target: btnTxt; text: " 1 "
- }
- PropertyChanges {
- target: btnTxt1; text: "2"
- }
- PropertyChanges {
- target: btnTxt2; text: " 3"
- }
- }
- FViewUseCase{condition: totHD === 3 && curHD === 3
- PropertyChanges {
- target: img1; width: 65
- }
- PropertyChanges {
- target: btnTxt; text: " 1 2 "
- }
- PropertyChanges {
- target: btnTxt1; text: "3"
- }
- PropertyChanges {
- target: btnTxt2; text: ""
- }
- }
- FViewUseCase{condition: totHD === 4 && curHD === 1
- PropertyChanges {
- target: img1; width: 85
- }
- PropertyChanges {
- target: btnTxt; text: ""
- }
- PropertyChanges {
- target: btnTxt1; text: " 1"
- }
- PropertyChanges {
- target: btnTxt2; text: " 2 3 4"
- }
- }
- FViewUseCase{condition: totHD === 4 && curHD === 2
- PropertyChanges {
- target: img1; width: 85
- }
- PropertyChanges {
- target: btnTxt; text: " 1 "
- }
- PropertyChanges {
- target: btnTxt1; text: "2"
- }
- PropertyChanges {
- target: btnTxt2; text: " 3 4"
- }
- }
- FViewUseCase{condition: totHD === 4 && curHD === 3
- PropertyChanges {
- target: img1; width: 85
- }
- PropertyChanges {
- target: btnTxt; text: " 1 2 "
- }
- PropertyChanges {
- target: btnTxt1; text: "3"
- }
- PropertyChanges {
- target: btnTxt2; text: " 4"
- }
- }
- FViewUseCase{condition: totHD === 4 && curHD === 4
- PropertyChanges {
- target: img1; width: 85
- }
- PropertyChanges {
- target: btnTxt; text: " 1 2 3 "
- }
- PropertyChanges {
- target: btnTxt1; text: "4"
- }
- PropertyChanges {
- target: btnTxt2; text: ""
- }
- }
-
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/BaseText.qml b/src/components/qt_hmi/References/Look/Widgets/BaseText.qml deleted file mode 100644 index b9bc380bd2..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/BaseText.qml +++ /dev/null @@ -1,50 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FWdgtText {
- id: myText
-
- property bool enabled: true
- property bool secondary: false
- property double secondaryOpacity: 0.7
- property alias horAlignment: myText.horizontalAlignment
- property alias vertAlignment: myText.verticalAlignment
- property int pxSize: 24
- property bool boldTx: false
- property alias theFont: testFont.source
-
- color: "white"
- smooth: true
-
- property alias style: _styler.style
-
- FontLoader {
- id: testFont; source: "../Fonts/HelveticaNeueLTStd-Roman.ttf"
- }
-
- font.family: testFont.name
- font.pixelSize: pxSize
- font.bold: boldTx
- //horizontalAlignment: Text.AlignLeft
- //verticalAlignment: Text.AlignTop
-
- states: [
- State {
- name: "disabled"
- when: enabled === false
- PropertyChanges { target:myText; opacity: secondaryOpacity }
- },
-
- State {
- name: "secondary"
- when: secondary === true
- PropertyChanges { target:myText; opacity: secondaryOpacity }
- }
- ]
-
- FStyler {
- id: _styler
- styleTarget: myText
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/CondText.qml b/src/components/qt_hmi/References/Look/Widgets/CondText.qml deleted file mode 100644 index 7b8ae4ada6..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/CondText.qml +++ /dev/null @@ -1,14 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-BaseText {
- FontLoader {
- id: testFont; source: "../Fonts/HelveticaNeueLTCom-LtCn.ttf"
- }
-
- font.family: testFont.name
- font.pixelSize: 30
-
- height: 51
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/FocusListViewWidget.qml b/src/components/qt_hmi/References/Look/Widgets/FocusListViewWidget.qml deleted file mode 100644 index 082ebdf881..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/FocusListViewWidget.qml +++ /dev/null @@ -1,45 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../WidgetLayouts"
-
-FWidget {
- property alias focusNext: _focusNext
- property alias focusPrevious: _focusPrevious
- property alias selectElement: _selectElement
-
- property alias list: l.list
- property alias list_itemWidget: l.list_itemWidget
- property alias list_data: l.list_data
- property alias listWrap: l.listWrap
-
- FEvent { id: _focusNext; }
- FEvent { id: _focusPrevious; }
- FEvent { id: _selectElement; }
-
- layout: FocusListViewLayout {
- id: l
- anchors.fill: parent
- }
-
- triggers: [
- FTrgEvent { event: _focusPrevious
- FActScriptCall { onScript: {
- l.list.decrementCurrentIndex();
- }
- }
- },
- FTrgEvent { event: _focusNext
- FActScriptCall { onScript: {
- l.list.incrementCurrentIndex();
- }
- }
- },
- FTrgEvent { event: _selectElement
- FActScriptCall { onScript: {
- list_data.selectElement(l.list.currentIndex);
- }
- }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/GridViewImgItemWidget.qml b/src/components/qt_hmi/References/Look/Widgets/GridViewImgItemWidget.qml deleted file mode 100644 index f76057722a..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/GridViewImgItemWidget.qml +++ /dev/null @@ -1,31 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
- id: w
- height: 178
- width: 200
-
-
-
- layout: GridViewImgItemLayout {
- id: l
- bitmap: menuIcon
- }
-
- FViewUseCaseSimple {
- condition: isEnabled == false
- PropertyChanges { target: l
- opacity: 0.5
- }
- }
-
- triggers: [
- FTrgTouchArea { touchArea: l.touch; touchAction: TA.Out
- FActScriptCall { onScript: w.GridView.view.model.selectElement(index) }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/GridViewItemWidget.qml b/src/components/qt_hmi/References/Look/Widgets/GridViewItemWidget.qml deleted file mode 100644 index 5b81d7e1bc..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/GridViewItemWidget.qml +++ /dev/null @@ -1,32 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
- id: w
- height: 55
- width: 200
-
-
-
- layout: GridViewItemLayout {
- id: l
- cx_text: menuText
- indentLevel: 0
- }
-
- FViewUseCaseSimple {
- condition: isEnabled == false
- PropertyChanges { target: l
- opacity: 0.5
- }
- }
-
- triggers: [
- FTrgTouchArea { touchArea: l.touch; touchAction: TA.Out
- FActScriptCall { onScript: w.GridView.view.model.selectElement(index) }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/GridViewPresetItemWidget.qml b/src/components/qt_hmi/References/Look/Widgets/GridViewPresetItemWidget.qml deleted file mode 100644 index fa2cb44918..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/GridViewPresetItemWidget.qml +++ /dev/null @@ -1,41 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
- id: w
- height: 115
- width: 169
-
- property int currPreset: 0
- property bool pressed: false
-
-
-
- layout: GridViewPresetItemLayout {
- id: l
- presetName: menuText
- pressed: w.pressed
- presetNumber: index + 1
- }
-
- FViewUseCaseSimple {
- condition: isEnabled == false
- PropertyChanges { target: l
- opacity: 0.5
- }
- }
-
- FViewUseCaseSimple {
- condition: w.currPreset===index+1
- PropertyChanges { target: w; pressed: true}
- }
-
- triggers: [
- FTrgTouchArea { touchArea: l.touchBtn.touchBtn; touchAction: TA.Out
- FActScriptCall { onScript: w.GridView.view.model.selectElement(index) }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/GridViewPresetWidget.qml b/src/components/qt_hmi/References/Look/Widgets/GridViewPresetWidget.qml deleted file mode 100644 index f232bf2c68..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/GridViewPresetWidget.qml +++ /dev/null @@ -1,35 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../WidgetLayouts"
-
-FWidget {
-
- property alias selectElement: _selectElement
- property alias list: l.list
- property alias list_itemWidget: l.list_itemWidget
- property alias list_data: l.list_data
- property alias listWrap: l.listWrap
- property alias gridItemHeight: l.gridItemHeight
- property alias gridItemWidth: l.gridItemWidth
- property alias gridCurItem: l.curItem
- property alias moving: l.moving
- property alias direction: l.direction
-
-
- FEvent { id: _selectElement; }
-
- layout: GridViewPresetLayout {
- id: l
- anchors.fill: parent
- }
-
- triggers: [
- FTrgEvent { event: _selectElement
- FActScriptCall { onScript: {
- list_data.selectElement(l.list.currentIndex);
- }
- }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/GridViewWidget.qml b/src/components/qt_hmi/References/Look/Widgets/GridViewWidget.qml deleted file mode 100644 index cfbba62530..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/GridViewWidget.qml +++ /dev/null @@ -1,31 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../WidgetLayouts"
-
-FWidget {
-
- property alias selectElement: _selectElement
- property alias list: l.list
- property alias list_itemWidget: l.list_itemWidget
- property alias list_data: l.list_data
- property alias listWrap: l.listWrap
- property alias gridItemHeight: l.gridItemHeight
- property alias gridItemWidth: l.gridItemWidth
-
- FEvent { id: _selectElement; }
-
- layout: GridViewLayout {
- id: l
- anchors.fill: parent
- }
-
- triggers: [
- FTrgEvent { event: _selectElement
- FActScriptCall { onScript: {
- list_data.selectElement(l.list.currentIndex);
- }
- }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/MenuListItemWidget.qml b/src/components/qt_hmi/References/Look/Widgets/MenuListItemWidget.qml deleted file mode 100644 index 48b3bff4a6..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/MenuListItemWidget.qml +++ /dev/null @@ -1,48 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
- id: w
- height: 50
-
- layout: TGListItemLayout {
- id: l
- anchors.fill: parent
- ax_bitmap: ""
- cx_text: menuText
- activeMarker_visible: false
- indentLevel: level
- }
-
- FViewUseCaseSimple {
- condition: isEnabled == false
- PropertyChanges { target: l
- opacity: 0.5
- }
- }
-
- FViewUseCaseGroup {
- FViewUseCase {
- condition: menuType == FMenuElement.Popup
- PropertyChanges { target: l
- ax_bitmap: "../Resources/g137p.png"
- }
- }
-
- FViewUseCase {
- condition: menuType == FMenuElement.Submenu
- PropertyChanges { target: l
- ax_bitmap: "../Resources/g136p.png"
- }
- }
- }
-
- triggers: [
- FTrgTouchArea { touchArea: l.touch; touchAction: TA.In
- FActScriptCall { onScript: w.ListView.view.model.selectElement(index) }
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/MenuSubmenuListItemWidget.qml b/src/components/qt_hmi/References/Look/Widgets/MenuSubmenuListItemWidget.qml deleted file mode 100644 index df96329060..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/MenuSubmenuListItemWidget.qml +++ /dev/null @@ -1,60 +0,0 @@ -// import QtQuick 2.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
- height: 50
-
- layout: TGListItemLayout {
- id: l
- anchors.fill: parent
- ax_bitmap: ""
- cx_text: menuItem
- activeMarker_visible: false
- }
-
- FViewUseCaseGroup {
- FViewUseCase {
- condition: type === "popup"
- PropertyChanges { target: l
- ax_bitmap: "../Resources/g137p.png"
- }
-
- }
-
- FViewUseCase {
- condition: type === "arrow"
- PropertyChanges { target: l
- ax_bitmap: "../Resources/g136p.png"
- }
- }
-
- FViewUseCase {
- condition: type === "tickboxChecked"
- PropertyChanges { target: l
- gx_bitmap: "../Resources/g134p.png"
- cx_width: ++ax_width
- }
- }
-
- FViewUseCase {
- condition: type === "tickboxUnchecked"
- PropertyChanges { target: l
- gx_bitmap: "../Resources/g135p.png"
- cx_width: ++ax_width
- }
- }
-
-
- FViewUseCase {
- condition: type === ""
- PropertyChanges { target: l
- visible: true
- ax_bitmap: ""
- cx_width: ++(ax_width+gx_width)
- }
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/PhoneContactListItemWdgt.qml b/src/components/qt_hmi/References/Look/Widgets/PhoneContactListItemWdgt.qml deleted file mode 100644 index d357c50dc2..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/PhoneContactListItemWdgt.qml +++ /dev/null @@ -1,28 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-
-FWidget {
- id: w
- height: 50
-
- property FEvent itemClicked
-
- layout: PhoneListWdgtLayout {
- anchors.fill: parent
- id: l
- cx_text: staticItem
- cn_text: staticNumber
- ct_text: type
- }
- triggers: [
- FTrgTouchArea { touchArea: l.touch; touchAction: TA.Out
- FActEventFire{ event: itemClicked; data: index }
- FActScriptCall { onScript: console.log(staticItem) }
- }
- ]
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/PresetPCA.qml b/src/components/qt_hmi/References/Look/Widgets/PresetPCA.qml deleted file mode 100644 index a575ff91eb..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/PresetPCA.qml +++ /dev/null @@ -1,27 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
-
- id:pcaButton
-
- property alias active: button.active
- property alias presetNumber: button.text
- property alias presetName: button.presetText
- property alias touchBtn: button.touchBtn
-
-
- clip: false
-
-
-
- layout: PresetPCALayout{
- id:button
- }
-
-
-
-}
-
diff --git a/src/components/qt_hmi/References/Look/Widgets/PresetsGridPCA.qml b/src/components/qt_hmi/References/Look/Widgets/PresetsGridPCA.qml deleted file mode 100644 index b23375f886..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/PresetsGridPCA.qml +++ /dev/null @@ -1,48 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-
-
-FWidget {
- id:sv
- property int currPreset: 2
- property alias listModel: l.list_data
- property alias gridCurItem: l.gridCurItem
- property alias moving: l.moving
- property alias direction: l.direction
-
-
- layout: PresetGridLayoutPCA {
- id:l
-
-
- listWrap: false
- list_data: FProxyListModel {
- id: menuProxy
- sourceModel: menuItemData
- }
- list_itemWidget: GridViewPresetItemWidget {
- currPreset: sv.currPreset
- }
- }
-
- FMenuModel {
- id: menuItemData
- FMenuElement { id: preset1; menuText: "96.3"; menuData: false; }
- FMenuElement { id: preset2; menuText: "107.9"; menuData: true }
- FMenuElement { id: preset3; menuText: "104.3"; menuData: false }
- FMenuElement { id: preset4; menuText: "101.9"; menuData: false }
- FMenuElement { id: preset5; menuText: "97.1"; menuData: false }
- FMenuElement { id: preset6; menuText: "91.7"; menuData: false }
- FMenuElement { id: preset7; menuText: "101.1"; menuData: false }
- FMenuElement { id: preset8; menuText: "91.9"; menuData: false}
- }
-
- FViewUseCaseSimple { condition: sv.isInEntry
- PropertyChanges { target: l; list_data: null }
- }
-
-
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/ScrollBar.qml b/src/components/qt_hmi/References/Look/Widgets/ScrollBar.qml deleted file mode 100644 index b1f67d043c..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/ScrollBar.qml +++ /dev/null @@ -1,78 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-Item {
- id: scrollbar
- property variant target
-
- clip: true
-
- //anchors {top: target.top; bottom: target.bottom; right: target.right }
- visible: (track.height == slider.height) ? false : true //TODO: !visible -> width: 0 (but creates a binding loop)
-
- Timer {
- property int scrollAmount
-
- id: timer
- repeat: true
- interval: 20
- onTriggered: {
- target.contentY = Math.max(
- 0, Math.min(
- target.contentY + scrollAmount,
- target.contentHeight - target.height));
- }
- }
-
- MouseArea {
- anchors.fill: scrollbar
- onPressed: {
- timer.scrollAmount = target.height * (mouseY < slider.y ? -1 : 1) // scroll by a page
- timer.running = true;
- }
- onReleased: {
- timer.running = false;
- }
- }
-
- Rectangle {
- id: track
-
- color: "red"
- opacity: 0.3
- radius: 2
- smooth: true
-
- anchors.top: scrollbar.top
- anchors.bottom: scrollbar.bottom
- anchors.horizontalCenter: scrollbar.horizontalCenter
- width: 3
- }
-
- Rectangle {
- id:slider
-
- width: scrollbar.width
- color: "red"
- opacity: 0.7
- radius: 4
- smooth: true
-
- height: Math.min(target.height / target.contentHeight * track.height, track.height)
- y: target.visibleArea.yPosition * track.height
-
- MouseArea {
- anchors.fill: parent
- drag.target: parent
- drag.axis: Drag.YAxis
- drag.minimumY: 0
- drag.maximumY: track.height - height
-
- onPositionChanged: {
- if (pressedButtons == Qt.LeftButton) {
- target.contentY = slider.y * target.contentHeight / track.height
- }
- }
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/Widgets/TouchButton.qml b/src/components/qt_hmi/References/Look/Widgets/TouchButton.qml deleted file mode 100644 index c05e1ab525..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/TouchButton.qml +++ /dev/null @@ -1,77 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-
-FWdgtTouchArea {
- id: button
-
- property string text: "Text"
- property string bitmap: ""
- property int wrapText: Text.NoWrap
- property bool indicatorState: false
- property string unpressedColor: "gray"
- property string pressEventColor: "lightGray"
- property string pressedColor: "darkGray"
- property bool vis: true
-
-
- width: 120
- height: 40
- enabled: button.vis
-
-
-
- Rectangle {
- id: buttonArea
- radius: 10
- anchors.centerIn: parent
- width: button.width
- height: button.height
- color: "gray"
- visible: button.vis
-
- BaseText {
- id: st
- anchors.centerIn: parent
- text: button.text
- wrapMode: wrapText
- visible: button.vis
- }
-
- FWdgtImage{
- id: img
- anchors.fill: buttonArea
- bitmap: button.bitmap
- visible: false
- }
-
-
- }
-
- FViewUseCaseSimple{
- condition: button.bitmap !== ""
- PropertyChanges {
- target: img; visible: true
- }
- }
-
- FViewUseCaseGroup{
- FViewUseCase{condition: pressed === true
- PropertyChanges {
- target: buttonArea; color: pressEventColor
- }
- }
- FViewUseCase{condition: indicatorState === true
- PropertyChanges {
- target: buttonArea; color: pressedColor
- }
- }
- FViewUseCase{condition: pressed === false
- PropertyChanges {
- target: buttonArea; color: unpressedColor
- }
- }
- }
-
-}
-
diff --git a/src/components/qt_hmi/References/Look/Widgets/TouchButton2.qml b/src/components/qt_hmi/References/Look/Widgets/TouchButton2.qml deleted file mode 100644 index 2f3ca939a2..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/TouchButton2.qml +++ /dev/null @@ -1,32 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import QtGraphicalEffects 1.0
-import "../Widgets"
-
-
-
-Item {
- width: 160
- height: 45
-
- RectangularGlow {
- id: effect
- anchors.fill: rect
- glowRadius: 10
- spread: 0.2
- color: "#1d81d5"
- cornerRadius: rect.radius + glowRadius
- }
-
- Rectangle {
- id: rect
- color: "black"
- anchors.centerIn: parent
- width: 160
- height: 45
- radius: 25
- border.color: "#1d81d5"
- }
-}
-
-
diff --git a/src/components/qt_hmi/References/Look/Widgets/TouchButtonBackGround_PCA.qml b/src/components/qt_hmi/References/Look/Widgets/TouchButtonBackGround_PCA.qml deleted file mode 100644 index 6dbd6b125b..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/TouchButtonBackGround_PCA.qml +++ /dev/null @@ -1,27 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
-
- id:pcaButton
-
- property alias bitmap:button.bitmap
- property alias active: button.selected
- property alias text: button.text
- property alias touchBtn: button.touchBtn
-
-
- clip: false
-
-
-
- layout: TouchButtonBackGroundPCALayout{
- id:button
- }
-
-
-
-}
-
diff --git a/src/components/qt_hmi/References/Look/Widgets/TouchButtonClimatePCA.qml b/src/components/qt_hmi/References/Look/Widgets/TouchButtonClimatePCA.qml deleted file mode 100644 index 401e538201..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/TouchButtonClimatePCA.qml +++ /dev/null @@ -1,38 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
-
- id:pcaButton
-
- property alias bitmap: button.bitmap
- property alias bitmap2: button.bitmap2
- property alias selected: button.selected
- property alias touchBtn: button.touchBtn
- property alias text: button.text
- property alias image: button.image
- property alias imageActive: button.imageActive
- property alias imagePressed: button.imagePressed
- property alias imageInActive: button.imageInActive
- property alias active: button.active
- property alias newFont: button.newFont
- property alias txtSize: button.txtSize
- property alias txtColor: button.txtColor
-
-
- height: 80
- width: 80
- clip: false
-
-
-
- layout: TouchButtonClimatePCALayout{
- id:button
- }
-
-
-
-}
-
diff --git a/src/components/qt_hmi/References/Look/Widgets/TouchButtonSpecial_PCA.qml b/src/components/qt_hmi/References/Look/Widgets/TouchButtonSpecial_PCA.qml deleted file mode 100644 index e48c5f2762..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/TouchButtonSpecial_PCA.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
-
- id:pcaButton
-
- property alias bitmap:button.bitmap
- property alias bitmap2: button.bitmap2
- property alias text: button.text
- property alias text1: button.text1
- property alias text2:button.text2
- property alias textWidth: button.centerWidth
- property alias touchBtn: button.touchBtn
- property alias imageShift: button.imageShift
- property alias spacing: button.spacing
- property alias pressed: button.pressed
- property alias curHD: button.curHD
- property alias totHD: button.totHD
- width: 164
- clip: false
-
-
-
- layout: TouchButtonPCASpecialLayout{
- id:button
- }
-
-
-
-}
-
diff --git a/src/components/qt_hmi/References/Look/Widgets/TouchButton_PCA.qml b/src/components/qt_hmi/References/Look/Widgets/TouchButton_PCA.qml deleted file mode 100644 index e46dbf28c5..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/TouchButton_PCA.qml +++ /dev/null @@ -1,27 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-FWidget {
-
- id:pcaButton
-
-
- property alias text: button.text
- property alias textWidth: button.centerWidth
- property alias touchBtn: button.touchBtn
- property alias pressed: button.pressed
- width: textWidth+44
- clip: false
-
-
-
- layout: TouchButtonPCALayout{
- id:button
- }
-
-
-
-}
-
diff --git a/src/components/qt_hmi/References/Look/Widgets/VerySimpleListItemWidget.qml b/src/components/qt_hmi/References/Look/Widgets/VerySimpleListItemWidget.qml deleted file mode 100644 index 42049240fd..0000000000 --- a/src/components/qt_hmi/References/Look/Widgets/VerySimpleListItemWidget.qml +++ /dev/null @@ -1,18 +0,0 @@ -import QtQuick 2.0
-import com.ford.hmiframework 1.0
-import "../Widgets"
-import "../WidgetLayouts"
-
-
-FWidget {
- id: w
- height: 50
- property alias vis: l.vis
-
- layout: SimpleItemWdgLayout {
- anchors.fill: parent
- id: l
- cx_text: staticItem
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll Binary files differdeleted file mode 100644 index 52506bb139..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFramework.dll +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll Binary files differdeleted file mode 100644 index 4d811bed1e..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.dll +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.pdb b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.pdb Binary files differdeleted file mode 100644 index b6a4d31838..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/QtHMIFrameworkd.pdb +++ /dev/null diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/plugin.qmltypes b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/plugin.qmltypes deleted file mode 100644 index b03753aa5c..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/plugin.qmltypes +++ /dev/null @@ -1,682 +0,0 @@ -import QtQuick.tooling 1.1
-
-// This file describes the plugin-supplied types contained in the library.
-// It is used for QML tooling purposes only.
-//
-// This file was auto-generated with the command 'C:\Qt\Qt5.0.1\5.0.1\msvc2010\bin\qmlplugindump.exe -notrelocatable com.ford.hmiframework 1.0 C:\HMIRepository\trunk\Framework\QtHMIFramework\output'.
-
-Module {
- Component {
- name: "FAbstractListElement"
- prototype: "QObject"
- exports: ["com.ford.hmiframework/FAbstractListElement 1.0"]
- Signal {
- name: "elementSelected"
- Parameter { name: "element"; type: "FAbstractListElement"; isPointer: true }
- }
- Method { name: "selectElement" }
- }
- Component {
- name: "FAbstractListModel"
- prototype: "QAbstractListModel"
- exports: ["com.ford.hmiframework/FAbstractListModel 1.0"]
- Signal {
- name: "elementSelected"
- Parameter { type: "FAbstractListElement"; isPointer: true }
- Parameter { type: "int" }
- }
- }
- Component {
- name: "FActAnimControl"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActAnimControl 1.0"]
- Property { name: "animation"; type: "FAnimation"; isPointer: true }
- Property { name: "animAction"; type: "int" }
- }
- Component {
- name: "FActEventFire"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActEventFire 1.0"]
- Property { name: "event"; type: "FEvent"; isPointer: true }
- Property { name: "data"; type: "QVariant" }
- }
- Component {
- name: "FActFunction"
- defaultProperty: "actions"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActFunction 1.0"]
- Property { name: "data"; type: "QVariant" }
- Property { name: "actions"; type: "FAction"; isList: true; isReadonly: true }
- }
- Component {
- name: "FActFunctionCall"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActFunctionCall 1.0"]
- Property { name: "func"; type: "FActFunction"; isPointer: true }
- Property { name: "data"; type: "QVariant" }
- }
- Component {
- name: "FActHistoryClear"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActHistoryClear 1.0"]
- Property { name: "queue"; type: "string" }
- }
- Component {
- name: "FActHistoryPop"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActHistoryPop 1.0"]
- Property { name: "queue"; type: "string" }
- }
- Component {
- name: "FActHistoryPush"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActHistoryPush 1.0"]
- Property { name: "queue"; type: "string" }
- Property { name: "animation"; type: "string" }
- Property { name: "data"; type: "QVariant" }
- }
- Component {
- name: "FActHistoryShow"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActHistoryShow 1.0"]
- Property { name: "queue"; type: "string" }
- Property { name: "animation"; type: "string" }
- Property { name: "skipMe"; type: "bool" }
- }
- Component {
- name: "FActViewHide"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActViewHide 1.0"]
- Property { name: "view"; type: "string" }
- Property { name: "animation"; type: "string" }
- }
- Component {
- name: "FActViewShow"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FActViewShow 1.0"]
- Property { name: "view"; type: "string" }
- Property { name: "animation"; type: "string" }
- Property { name: "data"; type: "QVariant" }
- }
- Component {
- name: "FAction"
- prototype: "FMetaInfoObject"
- exports: ["com.ford.hmiframework/FAction 1.0"]
- Property { name: "passed"; type: "bool" }
- Signal { name: "execute" }
- Method { name: "getDisplay"; type: "FDisplay*" }
- Method { name: "getStateView"; type: "FStateView*" }
- }
- Component {
- name: "FAnimView"
- defaultProperty: "data"
- prototype: "FAnimation"
- exports: ["com.ford.hmiframework/FAnimView 1.0"]
- Property { name: "inView"; type: "FStateView"; isPointer: true }
- Property { name: "outView"; type: "FStateView"; isPointer: true }
- Property { name: "ingoing"; type: "FLayout"; isReadonly: true; isPointer: true }
- Property { name: "outgoing"; type: "FLayout"; isReadonly: true; isPointer: true }
- }
- Component {
- name: "FAnimation"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["com.ford.hmiframework/FAnimation 1.0"]
- Property { name: "isRunning"; type: "bool"; isReadonly: true }
- Signal {
- name: "animationComplete"
- Parameter { name: "anim"; type: "FAnimation"; isPointer: true }
- }
- }
- Component {
- name: "FAnimationCoordinator"
- defaultProperty: "defaultAnims"
- prototype: "FMetaInfoObject"
- exports: ["com.ford.hmiframework/FAnimationCoordinator 1.0"]
- Property { name: "defaultAnims"; type: "FDefaultAnimation"; isList: true; isReadonly: true }
- }
- Component {
- name: "FDefaultAnimation"
- prototype: "FMetaInfoObject"
- exports: ["com.ford.hmiframework/FDefaultAnimation 1.0"]
- Property { name: "from"; type: "FViewClass"; isPointer: true }
- Property { name: "to"; type: "FViewClass"; isPointer: true }
- Property { name: "animation"; type: "string" }
- }
- Component {
- name: "FDisplay"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["com.ford.hmiframework/FDisplay 1.0"]
- Property { name: "xPixel"; type: "int" }
- Property { name: "yPixel"; type: "int" }
- Property { name: "initialView"; type: "string" }
- Property { name: "initialAnim"; type: "string" }
- Property { name: "modelPath"; type: "QUrl" }
- Property { name: "activeVariant"; type: "string" }
- Property { name: "priorityLayerCount"; type: "int" }
- Property { name: "minPriority"; type: "int" }
- Property { name: "priorityLayerDebug"; type: "QStringList"; isReadonly: true }
- Property { name: "viewCacheSize"; type: "int" }
- Signal { name: "preStartInit" }
- Method {
- name: "animationCompleted"
- Parameter { type: "FAnimation"; isPointer: true }
- }
- Method { name: "updateDebugInformation" }
- }
- Component {
- name: "FEvent"
- prototype: "FMetaInfoObject"
- exports: ["com.ford.hmiframework/FEvent 1.0"]
- Signal {
- name: "fire"
- Parameter { name: "data"; type: "QVariant" }
- }
- Method {
- name: "doFire"
- Parameter { name: "data"; type: "QVariant" }
- }
- }
- Component {
- name: "FGrdCondition"
- defaultProperty: "actions"
- prototype: "FGuard"
- exports: ["com.ford.hmiframework/FGrdCondition 1.0"]
- Property { name: "condition"; type: "bool" }
- }
- Component {
- name: "FGuard"
- defaultProperty: "actions"
- prototype: "FAction"
- exports: ["com.ford.hmiframework/FGuard 1.0"]
- Property { name: "actions"; type: "FAction"; isList: true; isReadonly: true }
- }
- Component {
- name: "FHardwareControl"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["com.ford.hmiframework/FHardwareControl 1.0"]
- Property { name: "hardwareControlID"; type: "string" }
- Signal {
- name: "checkKeyPressed"
- Parameter { name: "key"; type: "int" }
- }
- Signal {
- name: "checkKeyReleased"
- Parameter { name: "key"; type: "int" }
- }
- Method {
- name: "sendHardwareControlEvent"
- Parameter { name: "data"; type: "int" }
- }
- }
- Component {
- name: "FHardwareKey"
- defaultProperty: "data"
- prototype: "FHardwareControl"
- exports: ["com.ford.hmiframework/FHardwareKey 1.0"]
- Property { name: "pressed"; type: "bool" }
- Property { name: "keyboardKey"; type: "int" }
- Property { name: "longPressMSec"; type: "int" }
- Property { name: "repeatDelayMSec"; type: "int" }
- Property { name: "repeatIntervalMSec"; type: "int" }
- }
- Component {
- name: "FHardwareRotary"
- defaultProperty: "knob"
- prototype: "FHardwareControl"
- exports: ["com.ford.hmiframework/FHardwareRotary 1.0"]
- Property { name: "knob"; type: "QQuickItem"; isPointer: true }
- Property { name: "stepsPerRotation"; type: "int" }
- Property { name: "currentAbsPosition"; type: "int" }
- Property { name: "currentRelPosition"; type: "int" }
- Property { name: "generateEvents"; type: "bool" }
- Property { name: "updateInterval"; type: "int" }
- }
- Component {
- name: "FLayer"
- defaultProperty: "data"
- prototype: "FWidgetBase"
- exports: ["com.ford.hmiframework/FLayer 1.0"]
- Property { name: "layerID"; type: "int" }
- Property { name: "initialView"; type: "string" }
- Property { name: "activeViewName"; type: "string" }
- }
- Component {
- name: "FLayout"
- defaultProperty: "data"
- prototype: "FMetaInfoItem"
- exports: ["com.ford.hmiframework/FLayout 1.0"]
- Property { name: "viewX"; type: "double" }
- Property { name: "viewY"; type: "double" }
- Property { name: "viewZ"; type: "double" }
- }
- Component {
- name: "FLogHandlerItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["com.ford.hmiframework/FLogHandlerItem 1.0"]
- Signal {
- name: "newEntry"
- Parameter { name: "s"; type: "string" }
- }
- }
- Component {
- name: "FLogger"
- prototype: "QObject"
- exports: ["com.ford.hmiframework/FLogger 1.0"]
- Property { name: "perfStamp"; type: "bool" }
- Method {
- name: "debug"
- Parameter { name: "name"; type: "string" }
- Parameter { name: "s"; type: "string" }
- }
- Method {
- name: "warning"
- Parameter { name: "name"; type: "string" }
- Parameter { name: "s"; type: "string" }
- }
- Method {
- name: "error"
- Parameter { name: "name"; type: "string" }
- Parameter { name: "s"; type: "string" }
- }
- Method {
- name: "info"
- Parameter { name: "name"; type: "string" }
- Parameter { name: "s"; type: "string" }
- }
- Method {
- name: "perf"
- Parameter { name: "name"; type: "string" }
- Parameter { name: "s"; type: "string" }
- }
- }
- Component {
- name: "FLoggerConsole"
- prototype: "QObject"
- exports: ["com.ford.hmiframework/FLoggerConsole 1.0"]
- }
- Component {
- name: "FLoggerFile"
- prototype: "QObject"
- exports: ["com.ford.hmiframework/FLoggerFile 1.0"]
- Property { name: "file"; type: "string" }
- }
- Component {
- name: "FMenuElement"
- defaultProperty: "children"
- prototype: "FTreeElement"
- exports: ["com.ford.hmiframework/FMenuElement 1.0"]
- Enum {
- name: "MenuElementType"
- values: {
- "Undefined": 0,
- "Submenu": 1,
- "Popup": 2,
- "Hyperlink": 3,
- "Checkbox": 4,
- "Radiobutton": 5,
- "Multistate": 6
- }
- }
- Property { name: "isVisible"; type: "bool" }
- Property { name: "isEnabled"; type: "bool" }
- Property { name: "menuType"; type: "int" }
- Property { name: "menuText"; type: "string" }
- Property { name: "menuIcon"; type: "string" }
- Property { name: "menuStatus"; type: "int" }
- Property { name: "menuData"; type: "QVariant" }
- }
- Component {
- name: "FMenuModel"
- defaultProperty: "children"
- prototype: "FTreeModel"
- exports: ["com.ford.hmiframework/FMenuModel 1.0"]
- }
- Component {
- name: "FMetaInfoItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["com.ford.hmiframework/FMetaInfoItem 1.0"]
- Property { name: "metaInfo"; type: "string" }
- Property { name: "metaID"; type: "string" }
- Property { name: "metaVersion"; type: "string" }
- }
- Component {
- name: "FMetaInfoObject"
- prototype: "QObject"
- exports: ["com.ford.hmiframework/FMetaInfoObject 1.0"]
- Property { name: "metaInfo"; type: "string" }
- Property { name: "metaID"; type: "string" }
- Property { name: "metaVersion"; type: "string" }
- }
- Component {
- name: "FProxyListModel"
- prototype: "QIdentityProxyModel"
- exports: ["com.ford.hmiframework/FProxyListModel 1.0"]
- Property { name: "sourceModel"; type: "FAbstractListModel"; isPointer: true }
- Property { name: "isFrozen"; type: "bool" }
- Signal {
- name: "elementSelected"
- Parameter { type: "FAbstractListElement"; isPointer: true }
- Parameter { type: "int" }
- }
- Method {
- name: "selectElement"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "FReactiveElementBase"
- prototype: "FMetaInfoObject"
- exports: ["com.ford.hmiframework/FReactiveElementBase 1.0"]
- Property { name: "triggers"; type: "FTrigger"; isList: true; isReadonly: true }
- }
- Component {
- name: "FState"
- prototype: "FStateBase"
- exports: ["com.ford.hmiframework/FState 1.0"]
- Property { name: "baseBehavior"; type: "FStateBase"; isPointer: true }
- }
- Component {
- name: "FStateBase"
- prototype: "FReactiveElementBase"
- exports: ["com.ford.hmiframework/FStateBase 1.0"]
- }
- Component {
- name: "FStateView"
- defaultProperty: "childObjects"
- prototype: "FState"
- exports: ["com.ford.hmiframework/FStateView 1.0"]
- Property { name: "priority"; type: "int" }
- Property { name: "visualPriority"; type: "int" }
- Property { name: "view"; type: "FView"; isPointer: true }
- Property { name: "preload"; type: "QVariant" }
- Property { name: "attachedViews"; type: "QStringList" }
- Property { name: "childObjects"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "isInEntry"; type: "bool"; isReadonly: true }
- Property { name: "isInExit"; type: "bool"; isReadonly: true }
- Signal {
- name: "entry"
- Parameter { name: "previousView"; type: "string" }
- Parameter { name: "data"; type: "QVariant" }
- }
- Signal { name: "entryComplete" }
- Signal { name: "exit" }
- Signal { name: "exitComplete" }
- }
- Component {
- name: "FThemeProvider"
- prototype: "QObject"
- exports: ["com.ford.hmiframework/FThemeProvider 1.0"]
- Property { name: "theme"; type: "string" }
- Property { name: "resourcePath"; type: "QUrl" }
- Method {
- name: "getFileSubPath"
- type: "string"
- Parameter { type: "string" }
- }
- Method {
- name: "getStyle"
- type: "FStyle*"
- Parameter { type: "string" }
- }
- Method {
- name: "applyStyle"
- Parameter { name: "target"; type: "QObject"; isPointer: true }
- Parameter { name: "styleName"; type: "string" }
- }
- }
- Component {
- name: "FTreeElement"
- defaultProperty: "children"
- prototype: "FAbstractListElement"
- exports: ["com.ford.hmiframework/FTreeElement 1.0"]
- Property { name: "children"; type: "FTreeElement"; isList: true; isReadonly: true }
- Property { name: "level"; type: "int"; isReadonly: true }
- Property { name: "isOpened"; type: "bool" }
- }
- Component {
- name: "FTreeModel"
- defaultProperty: "children"
- prototype: "FAbstractListModel"
- exports: ["com.ford.hmiframework/FTreeModel 1.0"]
- Property { name: "children"; type: "FTreeElement"; isList: true; isReadonly: true }
- Property { name: "root"; type: "FTreeElement"; isPointer: true }
- Property { name: "rootRoot"; type: "FTreeElement"; isReadonly: true; isPointer: true }
- Method {
- name: "openElement"
- Parameter { name: "numIndex"; type: "int" }
- }
- Method {
- name: "closeElement"
- Parameter { name: "numIndex"; type: "int" }
- }
- Method {
- name: "selectElement"
- Parameter { name: "index"; type: "int" }
- }
- }
- Component {
- name: "FTrgAnimCompleted"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgAnimCompleted 1.0"]
- Property { name: "animation"; type: "FAnimation"; isPointer: true }
- Method {
- name: "animCompleted"
- Parameter { type: "FAnimation"; isPointer: true }
- }
- }
- Component {
- name: "FTrgCondition"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgCondition 1.0"]
- Property { name: "condition"; type: "bool" }
- Property { name: "checkOnEntry"; type: "bool" }
- }
- Component {
- name: "FTrgEntry"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgEntry 1.0"]
- Property { name: "previousView"; type: "string"; isReadonly: true }
- Property { name: "data"; type: "QVariant"; isReadonly: true }
- Method {
- name: "entry"
- Parameter { name: "previousView"; type: "string" }
- Parameter { name: "data"; type: "QVariant" }
- }
- }
- Component {
- name: "FTrgEntryComplete"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgEntryComplete 1.0"]
- }
- Component {
- name: "FTrgEvent"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgEvent 1.0"]
- Property { name: "event"; type: "FEvent"; isPointer: true }
- Property { name: "data"; type: "QVariant" }
- Method {
- name: "eventTrigger"
- Parameter { name: "data"; type: "QVariant" }
- }
- }
- Component {
- name: "FTrgExit"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgExit 1.0"]
- }
- Component {
- name: "FTrgExitComplete"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgExitComplete 1.0"]
- }
- Component {
- name: "FTrgHardwareControl"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgHardwareControl 1.0"]
- Property { name: "hardControls"; type: "QVariant" }
- Signal {
- name: "handleHardwareControlEvent"
- Parameter { name: "action"; type: "int" }
- }
- }
- Component {
- name: "FTrgHardwareKey"
- defaultProperty: "actions"
- prototype: "FTrgHardwareControl"
- exports: ["com.ford.hmiframework/FTrgHardwareKey 1.0"]
- Property { name: "keyAction"; type: "int" }
- Property { name: "hardkeys"; type: "QVariant" }
- }
- Component {
- name: "FTrgHardwareRotary"
- defaultProperty: "actions"
- prototype: "FTrgHardwareControl"
- exports: ["com.ford.hmiframework/FTrgHardwareRotary 1.0"]
- Property { name: "valueChange"; type: "int" }
- Property { name: "rotary"; type: "QVariant" }
- }
- Component {
- name: "FTrgListModel"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgListModel 1.0"]
- Property { name: "model"; type: "FAbstractListModel"; isPointer: true }
- Property { name: "element"; type: "FAbstractListElement"; isReadonly: true; isPointer: true }
- Property { name: "index"; type: "int"; isReadonly: true }
- Method {
- name: "elementSelected"
- Parameter { type: "FAbstractListElement"; isPointer: true }
- Parameter { type: "int" }
- }
- }
- Component {
- name: "FTrgMenuElement"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgMenuElement 1.0"]
- Property { name: "menuElement"; type: "FMenuElement"; isPointer: true }
- Method {
- name: "elementSelected"
- Parameter { type: "FAbstractListElement"; isPointer: true }
- }
- }
- Component {
- name: "FTrgTouchArea"
- defaultProperty: "actions"
- prototype: "FTrigger"
- exports: ["com.ford.hmiframework/FTrgTouchArea 1.0"]
- Property { name: "touchArea"; type: "FWdgtTouchArea"; isPointer: true }
- Property { name: "touchAction"; type: "int" }
- Property { name: "xPos"; type: "int" }
- Property { name: "yPos"; type: "int" }
- Method {
- name: "touchEvent"
- Parameter { name: "action"; type: "int" }
- Parameter { name: "x"; type: "int" }
- Parameter { name: "y"; type: "int" }
- }
- }
- Component {
- name: "FTrigger"
- defaultProperty: "actions"
- prototype: "FMetaInfoObject"
- exports: ["com.ford.hmiframework/FTrigger 1.0"]
- Property { name: "initialized"; type: "bool" }
- Property { name: "actions"; type: "FAction"; isList: true; isReadonly: true }
- Signal {
- name: "init"
- Parameter { type: "FStateView"; isPointer: true }
- }
- Signal {
- name: "cleanup"
- Parameter { type: "FStateView"; isPointer: true }
- }
- Signal { name: "intializedChanged" }
- }
- Component {
- name: "FView"
- defaultProperty: "data"
- prototype: "FWidget"
- exports: ["com.ford.hmiframework/FView 1.0"]
- Property { name: "viewClass"; type: "FViewClass"; isPointer: true }
- }
- Component {
- name: "FViewClass"
- defaultProperty: "derivedClass"
- prototype: "FMetaInfoObject"
- exports: ["com.ford.hmiframework/FViewClass 1.0"]
- Property { name: "derivedClass"; type: "FViewClass"; isList: true; isReadonly: true }
- }
- Component {
- name: "FWdgtTouchArea"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["com.ford.hmiframework/FWdgtTouchArea 1.0"]
- Property { name: "pressed"; type: "bool" }
- Property { name: "enabled"; type: "bool" }
- Property { name: "longPressMSec"; type: "int" }
- Property { name: "repeatDelayMSec"; type: "int" }
- Property { name: "repeatIntervalMSec"; type: "int" }
- Signal {
- name: "touchEvent"
- Parameter { name: "event"; type: "int" }
- Parameter { name: "x"; type: "int" }
- Parameter { name: "y"; type: "int" }
- }
- }
- Component {
- name: "FWidget"
- defaultProperty: "data"
- prototype: "FWidgetBase"
- exports: ["com.ford.hmiframework/FWidget 1.0"]
- Property { name: "layout"; type: "FLayout"; isPointer: true }
- Property { name: "triggers"; type: "FTrigger"; isList: true; isReadonly: true }
- }
- Component { name: "FWidgetBase"; defaultProperty: "data"; prototype: "FMetaInfoItem" }
- Component {
- name: "QAbstractProxyModel"
- prototype: "QAbstractItemModel"
- Property { name: "sourceModel"; type: "QAbstractItemModel"; isPointer: true }
- }
- Component { name: "QIdentityProxyModel"; prototype: "QAbstractProxyModel" }
- Component {
- name: "QSortFilterProxyModel"
- prototype: "QAbstractProxyModel"
- exports: ["com.ford.hmiframework/FSortFilterProxyListModel 1.0"]
- Property { name: "filterRegExp"; type: "QRegExp" }
- Property { name: "filterKeyColumn"; type: "int" }
- Property { name: "dynamicSortFilter"; type: "bool" }
- Property { name: "filterCaseSensitivity"; type: "Qt::CaseSensitivity" }
- Property { name: "sortCaseSensitivity"; type: "Qt::CaseSensitivity" }
- Property { name: "isSortLocaleAware"; type: "bool" }
- Property { name: "sortRole"; type: "int" }
- Property { name: "filterRole"; type: "int" }
- Method {
- name: "setFilterRegExp"
- Parameter { name: "pattern"; type: "string" }
- }
- Method {
- name: "setFilterWildcard"
- Parameter { name: "pattern"; type: "string" }
- }
- Method {
- name: "setFilterFixedString"
- Parameter { name: "pattern"; type: "string" }
- }
- Method { name: "clear" }
- Method { name: "invalidate" }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtBorderImage.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtBorderImage.qml deleted file mode 100644 index c95ebd3191..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtBorderImage.qml +++ /dev/null @@ -1,40 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-BorderImage {
- property string bitmap: ""
- property bool themed: false
-
- onBitmapChanged: {
- applyThemedImage();
- }
-
- function applyThemedImage() {
- if (bitmap !== "") {
- if (themed) {
- source = FThemeProvider.resourcePath + "/" + FThemeProvider.theme + "/" + bitmap;
- }
- else {
- source = FThemeProvider.resourcePath + "/" + bitmap;
- }
- }
- else {
- source = "";
- }
- }
-
- Component.onCompleted: {
- if (themed)
- {
- FThemeProvider.themeChanged.connect(applyThemedImage);
- }
- }
-
- Component.onDestruction: {
- if (themed)
- {
- FThemeProvider.themeChanged.disconnect(applyThemedImage);
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtContainer.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtContainer.qml deleted file mode 100644 index f0e4720cce..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtContainer.qml +++ /dev/null @@ -1,8 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-Item {
- id: container
-
- property alias widget: container.children
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtGridView.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtGridView.qml deleted file mode 100644 index 61d1832db4..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtGridView.qml +++ /dev/null @@ -1,35 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-GridView {
- id: theGrid
-
- property alias data : theGrid.model
- property alias itemWidget : theGrid.delegate
-
- /*
- Setting rows/columns fundamentally changes how children fit into the GridView.
- -Normal behaviour: Children have a fixed size (cellWidth/cellHeight) and the NUMBER of them
- that will fit into the GridView varies with the GridView's size.
- -Modified behaviour(setting rows and/or columns triggers this mode): A fixed number of children
- will fit into the GridView (determined by number of rows/columns) and their SIZE
- (cellWidth/cellHeight) will vary with the GridView's size
- -rows/columns determines the size of VISIBLE children and simply sets cellWidth/cellHeight at runtime.
- If the number of children is different than rows * columns, it will either scroll or not
- fill the GridView completely, same as normal.
- -the item_Widget component must be designed for fluid layout using anchors, not fixed sizes,
- for this to have any effect besides spacing
- */
- property int rows
- property int columns
-
- Component.onCompleted: {
- if (rows) {
- theGrid.cellHeight = theGrid.height/rows
- }
- if (columns) {
- theGrid.cellWidth = theGrid.width/columns
- }
- }
-
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtImage.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtImage.qml deleted file mode 100644 index 89e57bbf0e..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtImage.qml +++ /dev/null @@ -1,43 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-Image {
- property string bitmap: ""
- property bool themed: false
-
- fillMode: Image.PreserveAspectFit
- asynchronous: true
-
- onBitmapChanged: {
- applyThemedImage();
- }
-
- function applyThemedImage() {
- if (bitmap !== "") {
- if (themed) {
- source = FThemeProvider.resourcePath + "/" + FThemeProvider.getFileSubPath(bitmap) + bitmap;
- }
- else {
- source = FThemeProvider.resourcePath + "/" + bitmap;
- }
- }
- else {
- source = "";
- }
- }
-
- Component.onCompleted: {
- if (themed)
- {
- FThemeProvider.themeChanged.connect(applyThemedImage);
- }
- }
-
- Component.onDestruction: {
- if (themed)
- {
- FThemeProvider.themeChanged.disconnect(applyThemedImage);
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtListView.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtListView.qml deleted file mode 100644 index 7e1ccd10a3..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtListView.qml +++ /dev/null @@ -1,9 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-ListView {
- id: theList
-
- property alias data : theList.model
- property alias itemWidget : theList.delegate
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtPathView.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtPathView.qml deleted file mode 100644 index 08762015a9..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtPathView.qml +++ /dev/null @@ -1,9 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-PathView {
- id: thePathView
-
- property alias data : thePathView.model
- property alias itemWidget : thePathView.delegate
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtScrollbar.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtScrollbar.qml deleted file mode 100644 index 74c1e27e9b..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtScrollbar.qml +++ /dev/null @@ -1,104 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-BorderImage {
- property variant target
-
- source: "../Resources/scrollbar.png"
- border {left: 0; top: 3; right: 0; bottom: 3}
- width: 17
-
- //anchors {top: target.top; bottom: target.bottom; right: target.right }
- visible: (track.height == slider.height) ? false : true //TODO: !visible -> width: 0 (but creates a binding loop)
-
- Item {
- anchors {fill: parent; margins: 1; rightMargin: 2; bottomMargin: 2}
-
- Image {
- id: upArrow
- source: "../Resources/up-arrow.png"
- anchors.top: parent.top
- MouseArea {
- anchors.fill: parent
- onPressed: {
- timer.scrollAmount = -10
- timer.running = true;
- }
- onReleased: {
- timer.running = false;
- }
- }
- }
-
- Timer {
- property int scrollAmount
-
- id: timer
- repeat: true
- interval: 20
- onTriggered: {
- target.contentY = Math.max(
- 0, Math.min(
- target.contentY + scrollAmount,
- target.contentHeight - target.height));
- }
- }
-
- Item {
- id: track
- anchors {top: upArrow.bottom; topMargin: 1; bottom: dnArrow.top;}
- width: parent.width
-
- MouseArea {
- anchors.fill: parent
- onPressed: {
- timer.scrollAmount = target.height * (mouseY < slider.y ? -1 : 1) // scroll by a page
- timer.running = true;
- }
- onReleased: {
- timer.running = false;
- }
- }
-
- BorderImage {
- id:slider
-
- source: "../Resources/slider.png"
- border {left: 0; top: 3; right: 0; bottom: 3}
- width: parent.width
-
- height: Math.min(target.height / target.contentHeight * track.height, track.height)
- y: target.visibleArea.yPosition * track.height
-
- MouseArea {
- anchors.fill: parent
- drag.target: parent
- drag.axis: Drag.YAxis
- drag.minimumY: 0
- drag.maximumY: track.height - height
-
- onPositionChanged: {
- if (pressedButtons == Qt.LeftButton) {
- target.contentY = slider.y * target.contentHeight / track.height
- }
- }
- }
- }
- }
- Image {
- id: dnArrow
- source: "../Resources/dn-arrow.png"
- anchors.bottom: parent.bottom
- MouseArea {
- anchors.fill: parent
- onPressed: {
- timer.scrollAmount = 10
- timer.running = true;
- }
- onReleased: {
- timer.running = false;
- }
- }
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtScrollview.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtScrollview.qml deleted file mode 100644 index a42f74c9fe..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtScrollview.qml +++ /dev/null @@ -1,7 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-Flickable {
- id: theScrollView
- clip: true
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtText.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtText.qml deleted file mode 100644 index 9e7a93773f..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtText.qml +++ /dev/null @@ -1,6 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-Text {
- id: myText
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtTouchAreaEnums.js b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtTouchAreaEnums.js deleted file mode 100644 index f21a454065..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/BaseWidgets/FWdgtTouchAreaEnums.js +++ /dev/null @@ -1,12 +0,0 @@ -.pragma library
-
-var In = 1
-var Out = 2
-var Short = 4
-var Long = 8
-var Repeat = 16
-var InRepeat = 17
-var All = 31
-var Cancel = 32
-var DragOut = 64
-var DragIn = 128
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActScriptCall.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActScriptCall.qml deleted file mode 100644 index 39862d6f22..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActScriptCall.qml +++ /dev/null @@ -1,13 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FAction {
- id: theAction
-
- signal script
-
- onExecute: {
- script();
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActSystemModelCall.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActSystemModelCall.qml deleted file mode 100644 index 5783286ccf..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActSystemModelCall.qml +++ /dev/null @@ -1,14 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-
-FAction {
- id: theAction
-
- signal call
-
- onExecute: {
- call();
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActTimer.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActTimer.qml deleted file mode 100644 index e31937a2b9..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActTimer.qml +++ /dev/null @@ -1,25 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FAction {
- id: theAction
-
- property variant timer
- property int action: 1
-
- onExecute: {
- switch(action)
- {
- case TM.Start:
- timer.start();
- break;
- case TM.Restart:
- timer.restart();
- break;
- case TM.Stop:
- timer.stop();
- break;
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActWidgetCall.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActWidgetCall.qml deleted file mode 100644 index 6e7048fe9a..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActWidgetCall.qml +++ /dev/null @@ -1,13 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FAction {
- id: theAction
-
- signal call
-
- onExecute: {
- call();
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActWidgetProperty.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActWidgetProperty.qml deleted file mode 100644 index 040695d298..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FActWidgetProperty.qml +++ /dev/null @@ -1,13 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FAction {
- id: theAction
-
- signal change
-
- onExecute: {
- change();
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FAnimViewHide.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FAnimViewHide.qml deleted file mode 100644 index 4eef062bea..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FAnimViewHide.qml +++ /dev/null @@ -1,6 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-FAnimView {
- supportOutgoing: true
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FAnimationEnums.js b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FAnimationEnums.js deleted file mode 100644 index 117cb99267..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FAnimationEnums.js +++ /dev/null @@ -1,7 +0,0 @@ -.pragma library
-
-var Start = 1
-var Restart = 2
-var Pause = 3
-var Resume = 4
-var Stop = 0
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FConditionPool.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FConditionPool.qml deleted file mode 100644 index 97c502e517..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FConditionPool.qml +++ /dev/null @@ -1,5 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-QtObject {
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FDataPool.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FDataPool.qml deleted file mode 100644 index 97c502e517..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FDataPool.qml +++ /dev/null @@ -1,5 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-QtObject {
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FEventPool.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FEventPool.qml deleted file mode 100644 index add0413172..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FEventPool.qml +++ /dev/null @@ -1,9 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-QtObject {
- id: theEventPool
- default property alias events: theEventPool._events
- property list<FEvent> _events
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FGaugeValue.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FGaugeValue.qml deleted file mode 100644 index 1886d54af7..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FGaugeValue.qml +++ /dev/null @@ -1,51 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-// The FGauge allows to transform an input value range into an output value rang using a smooth transition
-// it can be e.g. used to transfrom the speed of a vehicle into an angle of the pointer needle
-// The borders of the input and output ranges are mapped to each other and a linear transformation is executed
-
-Item {
- id: theGauge
-
- // the time required to move through the full range from e.g. min to max
- property int fullSweepTime: 1000
-
- // minimum border, the input value can reach
- property double minInput: 0.0
- // maximum value, the input can reach
- property double maxInput: 100.0
- // the current input value. Each change will trigger an animated change of the output
- property double currentInput: 50.0
-
- // minimum border, the output value can reach
- property double minOutput: 0.0
- // maximum value, the output can reach
- property double maxOutput: 100.0
- //
- property double currentOutput: 50.0
-
- // this is the targetted output. Changing this, will trigger the animation to be executed
- property double targetOutput
- // this is the time required to move to the target value
- property int targetTime
-
- PropertyAnimation { id: anim; target: theGauge; properties: "currentOutput"; to: theGauge.targetOutput; duration: theGauge.targetTime }
-
- onCurrentInputChanged: {
- // we need to calculate the target and the required time to reach it
- var target = (currentInput - minInput) * (maxOutput - minOutput) / (maxInput - minInput) + minOutput;
- if(target < minOutput) {
- target = minOutput;
- }
- else if (target > maxOutput) {
- target = maxOutput;
- }
-
- targetTime = Math.abs((target - currentOutput) / (maxOutput - minOutput)) * fullSweepTime;
- if(targetTime > 0) {
- targetOutput = target;
- anim.restart();
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FHardwareKeyEnums.js b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FHardwareKeyEnums.js deleted file mode 100644 index ee1db632a7..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FHardwareKeyEnums.js +++ /dev/null @@ -1,9 +0,0 @@ -.pragma library
-
-var In = 1
-var Out = 2
-var Short = 4
-var Long = 8
-var Repeat = 16
-var InRepeat = 17
-var All = 31
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStringFormat.js b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStringFormat.js deleted file mode 100644 index 1a1d2af589..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStringFormat.js +++ /dev/null @@ -1,132 +0,0 @@ -var leadSection = ""
-var trailSection = ""
-var varName = ""
-var formatSection = ""
-
-var digits = 0
-var digitZeros = 0
-var decimals = 0
-var decimalsZeros = 0
-var decimalSymbol = "."
-
-function splitFormatString(format) {
- // we need to analyze the structure of the string first
- // a typical notation is like this: "{distance:#00.0#} km", where
- // "{" "}" variable limiters
- // "distance" variable name, this will be discarded and has not effect
- // "#" non-leading/-trailing zero character
- // "0" leading/trailing zero character
- // " km" additional text which will remain unchanged
- leadSection = ""
- trailSection = ""
- varName = ""
- formatSection = ""
-
- var startPos = 0;
- var searchStep = 0;
- for(var i = 0; i < format.length; ++i)
- {
- // search for the opening "{"
- if(searchStep === 0) {
- if(format.charAt(i)==='{') {
- leadSection = format.slice(startPos, i);
- startPos = i + 1;
- searchStep++;
- }
- }
- // search for the ":" or the closing "}"
- else if(searchStep === 1) {
- if(format.charAt(i) === '}') {
- formatSection = format.slice(startPos, i);
- startPos = i + 1;
- trailSection = format.slice(startPos)
- break;
- }
- else if(format.charAt(i) === ':') {
- varName = format.slice(startPos, i);
- startPos = i + 1;
- searchStep++;
- }
- }
- else if(searchStep === 2) {
- if(format.charAt(i) === '}') {
- formatSection = format.slice(startPos, i);
- startPos = i + 1;
- trailSection = format.slice(startPos)
- break;
- }
- }
- }
-
- // finally we need to create the formatting string for sprintf out of the formatSection
- digits = 0;
- digitZeros = 0;
- decimals = 0;
- decimalsZeros = 0;
- searchStep = 0;
- for(var i = 0; i < formatSection.length; ++i) {
- if(searchStep === 0) {
- if(formatSection.charAt(i) === '#') {
- digits++;
- }
- else if(formatSection.charAt(i) === '0') {
- digits++;
- digitZeros++;
- }
- else if(formatSection.charAt(i) === '.' || formatSection.charAt(i) === ',') {
- decimalSymbol = formatSection.charAt(i);
- searchStep++;
- }
- }
- else if(searchStep === 1) {
- if(formatSection.charAt(i) === '#') {
- decimals++;
- }
- else if(formatSection.charAt(i) === '0') {
- decimals++;
- decimalsZeros++;
- }
- }
- }
-}
-
-function formatOutput(data)
-{
- // format the output, first the digits
- var digitString = Math.floor(data).toString();
- if(digitString.length < digitZeros) {
- // zero pad the string
- var temp = "";
- for(var i = 0; i < digitZeros - digitString.length; ++i) {
- temp += '0';
- }
- digitString = temp + digitString;
- }
- else {
- digitString = digitString.slice(-digits);
- }
-
- var decimalString = (data - Math.floor(data)).toFixed(decimals).slice(2);
- if (decimalString.length > decimalsZeros) {
- for (var i = decimalString.length - 1; i >= decimalsZeros; i--)
- {
- if(decimalString.charAt(i) === '0')
- {
- decimalString = decimalString.slice(0, -1);
- }
- }
- }
- else {
- for (var i = decimalString.length; i < decimalsZeros; i++)
- {
- decimalString += '0';
- }
- }
-
- if (decimalString.length > 0) {
- return leadSection + digitString + decimalSymbol + decimalString + trailSection;
- }
- else {
- return leadSection + digitString + trailSection;
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStringFormat.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStringFormat.qml deleted file mode 100644 index c3be3832fa..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStringFormat.qml +++ /dev/null @@ -1,28 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import "FStringFormat.js" as CB
-
-QtObject {
- // output string for which is used as output
- property string output
-
- // this string defines the format of the output
- property string format
-
- // this is the data to be formatted into the output
- property variant data
-
-
- onFormatChanged: {
- CB.splitFormatString(format);
- }
-
- onDataChanged: {
- doFormat();
- }
-
- function doFormat()
- {
- output = CB.formatOutput(data);
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyle.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyle.qml deleted file mode 100644 index 5f9106f9af..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyle.qml +++ /dev/null @@ -1,56 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-QtObject {
- id: _style
-
- Component.onCompleted: {
- FThemeProvider.themeChanged.connect(themeChanged);
- }
-
- // This property is used to assign a "style" filename to the style. This file loads the style data and updates the properties of the style
- property string styleFile: ""
-
- property bool themed: false
-
- onStyleFileChanged: {
- loadStyle(_style);
- }
-
- function themeChanged() {
- if (themed)
- {
- loadStyle(_style);
- }
- }
-
- // indicate, that the style has been updated to the attached widgets
- signal styleUpdated
-
- function loadStyle(style)
- {
- if(styleFile.length > 0) {
- console.log( "Loading style: " + styleFile + " (" + FThemeProvider.theme + ")")
- var xhr = new XMLHttpRequest();
- xhr.open("GET", FThemeProvider.resourcePath + FThemeProvider.getFileSubPath(styleFile + ".qmlstyle") + "/" + styleFile + ".qmlstyle");
- xhr.onreadystatechange = function() {
- if (xhr.readyState === XMLHttpRequest.DONE) {
- try {
- var a = JSON.parse(xhr.responseText);
- for (var b in a) {
- if (style.hasOwnProperty(b)) {
- style[b] = a[b];
- }
- }
- styleUpdated();
- }
- catch (ex) {
- console.log("Style exception (" + styleFile + "): " + ex);
- }
- }
- }
- xhr.send();
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml deleted file mode 100644 index 3fb89882da..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FStyler.qml +++ /dev/null @@ -1,41 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-QtObject {
- // this property can be FStyle, but only if the instance is created in place and not assigned. Otherwise we need to use variant
- //property FStyle style
- property variant style
- property variant styleTarget
-
- onStyleChanged: {
- if(style !== undefined && style !== null) {
- style.styleUpdated.connect(applyStyle);
- applyStyle();
- }
- }
-
- onStyleTargetChanged: {
- applyStyle();
- }
-
- function applyStyle()
- {
- if(style !== undefined && style !== null && styleTarget !== undefined && styleTarget !== null) {
- setStyledProperties(style, styleTarget)
- }
- }
-
- function setStyledProperties(style, target)
- {
- for(var prop in style) {
- // first filter unwanted properties
- if(prop !== "objectName" && prop.slice(-7) !== "Changed" ) {
- // process only properties owned by style & target
- if (target.hasOwnProperty(prop)) {
- // assign the value
- target[prop] = style[prop];
- }
- }
- }
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTimer.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTimer.qml deleted file mode 100644 index bc148998b9..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTimer.qml +++ /dev/null @@ -1,6 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-Timer {
- triggeredOnStart: false
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTimerEnums.js b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTimerEnums.js deleted file mode 100644 index d657de1f0c..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTimerEnums.js +++ /dev/null @@ -1,5 +0,0 @@ -.pragma library
-
-var Stop = 0
-var Start = 1
-var Restart = 2
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTrgTimer.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTrgTimer.qml deleted file mode 100644 index b3ac5f8a15..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FTrgTimer.qml +++ /dev/null @@ -1,19 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-import com.ford.hmiframework 1.0
-
-FTrigger {
- property QtObject timer
-
- onInit: {
- timer.triggered.connect(timerTrigger);
- }
-
- onCleanup: {
- timer.triggered.disconnect(timerTrigger);
- }
-
- function timerTrigger() {
- executeActions();
- }
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCase.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCase.qml deleted file mode 100644 index 258a1da623..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCase.qml +++ /dev/null @@ -1,9 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-State {
- default property alias propertyChange: myState.changes
- property alias condition: myState.when
- id: myState
- when: true === true
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseGroup.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseGroup.qml deleted file mode 100644 index 7b1fa6ba51..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseGroup.qml +++ /dev/null @@ -1,7 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-StateGroup {
- id: myUseCaseGroup
- default property alias useCases: myUseCaseGroup.states
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseSimple.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseSimple.qml deleted file mode 100644 index 44da5a5a79..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseSimple.qml +++ /dev/null @@ -1,15 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-StateGroup {
- default property alias propertyChange: theState.changes
- property alias condition: theState.when
-
- states: [
- State {
- id: theState
- name: "*"
- when: true == true
- }
- ]
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseTransition.qml b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseTransition.qml deleted file mode 100644 index 24f6acfa4f..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qml/Framework/FViewUseCaseTransition.qml +++ /dev/null @@ -1,6 +0,0 @@ -// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
-import QtQuick 2.0
-
-Transition {
- to: "*"
-}
diff --git a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qmldir b/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qmldir deleted file mode 100644 index 3ccd0e58e8..0000000000 --- a/src/components/qt_hmi/References/Look/plugins/com/ford/hmiframework/qmldir +++ /dev/null @@ -1,35 +0,0 @@ -module com.ford.hmiframework
-plugin QtHMIFramework
-typeinfo plugin.qmltypes
-FActScriptCall 1.0 qml/Framework/FActScriptCall.qml
-FActSystemModelCall 1.0 qml/Framework/FActSystemModelCall.qml
-FActTimer 1.0 qml/Framework/FActTimer.qml
-FActWidgetCall 1.0 qml/Framework/FActWidgetCall.qml
-FActWidgetProperty 1.0 qml/Framework/FActWidgetProperty.qml
-FConditionPool 1.0 qml/Framework/FConditionPool.qml
-FDataPool 1.0 qml/Framework/FDataPool.qml
-FEventPool 1.0 qml/Framework/FEventPool.qml
-FGaugeValue 1.0 qml/Framework/FGaugeValue.qml
-FStringFormat 1.0 qml/Framework/FStringFormat.qml
-FStyle 1.0 qml/Framework/FStyle.qml
-FStyler 1.0 qml/Framework/FStyler.qml
-FTimer 1.0 qml/Framework/FTimer.qml
-FTrgTimer 1.0 qml/Framework/FTrgTimer.qml
-FViewUseCase 1.0 qml/Framework/FViewUseCase.qml
-FViewUseCaseGroup 1.0 qml/Framework/FViewUseCaseGroup.qml
-FViewUseCaseSimple 1.0 qml/Framework/FViewUseCaseSimple.qml
-FViewUseCaseTransition 1.0 qml/Framework/FViewUseCaseTransition.qml
-FWdgtBorderImage 1.0 qml/BaseWidgets/FWdgtBorderImage.qml
-FWdgtContainer 1.0 qml/BaseWidgets/FWdgtContainer.qml
-FWdgtImage 1.0 qml/BaseWidgets/FWdgtImage.qml
-FWdgtListView 1.0 qml/BaseWidgets/FWdgtListView.qml
-FWdgtPathView 1.0 qml/BaseWidgets/FWdgtPathView.qml
-FWdgtGridView 1.0 qml/BaseWidgets/FWdgtGridView.qml
-FWdgtScrollbar 1.0 qml/BaseWidgets/FWdgtScrollbar.qml
-FWdgtScrollview 1.0 qml/BaseWidgets/FWdgtScrollview.qml
-FWdgtScrollText 1.0 qml/BaseWidgets/FWdgtScrollText.qml
-FWdgtText 1.0 qml/BaseWidgets/FWdgtText.qml
-HK 1.0 qml/Framework/FHardwareKeyEnums.js
-TA 1.0 qml/BaseWidgets/FWdgtTouchAreaEnums.js
-ANIM 1.0 qml/Framework/FAnimationEnums.js
-TM 1.0 qml/Framework/FTimerEnums.js
diff --git a/src/components/qt_hmi/References/Work/bananasnacks/BananaSnacks.pro b/src/components/qt_hmi/References/Work/bananasnacks/BananaSnacks.pro deleted file mode 100644 index c20d41ede5..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/BananaSnacks.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add more folders to ship with the application, here -folder_01.source = qml/Bananas -folder_01.target = qml - -folder_02.source = plugins/com -folder_02.target = plugins -DEPLOYMENTFOLDERS = folder_01 folder_02 - -SOURCES += main.cpp - -linux-g++* { - QMAKE_CXXFLAGS += -m32 - QMAKE_LFLAGS += -m32 -L/usr/lib/i386-linux-gnu/mesa -} - -# Please do not modify the following two lines. Required for deployment. -include(qtquick2applicationviewer/qtquick2applicationviewer.pri) -qtcAddDeployment() - -OTHER_FILES += \ - qml/Bananas/Layouts/TitledLayout.qml diff --git a/src/components/qt_hmi/References/Work/bananasnacks/Bananas.desktop b/src/components/qt_hmi/References/Work/bananasnacks/Bananas.desktop deleted file mode 100644 index a7bfa0111f..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/Bananas.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=Bananas -Exec=/opt/Bananas/bin/Bananas -Icon=Bananas64 -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/src/components/qt_hmi/References/Work/bananasnacks/Bananas64.png b/src/components/qt_hmi/References/Work/bananasnacks/Bananas64.png Binary files differdeleted file mode 100644 index 707d5c4e85..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/Bananas64.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/Bananas80.png b/src/components/qt_hmi/References/Work/bananasnacks/Bananas80.png Binary files differdeleted file mode 100644 index 6ad8096c45..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/Bananas80.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/Bananas_harmattan.desktop b/src/components/qt_hmi/References/Work/bananasnacks/Bananas_harmattan.desktop deleted file mode 100644 index 5ced151d06..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/Bananas_harmattan.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Version=1.0 -Type=Application -Terminal=false -Name=Bananas -Exec=/usr/bin/single-instance /opt/Bananas/bin/Bananas -Icon=/usr/share/icons/hicolor/80x80/apps/Bananas80.png -X-Window-Icon= -X-HildonDesk-ShowInToolbar=true -X-Osso-Type=application/x-executable diff --git a/src/components/qt_hmi/References/Work/bananasnacks/README.md b/src/components/qt_hmi/References/Work/bananasnacks/README.md deleted file mode 100644 index 993a4bf59d..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/README.md +++ /dev/null @@ -1,37 +0,0 @@ -#### sudo vi /etc/apt/apt.conf - -``ruby -Acquire::http::proxy "http://proxyvipecc.nb.ford.com:83"; -Acquire::https::proxy "https://proxyvipecc.nb.ford.com:83"; -`` - -``bash -sudo apt-get update -sudo apt-get install git vim build-essential mesa-common-dev libgl1-mesa-dev # for 64bit: libc6-dev-i386 lib32stdc++6 lib32stdc++6-4.7-dev libgl1-mesa-dev:i386 - -ssh-keygen -<enter x3> -cat ~/.ssh/id_rsa.pub # Save this as a public ssh key on your Gitlab account - -git clone git@devbox.pd8.ford.com:zchurch/bananasnacks.git # Type 'yes' to trust the remote host - -wget http://releases.qt-project.org/qt5/5.0.1/qt-linux-opensource-5.0.1-x86-offline.run -chmod +x qt-linux-opensource-5.0.1-x86-offline.run -./qt-linux-opensource-5.0.1-x86-offline.run # Press next, accept, etc... Do install the Tools. This includes Creator. - -echo "export PATH=\$PATH:~/Qt5.0.1/5.0.1/gcc/bin" >> ~/.bashrc - -cd ~/bananasnacks -./fetch_plugins.sh -qmake -make -./Bananas - -`` - - -### Troubleshooting - -#### bash: ./qt-linux-opensource-5.0.1-x86-offline.run: No such file or directory -You didn't install all your apt-get things. You're missing ia32-libs. Or the file isn't there. - diff --git a/src/components/qt_hmi/References/Work/bananasnacks/bananas.qmlproject b/src/components/qt_hmi/References/Work/bananasnacks/bananas.qmlproject deleted file mode 100644 index f9502d2a90..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/bananas.qmlproject +++ /dev/null @@ -1,19 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "qml/Bananas/main.qml" - - QmlFiles { - directory: "." - } - - JavaScriptFiles { - directory: "." - } - - ImageFiles { - directory: "." - } - - importPaths: [ "plugins" ] -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/fetch_plugins.sh b/src/components/qt_hmi/References/Work/bananasnacks/fetch_plugins.sh deleted file mode 100755 index 0f90baeb58..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/fetch_plugins.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -wget http://19.7.95.92/uploads/note/attachment/12/libFordMediaCore.so -chmod 775 libFordMediaCore.so -mv libFordMediaCore.so plugins/com/ford/mediacore - -wget http://19.7.95.92/uploads/note/attachment/11/libFordPhoneCore.so -chmod 775 libFordPhoneCore.so -mv libFordPhoneCore.so plugins/com/ford/phonecore diff --git a/src/components/qt_hmi/References/Work/bananasnacks/load_env.sh b/src/components/qt_hmi/References/Work/bananasnacks/load_env.sh deleted file mode 100755 index 0f094b5275..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/load_env.sh +++ /dev/null @@ -1 +0,0 @@ -# source ./load_env.sh diff --git a/src/components/qt_hmi/References/Work/bananasnacks/main.cpp b/src/components/qt_hmi/References/Work/bananasnacks/main.cpp deleted file mode 100644 index bb40110e13..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/main.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include <QtGui/QGuiApplication> -#include <QQmlContext> -#include "qtquick2applicationviewer.h" - -int main(int argc, char* argv[]) { - QGuiApplication app(argc, argv); - - QtQuick2ApplicationViewer viewer; - - viewer.addImportPath(QStringLiteral("plugins")); - - viewer.setMainQmlFile(QStringLiteral("qml/Bananas/main.qml")); - viewer.showExpanded(); - - return app.exec(); -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/mediacore/qmldir b/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/mediacore/qmldir deleted file mode 100644 index bb93f40934..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/mediacore/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module com.ford.mediacore -plugin FordMediaCore diff --git a/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/navcore/qmldir b/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/navcore/qmldir deleted file mode 100644 index aaacfe020e..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/navcore/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.ford.navcore -plugin FordNavCore - diff --git a/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/phonecore/qmldir b/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/phonecore/qmldir deleted file mode 100644 index 861f2e2232..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/phonecore/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.ford.phonecore -plugin FordPhoneCore - diff --git a/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/sdlcore/qmldir b/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/sdlcore/qmldir deleted file mode 100644 index da1a7b7f96..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/plugins/com/ford/sdlcore/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.ford.sdlcore -plugin FordSdlCore - diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/AddIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/AddIcon.png Binary files differdeleted file mode 100644 index 7111c7c932..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/AddIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/BackIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/BackIcon.png Binary files differdeleted file mode 100644 index d8e6079685..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/BackIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/BluetoothIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/BluetoothIcon.png Binary files differdeleted file mode 100644 index 1a65f07518..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/BluetoothIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/CMaxCal.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/CMaxCal.png Binary files differdeleted file mode 100644 index cfb6d6d59e..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/CMaxCal.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ChromeBottom.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ChromeBottom.png Binary files differdeleted file mode 100644 index 91ed3ef6e2..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ChromeBottom.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ChromeTop.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ChromeTop.png Binary files differdeleted file mode 100644 index d7ba38ab8c..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ChromeTop.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Cloud.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Cloud.png Binary files differdeleted file mode 100644 index 4555d71dfb..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Cloud.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/CloudNight.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/CloudNight.png Binary files differdeleted file mode 100644 index c21373f220..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/CloudNight.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/FunArtwork.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/FunArtwork.png Binary files differdeleted file mode 100644 index 251db8a7a5..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/FunArtwork.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/MapMich.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/MapMich.png Binary files differdeleted file mode 100644 index 2f8dc5130c..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/MapMich.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/SiriusArtwork.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/SiriusArtwork.png Binary files differdeleted file mode 100644 index 49a01feeaf..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Content/SiriusArtwork.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Crosshairs.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Crosshairs.png Binary files differdeleted file mode 100644 index 52430d8c56..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Crosshairs.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/DeleteIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/DeleteIcon.png Binary files differdeleted file mode 100644 index f47954968c..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/DeleteIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/DndIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/DndIcon.png Binary files differdeleted file mode 100644 index caa6489154..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/DndIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/EvIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/EvIcon.png Binary files differdeleted file mode 100644 index 6c58389891..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/EvIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/FavoritesIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/FavoritesIcon.png Binary files differdeleted file mode 100644 index 0871c51503..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/FavoritesIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Forward.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Forward.png Binary files differdeleted file mode 100644 index 02548e946d..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Forward.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/HomeIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/HomeIcon.png Binary files differdeleted file mode 100644 index 2bdd652e0a..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/HomeIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeyboardIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeyboardIcon.png Binary files differdeleted file mode 100644 index c6797a440b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeyboardIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeypadEntryIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeypadEntryIcon.png Binary files differdeleted file mode 100644 index b9ca08ad02..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeypadEntryIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeypadIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeypadIcon.png Binary files differdeleted file mode 100644 index a70ee397fe..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/KeypadIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/LightingIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/LightingIcon.png Binary files differdeleted file mode 100644 index 3847da93c8..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/LightingIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Loop.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Loop.png Binary files differdeleted file mode 100644 index 4405a629ce..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Loop.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MediaTab.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MediaTab.png Binary files differdeleted file mode 100644 index 482b6821e2..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MediaTab.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MessagesIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MessagesIcon.png Binary files differdeleted file mode 100644 index 5e86d80c76..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MessagesIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MissingArtwork.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MissingArtwork.png Binary files differdeleted file mode 100644 index 525e4b9158..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/MissingArtwork.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/NavigationTab.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/NavigationTab.png Binary files differdeleted file mode 100644 index 4bce721385..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/NavigationTab.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PandoraIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PandoraIcon.png Binary files differdeleted file mode 100644 index 55498b9134..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PandoraIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Pause.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Pause.png Binary files differdeleted file mode 100644 index bbede19900..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Pause.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneCornerIcons.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneCornerIcons.png Binary files differdeleted file mode 100644 index 281e20a1f4..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneCornerIcons.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneIcons.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneIcons.png Binary files differdeleted file mode 100644 index e4071e0932..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneIcons.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneTab.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneTab.png Binary files differdeleted file mode 100644 index 9b36907b33..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhoneTab.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhonebookIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhonebookIcon.png Binary files differdeleted file mode 100644 index 6af9c10463..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PhonebookIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Play.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Play.png Binary files differdeleted file mode 100644 index 1b665e3633..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Play.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PoiIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PoiIcon.png Binary files differdeleted file mode 100644 index b7b532db7b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/PoiIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RadioIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RadioIcon.png Binary files differdeleted file mode 100644 index f660610202..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RadioIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RecentCallsIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RecentCallsIcon.png Binary files differdeleted file mode 100644 index 16a31b29ba..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RecentCallsIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RecentDestinationsIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RecentDestinationsIcon.png Binary files differdeleted file mode 100644 index 4351243d4b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RecentDestinationsIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Rewind.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Rewind.png Binary files differdeleted file mode 100644 index 798f754801..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Rewind.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RightTurn.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RightTurn.png Binary files differdeleted file mode 100644 index b1d03d24ae..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/RightTurn.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ScoutIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ScoutIcon.png Binary files differdeleted file mode 100644 index 2c8e7cb2da..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ScoutIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SearchIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SearchIcon.png Binary files differdeleted file mode 100644 index 571d06c97b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SearchIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SeatsIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SeatsIcon.png Binary files differdeleted file mode 100644 index caff60c58b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SeatsIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ServicesIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ServicesIcon.png Binary files differdeleted file mode 100644 index 63a5a6a9db..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/ServicesIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Shuffle.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Shuffle.png Binary files differdeleted file mode 100644 index 4b3fc65c61..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/Shuffle.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SiriusIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SiriusIcon.png Binary files differdeleted file mode 100644 index 0ea1209925..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SiriusIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SpeedDialIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SpeedDialIcon.png Binary files differdeleted file mode 100644 index f871a96543..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/SpeedDialIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/UsbIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/UsbIcon.png Binary files differdeleted file mode 100644 index 8f0c759edf..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/UsbIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VehicleCornerIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VehicleCornerIcon.png Binary files differdeleted file mode 100644 index 79a277b185..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VehicleCornerIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VehicleTab.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VehicleTab.png Binary files differdeleted file mode 100644 index b6fb90276f..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VehicleTab.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VhrIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VhrIcon.png Binary files differdeleted file mode 100644 index c27ac4a874..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VhrIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VoicemailIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VoicemailIcon.png Binary files differdeleted file mode 100644 index c3f91de709..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/VoicemailIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WallpaperIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WallpaperIcon.png Binary files differdeleted file mode 100644 index e3277af0ac..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WallpaperIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WifiIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WifiIcon.png Binary files differdeleted file mode 100644 index 97ce15688d..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WifiIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WorkIcon.png b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WorkIcon.png Binary files differdeleted file mode 100644 index 69e50caa39..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Assets/WorkIcon.png +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/BackButton.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/BackButton.qml deleted file mode 100644 index 61f0311815..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/BackButton.qml +++ /dev/null @@ -1,9 +0,0 @@ -import QtQuick 2.0 - -ImageButton { - icon: "../Assets/BackIcon.png" - height: 42 - width: 60 - anchors.top: parent.top - anchors.left: parent.left -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Button.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Button.qml deleted file mode 100644 index 7f3c30126b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Button.qml +++ /dev/null @@ -1,32 +0,0 @@ -import QtQuick 2.0 - -Rectangle { - signal press - property alias text: clickable.text - property alias textAnchors: clickable.textAnchors - property alias clickable: clickable - id: container - border.color: "#333" - border.width: 1 - height: 45 - width: 150 - radius: 3 - gradient: Gradient { - GradientStop { - position: 0.0 - color: clickable.pressed ? "#3C1414" : Qt.rgba(0.18, 0.18, 0.18, 1) - } - GradientStop { - position: 1.0 - color: clickable.pressed ? "#9C3335" : "black" - } - } - Clickable { - anchors.fill: parent - id: clickable - onPress: container.press() - - textAnchors.horizontalCenter: horizontalCenter - textAnchors.verticalCenter: verticalCenter - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/CheckButton.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/CheckButton.qml deleted file mode 100644 index 713d00d1b3..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/CheckButton.qml +++ /dev/null @@ -1,36 +0,0 @@ -import QtQuick 2.0 - -Rectangle { - signal press - property alias text: clickable.text - - states: [ - State { - name: 'pressed' - } - ] - id: container - border.color: "#333" - border.width: 1 - height: 45 - width: 150 - radius: 3 - gradient: Gradient { - GradientStop { - position: 0.0 - color: (state === 'pressed' || clickable.pressed) ? "#3C1414" : Qt.rgba(0.18, 0.18, 0.18, 1) - } - GradientStop { - position: 1.0 - color: (state === 'pressed' || clickable.pressed) ? "#9C3335" : "black" - } - } - Clickable { - anchors.fill: parent - id: clickable - onPress: { container.press(); container.state = (container.state === '') ? 'pressed' : '' } - - textAnchors.horizontalCenter: horizontalCenter - textAnchors.verticalCenter: verticalCenter - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Clickable.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Clickable.qml deleted file mode 100644 index 2fdc97d7cd..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Clickable.qml +++ /dev/null @@ -1,24 +0,0 @@ -import QtQuick 2.0 - -Item { - property alias text: text.text - property alias pressed: mousearea.pressed - property alias textAnchors: text.anchors - signal press - - id: container - - Text { - id: text - color: "white" - font.pixelSize: 16 - } - - MouseArea { - id: mousearea - width: parent.width - height: parent.height - - onClicked: container.press() - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/GraphicalButton.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/GraphicalButton.qml deleted file mode 100644 index 2e670682ee..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/GraphicalButton.qml +++ /dev/null @@ -1,40 +0,0 @@ -import QtQuick 2.0 - -Rectangle { - signal press - property alias text: clickable.text - property alias image: image.source - - id: container - border.color: "#333" - border.width: 1 - height: 110 - width: 150 - radius: 3 - gradient: Gradient { - GradientStop { - position: 0.0 - color: clickable.pressed ? "#3C1414" : Qt.rgba(0.18, 0.18, 0.18, 1) - } - GradientStop { - position: 1.0 - color: clickable.pressed ? "#9C3335" : "black" - } - } - Clickable { - anchors.fill: parent - id: clickable - onPress: container.press() - - textAnchors.horizontalCenter: horizontalCenter - textAnchors.bottom: bottom - textAnchors.bottomMargin: 10 - - Image { - id: image - anchors.top: parent.top - anchors.topMargin: 10 - anchors.horizontalCenter: parent.horizontalCenter - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/H1.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/H1.qml deleted file mode 100644 index b68c7f0f1b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/H1.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.0 - -Text { - color: "#fff" - font.pixelSize: 32 -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/H2.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/H2.qml deleted file mode 100644 index 775838be06..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/H2.qml +++ /dev/null @@ -1,9 +0,0 @@ -import QtQuick 2.0 - -Text { - color: "#fff" - font.pixelSize: 24 - anchors.margins: 20 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/ImageButton.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/ImageButton.qml deleted file mode 100644 index 81c18a4311..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/ImageButton.qml +++ /dev/null @@ -1,13 +0,0 @@ -import QtQuick 2.0 - -Button { - property alias icon: icon.source - - width: icon.width + 30 - - Image { - id: icon - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Key.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Key.qml deleted file mode 100644 index 7fe5dbab83..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Key.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.0 - -Button { - width: 60 - - onPress: keyboard.letterClicked(text) -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Keyboard.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Keyboard.qml deleted file mode 100644 index fc5d26aa88..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Keyboard.qml +++ /dev/null @@ -1,129 +0,0 @@ -import QtQuick 2.0 - -Item { - signal letterClicked(string letter) - signal go() - id: keyboard - - states: [ - State { - name: 'numpad' - PropertyChanges { - target: qwerty - visible: false - } - PropertyChanges { - target: numpad - visible: true - } - } - - ] - - Column { - id: qwerty - anchors.fill: parent - spacing: 10 - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "Q" } - Key { text: "W" } - Key { text: "E" } - Key { text: "R" } - Key { text: "T" } - Key { text: "Y" } - Key { text: "U" } - Key { text: "I" } - Key { text: "O" } - Key { text: "P" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "A" } - Key { text: "S" } - Key { text: "D" } - Key { text: "F" } - Key { text: "G" } - Key { text: "H" } - Key { text: "J" } - Key { text: "K" } - Key { text: "L" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "Z" } - Key { text: "X" } - Key { text: "C" } - Key { text: "V" } - Key { text: "B" } - Key { text: "N" } - Key { text: "M" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - Button { text: "123"; width: 60 - onPress: keyboard.state = 'numpad' - } - Button { text: "!@#"; width: 60 } - Key { text: " "; width: 300 } - Key { text: "." } - Key { text: "&" } - } - } - - Column { - id: numpad - visible: false - anchors.fill: parent - spacing: 10 - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "1" } - Key { text: "2" } - Key { text: "3" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "4" } - Key { text: "5" } - Key { text: "6" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "7" } - Key { text: "8" } - Key { text: "9" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Button { - text: "ABC" - width: 60 - onPress: keyboard.state = '' - } - Key { text: "*" } - Key { text: "0" } - Key { text: "#" } - Button { - text: "Go" - width: 60 - onPress: keyboard.go() - } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Keypad.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Keypad.qml deleted file mode 100644 index 0dc0115acf..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Keypad.qml +++ /dev/null @@ -1,43 +0,0 @@ -import QtQuick 2.0 - -Item { - signal letterClicked(string letter) - id: keyboard - - Column { - anchors.fill: parent - spacing: 10 - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "1" } - Key { text: "2" } - Key { text: "3" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "4" } - Key { text: "5" } - Key { text: "6" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "7" } - Key { text: "8" } - Key { text: "9" } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - Key { text: "*" } - Key { text: "0" } - Key { text: "#" } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/MediaBrowser.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/MediaBrowser.qml deleted file mode 100644 index f0ef3ed2ae..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/MediaBrowser.qml +++ /dev/null @@ -1,40 +0,0 @@ -import QtQuick 2.0 - -ListView { - id: listView - anchors.fill: parent - anchors.topMargin: 120 - spacing: 10 - clip: true - model: MediaModel - - delegate: Button { - width: 500 - anchors.horizontalCenter: parent.horizontalCenter - OverflowableText { - text: name - fontColor: "#fff" - font.pixelSize: 20 - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 20 - width: parent.width - 40 - } - Text { - text: (model.count === 0) ? "" : model.count - anchors.right: parent.right - anchors.rightMargin: 20 - anchors.verticalCenter: parent.verticalCenter - color: "#fff" - } - - onPress: { - if (model.is_file) { - MediaPlayer.setPlaylist(model.pid, model.index); - usb.state = ''; - } else { - MediaModel.browseToChild(model.id) - } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/OverflowableText.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/OverflowableText.qml deleted file mode 100644 index 3149943613..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/OverflowableText.qml +++ /dev/null @@ -1,46 +0,0 @@ -import QtQuick 2.0 -import QtGraphicalEffects 1.0 - -Rectangle { - id: oflow_text - property alias text: text.text - property alias font: text.font - property alias fontColor: text.color - property string textAlign - color: Qt.rgba(0,0,0,0) - height: text.font.pixelSize * 1.2 - clip: true - Text { - id: text - Component.onCompleted: { - if (oflow_text.width < width) { - anchors.left = parent.left - } - else if (oflow_text.textAlign == 'center') { - anchors.horizontalCenter = parent.horizontalCenter - } - } - - NumberAnimation on anchors.leftMargin { - id: scroll_animation - to: oflow_text.width - text.width - duration: ((oflow_text.width - text.width) < 0) ? (text.width - oflow_text.width) * 15 : 0 - running: false - onStopped: { - restart_timer.start() - } - } - } - - Timer { - id: scroll_timer - running: true - interval: 3000 - onTriggered: { if (oflow_text.width < text.width) scroll_animation.start();} - } - Timer { - id: restart_timer - interval: 3000 - onTriggered: text.anchors.leftMargin = 0 - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/RadioButton.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/RadioButton.qml deleted file mode 100644 index 676d65be39..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/RadioButton.qml +++ /dev/null @@ -1,30 +0,0 @@ -import QtQuick 2.0 - -Rectangle { - signal press - property alias text: clickable.text - id: container - border.color: "#333" - border.width: 1 - height: 45 - width: 150 - radius: 3 - gradient: Gradient { - GradientStop { - position: 0.0 - color: (container.focus || clickable.pressed) ? "#3C1414" : Qt.rgba(0.18, 0.18, 0.18, 1) - } - GradientStop { - position: 1.0 - color: (container.focus || clickable.pressed) ? "#9C3335" : "black" - } - } - Clickable { - anchors.fill: parent - id: clickable - onPress: { container.forceActiveFocus(); container.press(); } - - textAnchors.horizontalCenter: horizontalCenter - textAnchors.verticalCenter: verticalCenter - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/RadioButtonGroup.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/RadioButtonGroup.qml deleted file mode 100644 index d4266d149b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/RadioButtonGroup.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtQuick 2.0 - -FocusScope { - -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Section.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Section.qml deleted file mode 100644 index 18b5c22f7d..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Section.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.0 - -Loader { - anchors.fill: parent - asynchronous: true -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/TextBox.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/TextBox.qml deleted file mode 100644 index 4c52e05b2a..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/TextBox.qml +++ /dev/null @@ -1,29 +0,0 @@ -import QtQuick 2.0 - -Rectangle { - property alias text: text.text - property alias icon: icon.source - - border.width: 2 - color: 'black' - height: 42 - radius: 3 - - Image { - id: icon - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 20 - } - - TextInput { - id: text - color: "white" - font.pixelSize: 24 - anchors.left: icon.right - anchors.right: parent.right - anchors.leftMargin: 20 - anchors.rightMargin: 10 - anchors.verticalCenter: parent.verticalCenter - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/TextEntry.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/TextEntry.qml deleted file mode 100644 index 774894c137..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/TextEntry.qml +++ /dev/null @@ -1,72 +0,0 @@ -import QtQuick 2.0 - -Item { - id: textentry - property alias input_border: search_text_box.border - property alias autocompleteModel: autocomplete.model - property alias text: search_text_box.text - signal selected - anchors.fill: parent - - TextBox { - id: search_text_box - icon: "../Assets/SearchIcon.png" - anchors.top: parent.top - width: parent.width - 160 - anchors.horizontalCenter: parent.horizontalCenter - - onTextChanged: if (autocomplete.model) autocomplete.model.setSearchString(text) - } - - BackButton { - anchors.top: search_text_box.top - anchors.topMargin: 1 - anchors.right: search_text_box.left - anchors.rightMargin: 10 - onPress: section.state = 'menu' - } - - ImageButton { - anchors.top: search_text_box.top - anchors.topMargin: 1 - icon: "../Assets/DeleteIcon.png" - anchors.left: search_text_box.right - anchors.leftMargin: 10 - height: 42 - - onPress: search_text_box.text = search_text_box.text.replace(/.$/, '') - } - - Keyboard { - anchors.left: parent.left - anchors.right: parent.right - anchors.topMargin: 40 - anchors.top: search_text_box.bottom - - onLetterClicked: search_text_box.text += letter - onGo: textentry.selected() - } - - ListView { - id: autocomplete - anchors.top: search_text_box.bottom - anchors.bottom: parent.bottom - anchors.right: search_text_box.right - anchors.left: search_text_box.left - clip: true - visible: (count > 0 && count <= 5) - - delegate: Button { - text: model.text - width: parent.width - textAnchors.horizontalCenter: undefined - textAnchors.left: clickable.left - textAnchors.leftMargin: 70 - - onPress: { - autocomplete.model.selected = model.text; - textentry.selected() - } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Weather.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Weather.qml deleted file mode 100644 index 0bcaf77205..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/Weather.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 2.0 - -Item { - property alias text: text.text - property alias temp: temp.text - property alias image: image.source - - width: 150 - height: 75 - - Text { - id: text - text: "Today" - anchors.top: parent.top - color: "#ffffff" - anchors.horizontalCenter: parent.horizontalCenter - } - - Text { - id: temp - text: "72" - font.pixelSize: 36 - anchors.bottom: parent.bottom - anchors.right: parent.right - color: "#ffffff" - } - - Image { - id: image - source: "../Assets/Cloud.png" - anchors.left: parent.left - anchors.bottom: parent.bottom - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/EmptyLayout.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/EmptyLayout.qml deleted file mode 100644 index 8fe6fcfd7c..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/EmptyLayout.qml +++ /dev/null @@ -1,16 +0,0 @@ -import QtQuick 2.0 -import "../Components" - -Item { - anchors.fill: parent - anchors.topMargin: 70 - anchors.leftMargin: 20 - anchors.rightMargin: 20 - anchors.bottomMargin: 70 - property bool back_button: false - - BackButton { - onPress: section.state = '' - visible: parent.back_button - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/LeftThirdSection.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/LeftThirdSection.qml deleted file mode 100644 index b0a7c2f6af..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/LeftThirdSection.qml +++ /dev/null @@ -1,16 +0,0 @@ -import QtQuick 2.0 -import "../Components" - -FocusScope { - anchors.fill: parent - property alias header: header.text - - Text { - id: header - font.pixelSize: 24 - color: "#ffffff" - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: 70 - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/MediaLayout.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/MediaLayout.qml deleted file mode 100644 index 767184de36..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/MediaLayout.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick 2.0 -import "../Components" - -FocusScope { - anchors.fill: parent - property alias header: header.text - property alias artwork: artwork.source - property alias title: title.text - property alias artist: artist.text - - Text { - id: title - text: "" - color: "#ffffff" - anchors.top: source_select.bottom - anchors.topMargin: 20 - font.pixelSize: 28 - anchors.left: parent.left - anchors.leftMargin: 20 - } - Text { - id: artist - text: "" - color: "#ffffff" - anchors.top: title.bottom - anchors.topMargin: 10 - font.pixelSize: 18 - anchors.left: title.left - } - - Text { - id: header - font.pixelSize: 24 - color: "#ffffff" - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: parent.height / 20 + 60 - } - - Button { - id: source_select - text: "Select source" - x: 20 - y: 75 - onPress: section.state = 'menu' - } - - Image { - id: artwork - anchors.right: parent.right - anchors.rightMargin: 40 - anchors.top: parent.top - width: 230 - height: 230 - anchors.topMargin: 140 - source: "" - } - -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/MediaPlayerLayout.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/MediaPlayerLayout.qml deleted file mode 100644 index 797815d058..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/MediaPlayerLayout.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 2.0 -import "../Components" - -MediaLayout { - - Row { - anchors.bottom: parent.bottom - anchors.bottomMargin: 100 - anchors.left: parent.left - anchors.leftMargin: 20 - spacing: 10 - - ImageButton { - icon: "../Assets/Rewind.png" - onPress: MediaPlayer.previous() - } - - ImageButton { - icon: "../Assets/Pause.png" - visible: MediaPlayer.playing - onPress: MediaPlayer.pause() - } - ImageButton { - icon: "../Assets/Play.png" - visible: ! MediaPlayer.playing - onPress: MediaPlayer.play() - } - ImageButton { - icon: "../Assets/Forward.png" - onPress: MediaPlayer.next() - } - - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/TitledLayout.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/TitledLayout.qml deleted file mode 100644 index 2ef47fa101..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Layouts/TitledLayout.qml +++ /dev/null @@ -1,14 +0,0 @@ -import QtQuick 2.0 -import "../Components" - -EmptyLayout { - property alias title: title.text - anchors.topMargin: 120 - - H1 { - id: title - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.top - anchors.bottomMargin: 10 - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/.usb.qml.swp b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/.usb.qml.swp Binary files differdeleted file mode 100644 index a88c240c3a..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/.usb.qml.swp +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/Browse/artists.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/Browse/artists.qml deleted file mode 100644 index af5804e72e..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/Browse/artists.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.0 - -Rectangle { - width: 100 - height: 62 -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/applink.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/applink.qml deleted file mode 100644 index 4f9d281964..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/applink.qml +++ /dev/null @@ -1,29 +0,0 @@ -import QtQuick 2.0 -import com.ford.sdlcore 1.0 -import "../../Components" -import "../../Layouts" - -MediaPlayerLayout { - header: "AppLink" - id: applink - - Column { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 20 - - Text { - id: title - text: AppLink.show1 - color: "#ffffff" - font.pixelSize: 28 - anchors.leftMargin: 20 - } - Text { - id: artist - text: AppLink.show2 - color: "#ffffff" - font.pixelSize: 18 - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/bluetooth.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/bluetooth.qml deleted file mode 100644 index 397b844698..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/bluetooth.qml +++ /dev/null @@ -1,13 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import "../../Layouts" - -MediaLayout { - header: "Bluetooth" - - Image { - source: "../../Assets/Content/SiriusArtwork.png" - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/fm.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/fm.qml deleted file mode 100644 index b5f3ad1c8c..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/fm.qml +++ /dev/null @@ -1,46 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import "../../Layouts" - -MediaLayout { - header: "FM" - - Flickable { - width: 700 - height: 50 - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.bottomMargin: 80 - contentHeight: height - contentWidth: row.width - clip: true - - RadioButtonGroup { - width: row.width - height: row.height - Row { - id: row - spacing: 8 - - RadioButton { - text: "Button" - } - RadioButton { - text: "Button" - } - RadioButton { - text: "Button" - } - RadioButton { - text: "Button" - } - RadioButton { - text: "Button" - } - RadioButton { - text: "Button" - } - } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/menu.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/menu.qml deleted file mode 100644 index d9d951ef3b..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/menu.qml +++ /dev/null @@ -1,54 +0,0 @@ -import QtQuick 2.0 -import com.ford.sdlcore 1.0 -import "../../Components" -import "../../Layouts" - -LeftThirdSection { - header: "Select a source" - - Grid { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - GraphicalButton { - text: "Radio" - image: "../../Assets/RadioIcon.png" - onPress: section.state = 'fm' - } - - GraphicalButton { - text: "Pandora" - image: "../../Assets/PandoraIcon.png" - onPress: section.state = 'fm' - } - - GraphicalButton { - text: "Sirius" - image: "../../Assets/SiriusIcon.png" - onPress: section.state = 'sirius' - } - - GraphicalButton { - text: "Bluetooth" - image: "../../Assets/BluetoothIcon.png" - onPress: section.state = 'bluetooth' - } - - GraphicalButton { - text: "USB" - image: "../../Assets/UsbIcon.png" - onPress: section.state = 'usb' - } - - Repeater { - model: MediaApps - - delegate: GraphicalButton { - text: modelData - image: "../../Assets/UsbIcon.png" - onPress: section.state = 'applink' - } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/sirius.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/sirius.qml deleted file mode 100644 index dfe9fc4d53..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/sirius.qml +++ /dev/null @@ -1,13 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import "../../Layouts" - -MediaLayout { - header: "Sirius" - - Image { - source: "../../Assets/Content/SiriusArtwork.png" - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/usb.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/usb.qml deleted file mode 100644 index 7236e98cbe..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Media/usb.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import "../../Layouts" - -MediaPlayerLayout { - header: "USB" - id: usb - - Button { - text: "Browse Media" - anchors.top: parent.top - anchors.right: parent.right - anchors.rightMargin: 40 - anchors.topMargin: 75 - - onPress: parent.state = 'browse' - } - - states: [ - State { - name: 'browse' - PropertyChanges { target: browse_interface; visible: true; opacity: 0.9 } - } - - ] - - Rectangle { - color: "#000000" - opacity: 0 - anchors.fill: parent - radius: 10 - visible: false - id: browse_interface - - BackButton { - id: back_button - anchors.topMargin: 80 - anchors.leftMargin: 20 - } - - - H2 { - id: header - text: "Browse Media" - anchors.topMargin: 80 - } - - Item { - anchors.fill: parent - id: browse_container - } - - Button { - anchors.top: back_button.bottom - anchors.left: parent.left - text: "Jump" - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/.menu.qml.swp b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/.menu.qml.swp Binary files differdeleted file mode 100644 index 183438e037..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/.menu.qml.swp +++ /dev/null diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/favorites.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/favorites.qml deleted file mode 100644 index db16b994b4..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/favorites.qml +++ /dev/null @@ -1,70 +0,0 @@ -import QtQuick 2.0 -import com.ford.navcore 1.0 -import "../../Components" -import "../../Layouts" - -Item { - BackButton { onPress: section.state = 'menu' } - NavController { - id: navController - } - - Flickable { - height: 300 - width: 400 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - clip: true - contentWidth: content.width - contentHeight: content.height - - Column { - id: content - width: parent.width - spacing: 10 - - Button { - text: "Barry Church's home" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Davison", "Victoria Sta", "3465"); - section.state = 'map'; - } - } - Button { - text: "Subway" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Dearborn Heights", "Pelham St", "3929"); - section.state = 'map'; - } - } - Button { - text: "Ford World Headquarters" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Dearborn", "American Rd", "1"); - section.state = 'map'; - } - } - Button { - text: "Qdoba" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Allen Park", "Fairlane Dr", "48101"); - section.state = 'map'; - } - } - Button { - text: "Levagood Park" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Dearborn", "Denwood St", "1100"); - section.state = 'map'; - } - } - - } - } -} - diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/keyboard_search.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/keyboard_search.qml deleted file mode 100644 index 011c761646..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/keyboard_search.qml +++ /dev/null @@ -1,64 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import "../../Layouts" - -Item { - anchors.fill: parent - id: keyboard_search - - states: [ - State { - name: 'city' - PropertyChanges {target: text_entry; autocompleteModel: citySuggestions} - }, - State { - name: 'street' - PropertyChanges {target: text_entry; autocompleteModel: streetSuggestions} - }, - State { - name: 'door' - PropertyChanges {target: text_entry; autocompleteModel: undefined} - }, - State { - name: 'review' - PropertyChanges {target: text_entry; visible: false} - PropertyChanges {target: review; visible: true} - } - ] - - Column { - id: review - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - width: 500 - - visible: false - Button { - text: stateSuggestions.selected - width: parent.width - onPress: keyboard_search.state = "" - } - Button { - text: citySuggestions.selected - width: parent.width - onPress: keyboard_search.state = "city" - } - Button { - text: streetSuggestions.selected - width: parent.width - onPress: keyboard_search.state = "city" - } - Button { - id: doornumber - width: parent.width - onPress: keyboard_search.state = "door" - } - Button { - text: "Begin navigation" - anchors.horizontalCenter: parent.horizontalCenter - onPress: { - section.state = 'map'; - } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/map.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/map.qml deleted file mode 100644 index 8b48efe780..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/map.qml +++ /dev/null @@ -1,63 +0,0 @@ -import QtQuick 2.0 -import "../../Components" - -Item { - Column { - anchors.left: parent.left; - anchors.verticalCenter: parent.verticalCenter - spacing: 10 - - Button { - text: "Zoom in" - } - - Button { - text: "Zoom out" - } - - Button { - text: "3D" - } - - Button { - text: "2D" - } - - Button { - text: "North up" - } - } - - Rectangle { - width: next_turn.width + 20 - height: 30 - anchors.top: parent.top - anchors.topMargin: 65 - anchors.horizontalCenter: parent.horizontalCenter - color: "black" - opacity: 0.6 - - } - - Rectangle { - width: current_street.width + 20 - height: 30 - anchors.bottom: parent.bottom - anchors.bottomMargin: 65 - anchors.horizontalCenter: parent.horizontalCenter - color: "black" - opacity: 0.6 - visible: navController.current_street.length > 0 - - } - - - Button { - text: "Go" - anchors.top: parent.top - anchors.topMargin: 3 - anchors.right: parent.right - anchors.rightMargin: 20 - onPress: section.state = 'menu' - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/menu.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/menu.qml deleted file mode 100644 index fdcae3f58e..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/menu.qml +++ /dev/null @@ -1,57 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import "../../Layouts" - -EmptyLayout { - back_button: true - - Grid { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - GraphicalButton { - text: "Home" - image: "../../Assets/HomeIcon.png" - onPress: { - section.state = 'map'; - } - } - GraphicalButton { - text: "Work" - image: "../../Assets/WorkIcon.png" - onPress: { - section.state = 'map'; - } - } - GraphicalButton { - text: "Recent Destination" - image: "../../Assets/RecentDestinationsIcon.png" - onPress: section.state = 'recent_destinations' - } - GraphicalButton { - text: "Keyboard" - image: "../../Assets/KeyboardIcon.png" - onPress: section.state = 'keyboard_search' - } - GraphicalButton { - text: "Favorites" - image: "../../Assets/FavoritesIcon.png" - onPress: section.state = 'favorites' - } - GraphicalButton { - text: "Point of Interest" - image: "../../Assets/PoiIcon.png" - onPress: section.state = 'poi' - } - GraphicalButton { - text: "Scout" - image: "../../Assets/ScoutIcon.png" - } - GraphicalButton { - text: "SYNC Services" - image: "../../Assets/ServicesIcon.png" - onPress: section.state = "video_moving_map" - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/poi.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/poi.qml deleted file mode 100644 index 0ecea8a113..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/poi.qml +++ /dev/null @@ -1,205 +0,0 @@ -import QtQuick 2.0 -import com.ford.navcore 1.0 -import "../../Components" -import "../../Layouts" - -EmptyLayout { - anchors.fill: parent - back_button: true - id: poi_search - - Component.onCompleted: state = "search_type" - - states: [ - State { - name: 'search_type' - PropertyChanges { - target: search_type - visible: true - } - }, - State { - name: 'categories' - PropertyChanges { - target: category_select - visible: true - } - }, - State { - name: 'select_state' - PropertyChanges { - target: text_entry - visible: true - } - }, - State { - name: 'results' - PropertyChanges { - target: results - visible: true - } - }, - State { - name: 'result' - PropertyChanges { - target: result - visible: true - } - } - ] - - NavController { - id: navController - } - - Grid { - id: search_type - property string type - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - visible: false - - GraphicalButton { - text: "Near me" - image: "../../Assets/HomeIcon.png" - onPress: { - search_type.type = "nearby" - poi_search.state = "categories" - } - } - - GraphicalButton { - text: "Along route" - image: "../../Assets/HomeIcon.png" - onPress: { - search_type.type = "route" - poi_search.state = "categories" - } - } - - GraphicalButton { - text: "In city" - image: "../../Assets/HomeIcon.png" - onPress: { - search_type.type = "city" - poi_search.state = "select_state" - } - } - } - - ListView { - id: category_select - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - height: parent.height - 120 - width: parent.width - spacing: 10 - clip: true - - GraphicalButton { - text: "Search by name" - image: "../../Assets/HomeIcon.png" - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 20 - } - - visible: false - model: NavPoiCategoryListModel { id: poi_categories } - - delegate: Button { - property int category_id: id - text: name - width: 400 - anchors.horizontalCenter: parent.horizontalCenter - onPress: { - navController.poiSearch(search_type.type, category_id, "USA", state_suggestions.getSelected(), city_suggestions.getSelected()); - poi_search.state = "results" - } - } - } - - ListView { - id: results - visible: false - anchors.topMargin: 80 - anchors.top: parent.top - anchors.bottomMargin: 80 - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - width: 400 - height: parent.height - 120 - spacing: 10 - clip: true - - model: NavPoiSuggestionListModel { - id: poi_suggestions - } - - delegate: Button { - text: name - width: parent.width - onPress: { - results.currentIndex = index - poi_search.state = "result" - } - } - } - - Item { - anchors.fill: parent - anchors.topMargin: 80 - anchors.bottomMargin: 80 - id: result - visible: false - - H1 { - id: poi_name - anchors.horizontalCenter: parent.horizontalCenter - text: (results.currentItem ? results.currentItem.text : "") - } - - Button { - text: "Begin navigation" - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: poi_name.bottom - onPress: { - poi_suggestions.navigateToResult(results.currentIndex); - section.state = 'map' - } - } - } - - TextEntry { - id: text_entry - anchors.topMargin: 80 - input_border.color: "#3C7855" - - states: [ - State { - name: "city_select" - PropertyChanges { - target: text_entry - autocompleteModel: city_suggestions - } - } - - ] - - NavStateSuggestionListModel { id: state_suggestions } - NavCitySuggestionListModel { id: city_suggestions; stateListModel: state_suggestions } - autocompleteModel: state_suggestions - visible: false - - onSelected: { - if (text_entry.state === '') { - text = ""; - text_entry.state = 'city_select'; - } - else { - poi_search.state = 'categories' - } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/recent_destinations.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/recent_destinations.qml deleted file mode 100644 index db16b994b4..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/recent_destinations.qml +++ /dev/null @@ -1,70 +0,0 @@ -import QtQuick 2.0 -import com.ford.navcore 1.0 -import "../../Components" -import "../../Layouts" - -Item { - BackButton { onPress: section.state = 'menu' } - NavController { - id: navController - } - - Flickable { - height: 300 - width: 400 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - clip: true - contentWidth: content.width - contentHeight: content.height - - Column { - id: content - width: parent.width - spacing: 10 - - Button { - text: "Barry Church's home" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Davison", "Victoria Sta", "3465"); - section.state = 'map'; - } - } - Button { - text: "Subway" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Dearborn Heights", "Pelham St", "3929"); - section.state = 'map'; - } - } - Button { - text: "Ford World Headquarters" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Dearborn", "American Rd", "1"); - section.state = 'map'; - } - } - Button { - text: "Qdoba" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Allen Park", "Fairlane Dr", "48101"); - section.state = 'map'; - } - } - Button { - text: "Levagood Park" - width: parent.width - onPress: { - navController.beginNavigation("USA", "MI", "Dearborn", "Denwood St", "1100"); - section.state = 'map'; - } - } - - } - } -} - diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/video_moving_map.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/video_moving_map.qml deleted file mode 100644 index 2f6b798d18..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Navigation/video_moving_map.qml +++ /dev/null @@ -1,20 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import QtMultimedia 5.0 - -Item { - Video { - anchors.fill: parent - source: "rtsp://172.20.10.7:8086" - autoPlay: true - } - - Button { - text: "Go" - anchors.top: parent.top - anchors.topMargin: 3 - anchors.right: parent.right - anchors.rightMargin: 20 - onPress: section.state = 'menu' - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/device_info.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/device_info.qml deleted file mode 100644 index 1f409f58e6..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/device_info.qml +++ /dev/null @@ -1,21 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import com.ford.phonecore 1.0 - -Item { - anchors.fill: parent - - H2 { - id: h2 - text: PhoneCore.device_name - - anchors.horizontalCenter: parent.horizontalCenter - } - Button { - text: "Forget device" - onPress: PhoneCore.unpairDevice() - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: h2.bottom - anchors.topMargin: 20 - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/discovery.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/discovery.qml deleted file mode 100644 index 5d7c51be6c..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/discovery.qml +++ /dev/null @@ -1,23 +0,0 @@ -import QtQuick 2.0 -import com.ford.phonecore 1.0 -import "../../Components" - -Item { - ListView { - anchors.horizontalCenter: parent.horizontalCenter - width: 300 - anchors.top: parent.top - anchors.bottom: parent.bottom - spacing: 10 - - delegate: Button { - text: name - width: parent.width - onPress: bluetooth_devices.createPairedDevice(mac) - } - - model: BluetoothDiscoveredDevices { - id: bluetooth_devices - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/keypad.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/keypad.qml deleted file mode 100644 index fd5ed4ff09..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/keypad.qml +++ /dev/null @@ -1,55 +0,0 @@ -import QtQuick 2.0 -import com.ford.phonecore 1.0 -import "../../Components" -import "../../Layouts" - -Item { - anchors.top: parent.top - anchors.topMargin: 80 - - TextBox { - id: phone_number - border.color: Qt.rgba(0.454901961,0.37254902,0.203921569,1) - anchors.top: parent.top - width: parent.width - 160 - anchors.horizontalCenter: parent.horizontalCenter - } - - BackButton { - anchors.top: phone_number.top - anchors.topMargin: 1 - anchors.right: phone_number.left - anchors.rightMargin: 10 - onPress: section.state = '' - } - - ImageButton { - anchors.top: phone_number.top - anchors.topMargin: 1 - icon: "../../Assets/DeleteIcon.png" - anchors.left: phone_number.right - anchors.leftMargin: 10 - height: 42 - - onPress: phone_number.text = phone_number.text.replace(/.$/, '') - } - - Keypad { - anchors.topMargin: 40 - anchors.top: phone_number.bottom - anchors.horizontalCenter: parent.horizontalCenter - - onLetterClicked: phone_number.text += letter - } - - Button { - text: "Call" - onPress: PhoneCore.dial(phone_number.text); - y: 100 - } - Button { - text: "End call" - onPress: PhoneCore.hangup(); - y: 160 - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/manage_devices.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/manage_devices.qml deleted file mode 100644 index cf62a9c287..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/manage_devices.qml +++ /dev/null @@ -1,16 +0,0 @@ -import QtQuick 2.0 -import com.ford.phonecore 1.0 -import "../../Components" -import "../../Layouts" - -TitledLayout { - title: "Manage Bluetooth devices" - back_button: true - - Loader { - id: view - - anchors.fill: parent - source: (PhoneCore.device_name === "") ? "discovery.qml" : "device_info.qml" - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/menu.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/menu.qml deleted file mode 100644 index 2d53656ba0..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/menu.qml +++ /dev/null @@ -1,54 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import "../../Layouts" - -LeftThirdSection { - Grid { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - GraphicalButton { - text: "Do Not Disturb" - image: "../../Assets/DndIcon.png" - } - - GraphicalButton { - text: "Phonebook" - image: "../../Assets/PhonebookIcon.png" - } - - GraphicalButton { - text: "Voicemail" - image: "../../Assets/VoicemailIcon.png" - } - - GraphicalButton { - text: "Messages" - image: "../../Assets/MessagesIcon.png" - } - - GraphicalButton { - text: "Recent Calls" - image: "../../Assets/RecentCallsIcon.png" - onPress: section.state = 'recent_calls' - } - - GraphicalButton { - text: "Keypad" - image: "../../Assets/KeypadIcon.png" - onPress: section.state = 'keypad' - } - - GraphicalButton { - text: "Speed Dial" - image: "../../Assets/SpeedDialIcon.png" - } - - GraphicalButton { - text: "Devices" - image: "../../Assets/SpeedDialIcon.png" - onPress: section.state = 'manage_devices' - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/recent_calls.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/recent_calls.qml deleted file mode 100644 index 1873ed4382..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Phone/recent_calls.qml +++ /dev/null @@ -1,62 +0,0 @@ -import QtQuick 2.0 -import com.ford.phonecore 1.0 -import "../../Components" -import "../../Layouts" - -TitledLayout { - title: "Recent calls" - Component.onCompleted: PhoneCore.hangup() - back_button: true - - Flickable { - height: 300 - width: 400 - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - clip: true - contentWidth: content.width - contentHeight: content.height - - Column { - id: content - width: parent.width - spacing: 10 - - Button { - text: "Chris Church: Mobile" - onPress: PhoneCore.dial("8106567195") - width: parent.width - } - Button { - text: "Barry Church: Mobile" - onPress: PhoneCore.dial("3134074522") - width: parent.width - } - Button { - text: "Barry Church: Work" - onPress: PhoneCore.dial("3134074522") - width: parent.width - } - Button { - text: "Aaron Church: Mobile" - onPress: PhoneCore.dial("3134074522") - width: parent.width - } - Button { - text: "Aaron Church: Mobile" - onPress: PhoneCore.dial("3134074522") - width: parent.width - } - Button { - text: "Aaron Church: Mobile" - onPress: PhoneCore.dial("3134074522") - width: parent.width - } - Button { - text: "Aaron Church: Mobile" - onPress: PhoneCore.dial("3134074522") - width: parent.width - } - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Vehicle/menu.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Vehicle/menu.qml deleted file mode 100644 index b95bc52da8..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/Vehicle/menu.qml +++ /dev/null @@ -1,60 +0,0 @@ -import QtQuick 2.0 -import "../../Components" -import "../../Layouts" - -LeftThirdSection { - MultiPointTouchArea { - anchors.fill: parent - } - - Grid { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - spacing: 10 - - GraphicalButton { - text: "HEV" - image: "../../Assets/EvIcon.png" - } - - GraphicalButton { - text: "Ambient Lighting" - image: "../../Assets/LightingIcon.png" - } - - GraphicalButton { - text: "Wallpaper" - image: "../../Assets/WallpaperIcon.png" - } - - GraphicalButton { - text: "Wi-Fi" - image: "../../Assets/WifiIcon.png" - } - - GraphicalButton { - text: "Health Report" - image: "../../Assets/VhrIcon.png" - } - - GraphicalButton { - text: "Seats" - image: "../../Assets/SeatsIcon.png" - } - - GraphicalButton { - text: "Keypad Entry" - image: "../../Assets/KeypadEntryIcon.png" - } - - GraphicalButton { - text: "Sync Services" - image: "../../Assets/ServicesIcon.png" - } - - GraphicalButton { - text: "Add Shortcut" - image: "../../Assets/AddIcon.png" - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml deleted file mode 100644 index f19539b9be..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/alert.qml +++ /dev/null @@ -1,68 +0,0 @@ -import QtQuick 2.0 - -Item { - property alias text: alert_text.text - id: alert_item - opacity: 0 - - transitions: Transition { - NumberAnimation { - properties: "opacity" - } - } - - function alert(message) { - text = message; - state = 'alerting'; - alert_timer.start(); - } - - states: [ - State { - name: 'alerting' - PropertyChanges { - target: alert_item - opacity: 1 - } - } - ] - - Timer { - id: alert_timer - running: false - interval: 4000 - onTriggered: alert_item.state = ''; - } - - - Rectangle { - id: background - anchors.fill: parent - color: "#000" - opacity: 0.8 - } - - Rectangle { - color: "#111" - width: 500 - height: alert_text.height + 40 - radius: 8 - border.color: "#666" - border.width: 2 - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - Text { - id: alert_text - text: "This is a really really long long really really long longreally really long longreally really long longreally really long long alert" - color: "#fff" - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 24 - width: parent.width - wrapMode: Text.WordWrap - } - } - -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/chrome.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/chrome.qml deleted file mode 100644 index b8f4f09d56..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/chrome.qml +++ /dev/null @@ -1,144 +0,0 @@ -import QtQuick 2.0 -import "../Components" - -Item { - id: container - anchors.fill: parent - - property int horizontalLabelMargin: 20 - - Image { - id: phonetab - source: "../Assets/PhoneTab.png" - anchors.top: parent.top - anchors.topMargin: (root.state === "phone") ? -height : 0 - Behavior on anchors.topMargin { PropertyAnimation {} } - width: parent.width / 2 - 145 - height: parent.height / 20 + 25 - - Clickable { - anchors.fill: parent - text: "Phone" - onPress: go("phone") - textAnchors.verticalCenter: verticalCenter - textAnchors.leftMargin: horizontalLabelMargin - textAnchors.left: left - } - } - Row { - anchors.right: phonetab.right - anchors.rightMargin: phonetab.width / 4 - anchors.top: parent.top - height: phonetab.height - spacing: 10 - - Image { - source: "../Assets/PhoneCornerIcons.png" - anchors.verticalCenter: parent.verticalCenter - } - } - - - Image { - source: "../Assets/NavigationTab.png" - anchors.right: parent.right - anchors.top: parent.top - anchors.topMargin: (root.state === "navigation") ? -height : 0 - Behavior on anchors.topMargin { PropertyAnimation {} } - width: parent.width / 2 - 145 - height: parent.height / 20 + 25 - - Clickable { - anchors.fill: parent - text: "Navigation" - onPress: go("navigation") - textAnchors.verticalCenter: verticalCenter - textAnchors.rightMargin: horizontalLabelMargin - textAnchors.right: right - } - } - - Image { - id: test1 - source: "../Assets/MediaTab.png" - anchors.bottom: parent.bottom - anchors.bottomMargin: (root.state === "media") ? -height : 0 - anchors.left: parent.left - Behavior on anchors.bottomMargin { PropertyAnimation {} } - width: parent.width / 2 - 145 - height: parent.height / 20 + 25 - - Clickable { - anchors.fill: parent - text: "Media" - onPress: go("media") - textAnchors.verticalCenter: verticalCenter - textAnchors.leftMargin: horizontalLabelMargin - textAnchors.left: left - } - } - - Image { - source: "../Assets/VehicleTab.png" - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.bottomMargin: (root.state === "vehicle") ? -height : 0 - Behavior on anchors.bottomMargin { PropertyAnimation {} } - width: parent.width / 2 - 145 - height: parent.height / 20 + 25 - - Clickable { - anchors.fill: parent - text: "Vehicle" - onPress: go("vehicle") - textAnchors.verticalCenter: verticalCenter - textAnchors.rightMargin: horizontalLabelMargin - textAnchors.right: right - } - } - - Image { - id: chrometop - source: "../Assets/ChromeTop.png" - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - height: parent.height / 18 + 35 - width: parent.width / 2 + 40 - fillMode: Image.PreserveAspectFit - Clickable { - onPress: go((root.state === 'home_corners') ? 'home' : 'home_corners') - width: parent.width / 5 - height: parent.height - anchors.left: parent.left - anchors.leftMargin: (parent.width - parent.paintedWidth)/2 + 20 - } - - Text { - id: clock - text: "12:00" - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: 10 - color: "#ffffff" - font.pixelSize: 28 - } - } - Image { - source: "../Assets/ChromeBottom.png" - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - height: parent.height / 18 + 35 - width: parent.width / 2 - fillMode: Image.PreserveAspectFit - - Text { - id: exterior_temp - text: "72F Outside" - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - color: "#ffffff" - anchors.bottomMargin: 15 - font.pixelSize: 18 - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/home.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/home.qml deleted file mode 100644 index c45f66782f..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/home.qml +++ /dev/null @@ -1,51 +0,0 @@ -import QtQuick 2.0 -import "../Components" -import "../Layouts" -import com.ford.phonecore 1.0 - -LeftThirdSection { - header: "Good Morning, Jen" - - Column { - anchors.left: parent.left - anchors.leftMargin: 60 - spacing: 40 - anchors.verticalCenter: parent.verticalCenter - - Weather {} - Weather { - text: "Tonight" - temp: "55" - image: "../Assets/CloudNight.png" - } - } - - - Image { - id: schedule - source: "../Assets/CMaxCal.png" - anchors.right: parent.right - anchors.rightMargin: 70 - anchors.verticalCenter: parent.verticalCenter - } - - Column { - anchors.right: schedule.left - anchors.rightMargin: 20 - anchors.top: schedule.top - anchors.topMargin: 5 - spacing: 40 - - Button { - text: "Dial" - } - Button { - text: "Navigate" - } - Button { - text: "Siri" - onPress: PhoneCore.siriEyesFree() - visible: PhoneCore.device_state === "connected" || PhoneCore.device_state === "playing" - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/home_corners.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/home_corners.qml deleted file mode 100644 index 432e978b87..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/home_corners.qml +++ /dev/null @@ -1,133 +0,0 @@ -import QtQuick 2.0 -import com.ford.phonecore 1.0 -import "../Components" -import "../Layouts" - -Item { - - Image { - source: "../Assets/Crosshairs.png" - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - } - - Item { - width: parent.width / 2 - height: parent.height / 2 - - Image { - id: phone_corner_icon - visible: (PhoneCore.device_state === "connected") - source: "../Assets/PhoneIcons.png" - anchors.top: parent.top - anchors.topMargin: 80 - anchors.horizontalCenter: parent.horizontalCenter - } - - OverflowableText { - id: phone_name - text: PhoneCore.device_name - anchors.top: phone_corner_icon.bottom - anchors.horizontalCenter: parent.horizontalCenter - textAlign: 'center' - anchors.topMargin: 10 - width: 350 - fontColor: (PhoneCore.device_state === "connected") ? "#ffffff" : "#333" - font.pixelSize: 24 - } - - Text { - text: "Connecting..." - anchors.top: phone_name.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.topMargin: 10 - color: "#333" - visible: (PhoneCore.device_state === "connecting") - font.pixelSize: 24 - } - - CheckButton { - text: "Do Not Disturb" - visible: (PhoneCore.device_state === "connected") - anchors.top: phone_name.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.topMargin: 10 - } - - - - Row { - anchors.top: phone_name.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.topMargin: 10 - visible: (PhoneCore.device_state === "disconnected") - spacing: 10 - - Button { - text: "Connect" - onPress: { - PhoneCore.initializeDevice() - } - } - - Button { - text: "Manage Phones" - onPress: { - go("phone"); - } - } - } - - } - - Item { - width: parent.width / 2 - height: parent.height / 2 - anchors.right: parent.right - } - - Item { - width: parent.width / 2 - height: parent.height / 2 - anchors.right: parent.right - anchors.bottom: parent.bottom - - Image { - source: "../Assets/VehicleCornerIcon.png" - anchors.horizontalCenter: parent.horizontalCenter - } - } - - Item { - width: parent.width / 2 - height: parent.height / 2 - anchors.bottom: parent.bottom - - Image { - id: media_corner_icon - source: "../Assets/UsbIcon.png" - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: 40 - } - - Text { - id: media_artist - text: "" - font.pixelSize: 18 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: media_corner_icon.bottom - color: "#ffffff" - anchors.topMargin: 10 - } - - Text { - id: media_title - text: "" - font.pixelSize: 24 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: media_artist.bottom - color: "#ffffff" - } - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/media.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/media.qml deleted file mode 100644 index af33ddaffd..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/media.qml +++ /dev/null @@ -1,55 +0,0 @@ -import QtQuick 2.0 -import "../Components" -import "../Layouts" - -Rectangle { - anchors.fill: parent - id: section - - gradient: Gradient { - GradientStop { position: 0.8; color: "#000000" } - GradientStop { position: 1.0; color: "#7C3232" } - } - - states: [ - State { - name: 'menu' - PropertyChanges { target: page; source: "Media/menu.qml" } - }, - State { - name: 'fm' - PropertyChanges { target: page; source: "Media/fm.qml" } - }, - State { - name: 'sirius' - PropertyChanges { target: page; source: "Media/sirius.qml" } - }, - State { - name: 'usb' - PropertyChanges { target: page; source: "Media/usb.qml" } - }, - State { - name: 'bluetooth' - PropertyChanges { target: page; source: "Media/bluetooth.qml" } - }, - State { - name: 'applink' - PropertyChanges { target: page; source: "Media/applink.qml" } - } - ] - - transitions: [ - Transition { - to: "bluetooth" - }, - Transition { - to: "usb" - } - - ] - - Section { - id: page - source: "Media/usb.qml" - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/navigation.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/navigation.qml deleted file mode 100644 index e26326b458..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/navigation.qml +++ /dev/null @@ -1,49 +0,0 @@ -import QtQuick 2.0 -import "../Components" -import "../Layouts" - -Rectangle { - id: section - anchors.fill: parent - - gradient: Gradient { - GradientStop { position: 0.0; color: "#3C7855" } - GradientStop { position: 0.4; color: "#000000" } - } - - Section { - id: page - source: "Navigation/map.qml" - } - - states: [ - State { - name: '' - PropertyChanges { target: page; source: "Navigation/map.qml" } - }, - State { - name: 'menu' - PropertyChanges { target: page; source: "Navigation/menu.qml" } - }, - State { - name: 'keyboard_search' - PropertyChanges { target: page; source: "Navigation/keyboard_search.qml" } - }, - State { - name: 'favorites' - PropertyChanges { target: page; source: "Navigation/favorites.qml" } - }, - State { - name: 'recent_destinations' - PropertyChanges { target: page; source: "Navigation/recent_destinations.qml" } - }, - State { - name: 'poi' - PropertyChanges { target: page; source: "Navigation/poi.qml" } - }, - State { - name: 'video_moving_map' - PropertyChanges { target: page; source: "Navigation/video_moving_map.qml" } - } - ] -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/phone.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/phone.qml deleted file mode 100644 index 8c2987f2f9..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/phone.qml +++ /dev/null @@ -1,37 +0,0 @@ -import QtQuick 2.0 -import "../Components" -import "../Layouts" - -Rectangle { - id: section - anchors.fill: parent - - states: [ - State { - name: '' - PropertyChanges { target: page; source: "Phone/menu.qml" } - }, - State { - name: 'recent_calls' - PropertyChanges { target: page; source: "Phone/recent_calls.qml" } - }, - State { - name: 'keypad' - PropertyChanges { target: page; source: "Phone/keypad.qml" } - }, - State { - name: 'manage_devices' - PropertyChanges { target: page; source: "Phone/manage_devices.qml" } - } - ] - - gradient: Gradient { - GradientStop { position: 0.0; color: Qt.rgba(0.454901961,0.37254902,0.203921569,1) } - GradientStop { position: 0.4; color: "#000000" } - } - - Section { - id: page - source: "Phone/menu.qml" - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/vehicle.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/vehicle.qml deleted file mode 100644 index 9687e7c463..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Sections/vehicle.qml +++ /dev/null @@ -1,17 +0,0 @@ -import QtQuick 2.0 -import "../Components" -import "../Layouts" - -Rectangle { - anchors.fill: parent - - gradient: Gradient { - GradientStop { position: 0.4; color: "#000000" } - GradientStop { position: 1.0; color: "#104369" } - } - - Section { - id: section - source: "Vehicle/menu.qml" - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/main.qml b/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/main.qml deleted file mode 100644 index c6f0b0e769..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/main.qml +++ /dev/null @@ -1,79 +0,0 @@ -import QtQuick 2.0 -import "Components" -import com.ford.sdlcore 1.0 -import com.ford.phonecore 1.0 - -Rectangle { - id: root - width: 800 - height: 470 - color: "#000" - - states: [ - State { - name: "home" - PropertyChanges { target: maincontent; source: "Sections/home.qml" } - }, - State { - name: "home_corners" - PropertyChanges { target: maincontent; source: "Sections/home_corners.qml" } - }, - State { - name: "phone" - PropertyChanges { target: maincontent; source: "Sections/phone.qml" } - }, - State { - name: "navigation" - PropertyChanges { target: maincontent; source: "Sections/navigation.qml" } - }, - State { - name: "media" - PropertyChanges { target: maincontent; source: "Sections/media.qml" } - }, - State { - name: "vehicle" - PropertyChanges { target: maincontent; source: "Sections/vehicle.qml" } - } - ] - - transitions: [ - Transition { - to: '*' - PropertyAnimation { target: maincontent; property: 'opacity'; from: 0; to: 1} - } - ] - - function go(string) { - state = string - } - - Connections { - target: AppLink - onAlert: root.alert(message); - } - - Connections { - target: PhoneCore - onCallAdded: root.alert("Incoming call: \n" + name + "\n" + number) - onCallRemoved: root.alert("Call ended") - } - - function alert(message) { - alert_loader.item.alert(message) - } - - Section { - id: maincontent - source: "Sections/home.qml" - } - - Section { - id: alert_loader - source: "Sections/alert.qml" - } - - Section { - id: chrome - source: "Sections/chrome.qml" - } -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qtquick2applicationviewer/qtquick2applicationviewer.cpp b/src/components/qt_hmi/References/Work/bananasnacks/qtquick2applicationviewer/qtquick2applicationviewer.cpp deleted file mode 100644 index 8fcc4a6d38..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qtquick2applicationviewer/qtquick2applicationviewer.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// checksum 0x56a9 version 0x80001 -/* - This file was generated by the Qt Quick 2 Application wizard of Qt Creator. - QtQuick2ApplicationViewer is a convenience class containing mobile device - specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. -*/ - -#include "qtquick2applicationviewer.h" - -#include <QtCore/QCoreApplication> -#include <QtCore/QDir> -#include <QtQml/QQmlEngine> - -class QtQuick2ApplicationViewerPrivate { - QString mainQmlFile; - friend class QtQuick2ApplicationViewer; - static QString adjustPath(const QString& path); -}; - -QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString& path) { -#if defined(Q_OS_MAC) - if (!QDir::isAbsolutePath(path)) - return QString::fromLatin1("%1/../Resources/%2") - .arg(QCoreApplication::applicationDirPath(), path); -#elif defined(Q_OS_UNIX) - const QString pathInInstallDir = - QString::fromLatin1("%1/../%2") - .arg(QCoreApplication::applicationDirPath(), path); - if (QFileInfo(pathInInstallDir).exists()) - return pathInInstallDir; -#endif - return path; -} - -QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow* parent) - : QQuickView(parent), d(new QtQuick2ApplicationViewerPrivate()) { - connect(engine(), SIGNAL(quit()), SLOT(close())); - setResizeMode(QQuickView::SizeRootObjectToView); -} - -QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer() { - delete d; -} - -void QtQuick2ApplicationViewer::setMainQmlFile(const QString& file) { - d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file); - setSource(QUrl::fromLocalFile(d->mainQmlFile)); -} - -void QtQuick2ApplicationViewer::addImportPath(const QString& path) { - engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path)); -} - -void QtQuick2ApplicationViewer::showExpanded() { -#if defined(Q_WS_SIMULATOR) - showFullScreen(); -#else - show(); -#endif -} diff --git a/src/components/qt_hmi/References/Work/bananasnacks/qtquick2applicationviewer/qtquick2applicationviewer.h b/src/components/qt_hmi/References/Work/bananasnacks/qtquick2applicationviewer/qtquick2applicationviewer.h deleted file mode 100644 index 42287e8d79..0000000000 --- a/src/components/qt_hmi/References/Work/bananasnacks/qtquick2applicationviewer/qtquick2applicationviewer.h +++ /dev/null @@ -1,33 +0,0 @@ -// checksum 0xfde6 version 0x80001 -/* - This file was generated by the Qt Quick 2 Application wizard of Qt Creator. - QtQuick2ApplicationViewer is a convenience class containing mobile device - specific - code such as screen orientation handling. Also QML paths and debugging are - handled here. - It is recommended not to modify this file, since newer versions of Qt Creator - may offer an updated version of it. - */ - -#ifndef QTQUICK2APPLICATIONVIEWER_H -#define QTQUICK2APPLICATIONVIEWER_H - -#include <QtQuick/QQuickView> - -class QtQuick2ApplicationViewer : public QQuickView { - Q_OBJECT - - public: - explicit QtQuick2ApplicationViewer(QWindow* parent = 0); - virtual ~QtQuick2ApplicationViewer(); - - void setMainQmlFile(const QString& file); - void addImportPath(const QString& path); - - void showExpanded(); - - private: - class QtQuick2ApplicationViewerPrivate* d; -}; - -#endif // QTQUICK2APPLICATIONVIEWER_H diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/FordSdlCore.pro b/src/components/qt_hmi/References/Work/fordsdlcore/FordSdlCore.pro deleted file mode 100644 index ea541b24ce..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/FordSdlCore.pro +++ /dev/null @@ -1,48 +0,0 @@ -TEMPLATE = lib -TARGET = FordSdlCore -QT += qml quick -CONFIG += qt plugin - -TARGET = $$qtLibraryTarget($$TARGET) -uri = com.ford.sdlcore - -# Input -SOURCES += \ - fordsdlcore_plugin.cpp \ - smartdevicelink.cpp \ - sdlalert.cpp \ - QtWebsocket/QWsSocket.cpp \ - QtWebsocket/QWsServer.cpp \ - sdlappslistmodel.cpp - -HEADERS += \ - fordsdlcore_plugin.h \ - smartdevicelink.h \ - sdlalert.h \ - QtWebsocket/QWsSocket.h \ - QtWebsocket/QWsServer.h \ - sdlappslistmodel.h - -OTHER_FILES = qmldir - -!equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target -} - -qmldir.files = qmldir -unix { - installPath = ../BananaSnacks/plugins/com/ford/sdlcore - qmldir.path = $$installPath - target.path = $$installPath - INSTALLS += target qmldir -} - -linux-g++* { - QMAKE_CXXFLAGS += -m32 - QMAKE_LFLAGS += -m32 -} -QMAKE_LIBDIR += /usr/lib/i386-linux-gnu/mesa diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsServer.cpp b/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsServer.cpp deleted file mode 100644 index 9c4eed8cc1..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsServer.cpp +++ /dev/null @@ -1,456 +0,0 @@ -#include "QWsServer.h" - -#include <QRegExp> -#include <QStringList> -#include <QByteArray> -#include <QCryptographicHash> -#include <QDateTime> - -const QString QWsServer::regExpResourceNameStr( - QLatin1String("^GET\\s(.*)\\sHTTP/1.1\r\n")); -const QString QWsServer::regExpHostStr( - QLatin1String("\r\nHost:\\s(.+(:\\d+)?)\r\n")); -const QString QWsServer::regExpKeyStr( - QLatin1String("\r\nSec-WebSocket-Key:\\s(.{24})\r\n")); -const QString QWsServer::regExpKey1Str( - QLatin1String("\r\nSec-WebSocket-Key1:\\s(.+)\r\n")); -const QString QWsServer::regExpKey2Str( - QLatin1String("\r\nSec-WebSocket-Key2:\\s(.+)\r\n")); -const QString QWsServer::regExpKey3Str(QLatin1String("\r\n(.{8})$")); -const QString QWsServer::regExpVersionStr( - QLatin1String("\r\nSec-WebSocket-Version:\\s(\\d+)\r\n")); -const QString QWsServer::regExpOriginStr( - QLatin1String("\r\nSec-WebSocket-Origin:\\s(.+)\r\n")); -const QString QWsServer::regExpOrigin2Str( - QLatin1String("\r\nOrigin:\\s(.+)\r\n")); -const QString QWsServer::regExpProtocolStr( - QLatin1String("\r\nSec-WebSocket-Protocol:\\s(.+)\r\n")); -const QString QWsServer::regExpExtensionsStr( - QLatin1String("\r\nSec-WebSocket-Extensions:\\s(.+)\r\n")); - -QWsServer::QWsServer(QObject* parent) : QObject(parent) { - tcpServer = new QTcpServer(this); - connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newTcpConnection())); - qsrand(QDateTime::currentMSecsSinceEpoch()); -} - -QWsServer::~QWsServer() { - tcpServer->deleteLater(); -} - -bool QWsServer::listen(const QHostAddress& address, quint16 port) { - return tcpServer->listen(address, port); -} - -void QWsServer::close() { - tcpServer->close(); -} - -QAbstractSocket::SocketError QWsServer::serverError() { - return tcpServer->serverError(); -} - -QString QWsServer::errorString() { - return tcpServer->errorString(); -} - -void QWsServer::newTcpConnection() { - QTcpSocket* tcpSocket = tcpServer->nextPendingConnection(); - connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(dataReceived())); - headerBuffer.insert(tcpSocket, QStringList()); -} - -void QWsServer::closeTcpConnection() { - QTcpSocket* tcpSocket = qobject_cast<QTcpSocket*>(sender()); - if (tcpSocket == 0) - return; - - tcpSocket->close(); -} - -void QWsServer::dataReceived() { - QTcpSocket* tcpSocket = qobject_cast<QTcpSocket*>(sender()); - if (tcpSocket == 0) - return; - - bool allHeadersFetched = false; - - const QLatin1String emptyLine("\r\n"); - - while (tcpSocket->canReadLine()) { - QString line = tcpSocket->readLine(); - - if (line == emptyLine) { - allHeadersFetched = true; - break; - } - - headerBuffer[tcpSocket].append(line); - } - - if (!allHeadersFetched) - return; - - QString request(headerBuffer[tcpSocket].join("")); - - QRegExp regExp; - regExp.setMinimal(true); - - // Extract mandatory datas - // Version - regExp.setPattern(QWsServer::regExpVersionStr); - regExp.indexIn(request); - QString versionStr = regExp.cap(1); - EWebsocketVersion version; - if (!versionStr.isEmpty()) { - version = (EWebsocketVersion)versionStr.toInt(); - } else if (tcpSocket->bytesAvailable() >= 8) { - version = WS_V0; - request.append(tcpSocket->read(8)); - } else { - version = WS_VUnknow; - } - - // Resource name - regExp.setPattern(QWsServer::regExpResourceNameStr); - regExp.indexIn(request); - QString resourceName = regExp.cap(1); - - // Host (address & port) - regExp.setPattern(QWsServer::regExpHostStr); - regExp.indexIn(request); - QString host = regExp.cap(1); - QStringList hostTmp = host.split(':'); - QString hostAddress = hostTmp[0]; - QString hostPort; - if (hostTmp.size() > 1) - hostPort = hostTmp.last(); // fix for IPv6 - - // Key - QString key, key1, key2, key3; - if (version >= WS_V4) { - regExp.setPattern(QWsServer::regExpKeyStr); - regExp.indexIn(request); - key = regExp.cap(1); - } else { - regExp.setPattern(QWsServer::regExpKey1Str); - regExp.indexIn(request); - key1 = regExp.cap(1); - regExp.setPattern(QWsServer::regExpKey2Str); - regExp.indexIn(request); - key2 = regExp.cap(1); - regExp.setPattern(QWsServer::regExpKey3Str); - regExp.indexIn(request); - key3 = regExp.cap(1); - } - - //////////////////////////////////////////////////////////////////// - - // If the mandatory fields are not specified, we abord the connection to the - // Websocket server - if (version == WS_VUnknow || resourceName.isEmpty() || - hostAddress.isEmpty() || - (key.isEmpty() && (key1.isEmpty() || key2.isEmpty() || key3.isEmpty()))) { - // Send bad request response - QString response = QWsServer::composeBadRequestResponse( - QList<EWebsocketVersion>() << WS_V6 << WS_V7 << WS_V8 << WS_V13); - tcpSocket->write(response.toUtf8()); - tcpSocket->flush(); - return; - } - - //////////////////////////////////////////////////////////////////// - - // Extract optional datas - - // Origin - regExp.setPattern(QWsServer::regExpOriginStr); - if (regExp.indexIn(request) == -1) { - regExp.setPattern(QWsServer::regExpOrigin2Str); - regExp.indexIn(request); - } - QString origin = regExp.cap(1); - - // Protocol - regExp.setPattern(QWsServer::regExpProtocolStr); - regExp.indexIn(request); - QString protocol = regExp.cap(1); - - // Extensions - regExp.setPattern(QWsServer::regExpExtensionsStr); - regExp.indexIn(request); - QString extensions = regExp.cap(1); - - //////////////////////////////////////////////////////////////////// - - // Compose opening handshake response - QString response; - - if (version >= WS_V6) { - QString accept = computeAcceptV4(key); - response = QWsServer::composeOpeningHandshakeResponseV6(accept, protocol); - } else if (version >= WS_V4) { - QString accept = computeAcceptV4(key); - QString nonce = generateNonce(); - response = - QWsServer::composeOpeningHandshakeResponseV4(accept, nonce, protocol); - } else { - QString accept = computeAcceptV0(key1, key2, key3); - response = QWsServer::composeOpeningHandshakeResponseV0( - accept, origin, hostAddress, hostPort, resourceName, protocol); - } - - // Handshake OK, disconnect readyRead - disconnect(tcpSocket, SIGNAL(readyRead()), this, SLOT(dataReceived())); - - // Send opening handshake response - if (version == WS_V0) - tcpSocket->write(response.toLatin1()); - else - tcpSocket->write(response.toUtf8()); - tcpSocket->flush(); - - QWsSocket* wsSocket = new QWsSocket(this, tcpSocket, version); - wsSocket->setResourceName(resourceName); - wsSocket->setHost(host); - wsSocket->setHostAddress(hostAddress); - wsSocket->setHostPort(hostPort.toInt()); - wsSocket->setOrigin(origin); - wsSocket->setProtocol(protocol); - wsSocket->setExtensions(extensions); - wsSocket->serverSideSocket = true; - - // ORIGINAL CODE - // int socketDescriptor = tcpSocket->socketDescriptor(); - // incomingConnection( socketDescriptor ); - - // CHANGED CODE FOR LINUX COMPATIBILITY - addPendingConnection(wsSocket); - emit newConnection(); -} - -void QWsServer::incomingConnection(int socketDescriptor) { - QTcpSocket* tcpSocket = new QTcpSocket(tcpServer); - tcpSocket->setSocketDescriptor(socketDescriptor, - QAbstractSocket::ConnectedState); - QWsSocket* wsSocket = new QWsSocket(this, tcpSocket); - - addPendingConnection(wsSocket); - emit newConnection(); -} - -void QWsServer::addPendingConnection(QWsSocket* socket) { - if (pendingConnections.size() < maxPendingConnections()) - pendingConnections.enqueue(socket); -} - -QWsSocket* QWsServer::nextPendingConnection() { - return pendingConnections.dequeue(); -} - -bool QWsServer::hasPendingConnections() { - if (pendingConnections.size() > 0) - return true; - return false; -} - -int QWsServer::maxPendingConnections() { - return tcpServer->maxPendingConnections(); -} - -bool QWsServer::isListening() { - return tcpServer->isListening(); -} - -QNetworkProxy QWsServer::proxy() { - return tcpServer->proxy(); -} - -QHostAddress QWsServer::serverAddress() { - return tcpServer->serverAddress(); -} - -quint16 QWsServer::serverPort() { - return tcpServer->serverPort(); -} - -void QWsServer::setMaxPendingConnections(int numConnections) { - tcpServer->setMaxPendingConnections(numConnections); -} - -void QWsServer::setProxy(const QNetworkProxy& networkProxy) { - tcpServer->setProxy(networkProxy); -} - -bool QWsServer::setSocketDescriptor(int socketDescriptor) { - return tcpServer->setSocketDescriptor(socketDescriptor); -} - -int QWsServer::socketDescriptor() { - return tcpServer->socketDescriptor(); -} - -bool QWsServer::waitForNewConnection(int msec, bool* timedOut) { - return tcpServer->waitForNewConnection(msec, timedOut); -} - -QString QWsServer::computeAcceptV0(QString key1, QString key2, QString key3) { - QString numStr1; - QString numStr2; - - QChar carac; - for (int i = 0; i < key1.size(); i++) { - carac = key1[i]; - if (carac.isDigit()) - numStr1.append(carac); - } - for (int i = 0; i < key2.size(); i++) { - carac = key2[i]; - if (carac.isDigit()) - numStr2.append(carac); - } - - quint32 num1 = numStr1.toUInt(); - quint32 num2 = numStr2.toUInt(); - - int numSpaces1 = key1.count(' '); - int numSpaces2 = key2.count(' '); - - num1 /= numSpaces1; - num2 /= numSpaces2; - - QString concat = serializeInt(num1) + serializeInt(num2) + key3; - - QByteArray md5 = - QCryptographicHash::hash(concat.toLatin1(), QCryptographicHash::Md5); - - return QString(md5); -} - -QString QWsServer::computeAcceptV4(QString key) { - key += QLatin1String("258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - QByteArray hash = - QCryptographicHash::hash(key.toUtf8(), QCryptographicHash::Sha1); - return hash.toBase64(); -} - -QString QWsServer::generateNonce() { - qsrand(QDateTime::currentDateTime().toTime_t()); - - QByteArray nonce; - int i = 16; - - while (i--) { - nonce.append(qrand() % 0x100); - } - - return QString(nonce.toBase64()); -} - -QByteArray QWsServer::serializeInt(quint32 number, quint8 nbBytes) { - QByteArray ba; - quint8 currentNbBytes = 0; - while (number > 0 && currentNbBytes < nbBytes) { - char car = static_cast<char>(number & 0xFF); - ba.prepend(car); - number = number >> 8; - currentNbBytes++; - } - char car = 0x00; - while (currentNbBytes < nbBytes) { - ba.prepend(car); - currentNbBytes++; - } - return ba; -} - -QString QWsServer::composeOpeningHandshakeResponseV0(QString accept, - QString origin, - QString hostAddress, - QString hostPort, - QString resourceName, - QString protocol) { - QString response; - - response.append( - QLatin1String("HTTP/1.1 101 WebSocket Protocol Handshake\r\n")); - response.append(QLatin1String("Upgrade: Websocket\r\n")); - response.append(QLatin1String("Connection: Upgrade\r\n")); - response.append(QLatin1String("Sec-WebSocket-Origin: ") + origin + - QLatin1String("\r\n")); - response.append(QLatin1String("Sec-WebSocket-Location: ws://") + hostAddress); - if (!hostPort.isEmpty()) - response.append(QLatin1String(":") + hostPort); - response.append(resourceName + QLatin1String("\r\n")); - if (!protocol.isEmpty()) - response.append(QLatin1String("Sec-WebSocket-Protocol: ") + protocol + - QLatin1String("\r\n")); - response.append(QLatin1String("\r\n")); - response.append(accept); - - return response; -} - -QString QWsServer::composeOpeningHandshakeResponseV4(QString accept, - QString nonce, - QString protocol, - QString extensions) { - QString response; - - response.append(QLatin1String("HTTP/1.1 101 Switching Protocols\r\n")); - response.append(QLatin1String("Upgrade: websocket\r\n")); - response.append(QLatin1String("Connection: Upgrade\r\n")); - response.append(QLatin1String("Sec-WebSocket-Accept: ") + accept + - QLatin1String("\r\n")); - response.append(QLatin1String("Sec-WebSocket-Nonce: ") + nonce + - QLatin1String("\r\n")); - if (!protocol.isEmpty()) - response.append(QLatin1String("Sec-WebSocket-Protocol: ") + protocol + - QLatin1String("\r\n")); - if (!extensions.isEmpty()) - response.append(QLatin1String("Sec-WebSocket-Extensions: ") + extensions + - QLatin1String("\r\n")); - response.append(QLatin1String("\r\n")); - - return response; -} - -QString QWsServer::composeOpeningHandshakeResponseV6(QString accept, - QString protocol, - QString extensions) { - QString response; - - response.append(QLatin1String("HTTP/1.1 101 Switching Protocols\r\n")); - response.append(QLatin1String("Upgrade: websocket\r\n")); - response.append(QLatin1String("Connection: Upgrade\r\n")); - response.append(QLatin1String("Sec-WebSocket-Accept: ") + accept + - QLatin1String("\r\n")); - if (!protocol.isEmpty()) - response.append(QLatin1String("Sec-WebSocket-Protocol: ") + protocol + - QLatin1String("\r\n")); - if (!extensions.isEmpty()) - response.append(QLatin1String("Sec-WebSocket-Extensions: ") + extensions + - QLatin1String("\r\n")); - response.append(QLatin1String("\r\n")); - - return response; -} - -QString QWsServer::composeBadRequestResponse( - QList<EWebsocketVersion> versions) { - QString response; - - response.append(QLatin1String("HTTP/1.1 400 Bad Request\r\n")); - if (!versions.isEmpty()) { - QString versionsStr = QString::number((int)versions.takeLast()); - int i = versions.size(); - while (i--) { - versionsStr.append(QLatin1String(", ") + - QString::number((int)versions.takeLast())); - } - response.append(QLatin1String("Sec-WebSocket-Version: ") + versionsStr + - QLatin1String("\r\n")); - } - - return response; -} diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsServer.h b/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsServer.h deleted file mode 100644 index f37dd4b5b2..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsServer.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef QWSSERVER_H -#define QWSSERVER_H - -#include <QTcpServer> -#include <QTcpSocket> -#include <QNetworkProxy> -#include <QString> -#include <QStringList> -#include <QMap> -#include <QQueue> - -#include "QWsSocket.h" - -class QWsServer : public QObject { - Q_OBJECT - - public: - // ctor - QWsServer(QObject* parent = 0); - // dtor - virtual ~QWsServer(); - - // public functions - void close(); - QString errorString(); - bool hasPendingConnections(); - bool isListening(); - bool listen(const QHostAddress& address = QHostAddress::Any, - quint16 port = 0); - int maxPendingConnections(); - virtual QWsSocket* nextPendingConnection(); - QNetworkProxy proxy(); - QHostAddress serverAddress(); - QAbstractSocket::SocketError serverError(); - quint16 serverPort(); - void setMaxPendingConnections(int numConnections); - void setProxy(const QNetworkProxy& networkProxy); - bool setSocketDescriptor(int socketDescriptor); - int socketDescriptor(); - bool waitForNewConnection(int msec = 0, bool* timedOut = 0); - -signals: - void newConnection(); - - protected: - // protected functions - void addPendingConnection(QWsSocket* socket); - virtual void incomingConnection(int socketDescriptor); - - private slots: - // private slots - void newTcpConnection(); - void closeTcpConnection(); - void dataReceived(); - - private: - // private attributes - QTcpServer* tcpServer; - QQueue<QWsSocket*> pendingConnections; - QMap<const QTcpSocket*, QStringList> headerBuffer; - - public: - // public static functions - static QByteArray serializeInt(quint32 number, quint8 nbBytes = 4); - static QString computeAcceptV0(QString key1, QString key2, QString thirdPart); - static QString computeAcceptV4(QString key); - static QString generateNonce(); - static QString composeOpeningHandshakeResponseV0(QString accept, - QString origin, - QString hostAddress, - QString hostPort, - QString resourceName, - QString protocol = ""); - static QString composeOpeningHandshakeResponseV4(QString accept, - QString nonce, - QString protocol = "", - QString extensions = ""); - static QString composeOpeningHandshakeResponseV6(QString accept, - QString protocol = "", - QString extensions = ""); - static QString composeBadRequestResponse( - QList<EWebsocketVersion> versions = QList<EWebsocketVersion>()); - - // public static vars - static const QString regExpResourceNameStr; - static const QString regExpHostStr; - static const QString regExpKeyStr; - static const QString regExpKey1Str; - static const QString regExpKey2Str; - static const QString regExpKey3Str; - static const QString regExpVersionStr; - static const QString regExpOriginStr; - static const QString regExpOrigin2Str; - static const QString regExpProtocolStr; - static const QString regExpExtensionsStr; -}; - -#endif // QWSSERVER_H diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsSocket.cpp b/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsSocket.cpp deleted file mode 100644 index 428f559517..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsSocket.cpp +++ /dev/null @@ -1,749 +0,0 @@ -#include "QWsSocket.h" - -#include <QCryptographicHash> -#include <QtEndian> - -#include "QWsServer.h" - -int QWsSocket::maxBytesPerFrame = 1400; -const QString QWsSocket::regExpAcceptStr( - QLatin1String("Sec-WebSocket-Accept:\\s(.{28})\r\n")); -const QString QWsSocket::regExpUpgradeStr(QLatin1String("Upgrade:\\s(.+)\r\n")); -const QString QWsSocket::regExpConnectionStr( - QLatin1String("Connection:\\s(.+)\r\n")); - -QWsSocket::QWsSocket(QObject* parent, - QTcpSocket* socket, - EWebsocketVersion ws_v) - : QAbstractSocket(QAbstractSocket::UnknownSocketType, parent) - , tcpSocket(socket ? socket : new QTcpSocket(this)) - , _version(ws_v) - , _hostPort(-1) - , closingHandshakeSent(false) - , closingHandshakeReceived(false) - , readingState(HeaderPending) - , isFinalFragment(false) - , hasMask(false) - , payloadLength(0) - , maskingKey(4, 0) - , serverSideSocket(false) { - tcpSocket->setParent(this); - - QAbstractSocket::setSocketState(tcpSocket->state()); - QAbstractSocket::setPeerAddress(tcpSocket->peerAddress()); - QAbstractSocket::setPeerPort(tcpSocket->peerPort()); - - if (_version == WS_V0) - connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(processDataV0())); - else if (_version >= WS_V4) - connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(processDataV4())); - connect(tcpSocket, - SIGNAL(error(QAbstractSocket::SocketError)), - this, - SIGNAL(error(QAbstractSocket::SocketError))); - connect(tcpSocket, - SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, - QAuthenticator*)), - this, - SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, - QAuthenticator*))); - connect(tcpSocket, - SIGNAL(stateChanged(QAbstractSocket::SocketState)), - this, - SLOT(processTcpStateChanged(QAbstractSocket::SocketState))); - connect(tcpSocket, - SIGNAL(readChannelFinished()), - this, - SIGNAL(readChannelFinished())); - connect(tcpSocket, SIGNAL(hostFound()), this, SIGNAL(hostFound())); -} - -QWsSocket::~QWsSocket() { - QAbstractSocket::SocketState state = QAbstractSocket::state(); - if (state != QAbstractSocket::UnconnectedState) { - qDebug() << "CloseAway, socket destroyed in server"; - close(CloseGoingAway, QLatin1String("The server destroyed the socket.")); - tcpSocket->abort(); - QAbstractSocket::setSocketState(QAbstractSocket::UnconnectedState); - QAbstractSocket::stateChanged(QAbstractSocket::UnconnectedState); - emit QAbstractSocket::disconnected(); - } -} - -void QWsSocket::connectToHost(const QString& hostName, - quint16 port, - OpenMode mode) { - QWsSocket::connectToHost(QHostAddress(hostName), port, mode); -} - -void QWsSocket::connectToHost(const QHostAddress& address, - quint16 port, - OpenMode mode) { - handshakeResponse.clear(); - setPeerAddress(address); - setPeerPort(port); - setOpenMode(mode); - tcpSocket->connectToHost(address, port, mode); -} - -void QWsSocket::disconnectFromHost() { - QWsSocket::close(); -} - -void QWsSocket::abort(QString reason) { - QWsSocket::close(CloseAbnormalDisconnection, reason); - tcpSocket->abort(); -} - -void QWsSocket::close(ECloseStatusCode closeStatusCode, QString reason) { - if (QAbstractSocket::state() == QAbstractSocket::UnconnectedState) - return; - - if (!closingHandshakeSent) { - switch (_version) { - case WS_V4: - case WS_V5: - case WS_V6: - case WS_V7: - case WS_V8: - case WS_V13: { - // Compose and send close frame - QByteArray BA; - - // Body - if (closeStatusCode == NoCloseStatusCode) { - // Header - BA.append(QWsSocket::composeHeader(true, OpClose, 0)); - } else { - // Header - QByteArray maskingKey; - if (!serverSideSocket) - maskingKey = QWsSocket::generateMaskingKey(); - BA.append(QWsSocket::composeHeader( - true, OpClose, reason.size() + 2, maskingKey)); - - QByteArray body; - - // Close status code (optional) - body.append(QWsServer::serializeInt((int)closeStatusCode, 2)); - - // Reason (optional) - if (reason.size()) { - QByteArray reason_ba = reason.toUtf8(); - if (!serverSideSocket) { - reason_ba = QWsSocket::mask(reason_ba, maskingKey); - } - body.append(reason_ba); - } - - BA.append(body); - } - - // Send closing handshake - tcpSocket->write(BA); - - break; - } - case WS_V0: { - QByteArray closeFrame; - closeFrame.append((char)0xFF); - closeFrame.append((char)0x00); - tcpSocket->write(closeFrame); - break; - } - default: { break; } - } - - closingHandshakeSent = true; - } - - if (QAbstractSocket::state() != QAbstractSocket::ClosingState) { - QAbstractSocket::setSocketState(QAbstractSocket::ClosingState); - emit QAbstractSocket::stateChanged(QAbstractSocket::ClosingState); - emit QAbstractSocket::aboutToClose(); - } - - if (closingHandshakeSent && closingHandshakeReceived) { - QAbstractSocket::setSocketState(QAbstractSocket::UnconnectedState); - emit stateChanged(QAbstractSocket::UnconnectedState); - emit disconnected(); - tcpSocket->disconnectFromHost(); - } -} - -qint64 QWsSocket::write(const QString& string) { - if (_version == WS_V0) { - return QWsSocket::write(string.toUtf8()); - } - - const QList<QByteArray>& framesList = - QWsSocket::composeFrames(string.toUtf8(), false, maxBytesPerFrame); - return writeFrames(framesList); -} - -qint64 QWsSocket::write(const QByteArray& byteArray) { - if (_version == WS_V0) { - QByteArray BA; - BA.append((char)0x00); - BA.append(byteArray); - BA.append((char)0xFF); - return writeFrame(BA); - } - - const QList<QByteArray>& framesList = - QWsSocket::composeFrames(byteArray, true, maxBytesPerFrame); - - qint64 nbBytesWritten = writeFrames(framesList); - emit bytesWritten(nbBytesWritten); - - return nbBytesWritten; -} - -void QWsSocket::processHandshake() { - // copy from QWsServer::dataReceived(); - QTcpSocket* tcpSocket = qobject_cast<QTcpSocket*>(sender()); - if (tcpSocket == 0) - return; - - bool allHeadersFetched = false; - - const QLatin1String emptyLine("\r\n"); - - while (tcpSocket->canReadLine()) { - QString line = tcpSocket->readLine(); - - if (line == emptyLine) { - allHeadersFetched = true; - break; - } - - handshakeResponse.append(line); - } - - if (!allHeadersFetched) - return; - - QRegExp regExp; - regExp.setMinimal(true); - - // check accept field - regExp.setPattern(regExpAcceptStr); - regExp.indexIn(handshakeResponse); - QString acceptFromServer = regExp.cap(1); - - // check upgrade field - regExp.setPattern(regExpUpgradeStr); - regExp.indexIn(handshakeResponse); - QString upgrade = regExp.cap(1); - - // check connection field - regExp.setPattern(regExpConnectionStr); - regExp.indexIn(handshakeResponse); - QString connection = regExp.cap(1); - - // check extensions field - regExp.setPattern(QWsServer::regExpExtensionsStr); - regExp.indexIn(handshakeResponse); - QString extensions = regExp.cap(1); - - // TODO: check extensions field - // If the mandatory params are not setted, we abord the connection to the - // Websocket server - if ((acceptFromServer.isEmpty()) || - (!upgrade.contains(QLatin1String("websocket"), Qt::CaseInsensitive)) || - (!connection.contains(QLatin1String("Upgrade"), Qt::CaseInsensitive))) { - // emit error(QAbstractSocket::ConnectionRefusedError); - // return; - } - - // TODO: check HTTP code - - // TODO: check protocol field - - QString accept = QWsServer::computeAcceptV4(key); - if (accept != acceptFromServer) { - // emit error(QAbstractSocket::ConnectionRefusedError); - // return; - } - - // handshake procedure succeeded - QAbstractSocket::setSocketState(QAbstractSocket::ConnectedState); - emit QAbstractSocket::stateChanged(QAbstractSocket::ConnectedState); - emit QAbstractSocket::connected(); -} - -void QWsSocket::processDataV0() { - if (state() == QAbstractSocket::ConnectingState) { - processHandshake(); - return; - } - - QByteArray BA, buffer; - quint8 type, b = 0x00; - - BA = tcpSocket->read(1); // TODO: refactor like processDataV4 - type = BA[0]; - - if ((type & 0x80) == 0x00) // MSB of type not set - { - if (type != 0x00) { - // ABORT CONNEXION - tcpSocket->readAll(); - return; - } - - // read data - do { - BA = tcpSocket->read(1); - b = BA[0]; - if (b != 0xFF) - buffer.append(b); - } while (b != 0xFF); - - currentFrame.append(buffer); - } else // MSB of type set - { - if (type != 0xFF) { - // ERROR, ABORT CONNEXION - close(); - return; - } - - quint8 length = 0x00; - - bool bIsNotZero = true; - do { - BA = tcpSocket->read(1); - b = BA[0]; - bIsNotZero = (b != 0x00 ? true : false); - if (bIsNotZero) // b must be != 0 - { - quint8 b_v = b & 0x7F; - length *= 128; - length += b_v; - } - } while (((b & 0x80) == 0x80) && bIsNotZero); - - BA = tcpSocket->read(length); // discard this bytes - } - - if (currentFrame.size() > 0) { - emit frameReceived(QString::fromUtf8(currentFrame)); - currentFrame.clear(); - } - - if (tcpSocket->bytesAvailable()) - processDataV0(); -} - -void QWsSocket::processDataV4() { - if (state() == QAbstractSocket::ConnectingState) { - processHandshake(); - } else - while (true) - switch (readingState) { - case HeaderPending: { - if (tcpSocket->bytesAvailable() < 2) - return; - - // END, RSV1-3, Opcode - char header[2]; - tcpSocket->read(header, 2); // XXX: Handle return value - isFinalFragment = (header[0] & 0x80) != 0; - opcode = static_cast<EOpcode>(header[0] & 0x0F); - - // Mask, PayloadLength - hasMask = (header[1] & 0x80) != 0; - quint8 length = (header[1] & 0x7F); - - switch (length) { - case 126: - readingState = PayloadLengthPending; - break; - case 127: - readingState = BigPayloadLenghPending; - break; - default: - payloadLength = length; - readingState = MaskPending; - break; - } - }; break; - case PayloadLengthPending: { - if (tcpSocket->bytesAvailable() < 2) - return; - - uchar length[2]; - tcpSocket->read(reinterpret_cast<char*>(length), - 2); // XXX: Handle return value - payloadLength = - qFromBigEndian<quint16>(reinterpret_cast<const uchar*>(length)); - readingState = MaskPending; - }; break; - case BigPayloadLenghPending: { - if (tcpSocket->bytesAvailable() < 8) - return; - - uchar length[8]; - tcpSocket->read(reinterpret_cast<char*>(length), - 8); // XXX: Handle return value - // Most significant bit must be set to 0 as per - // http://tools.ietf.org/html/rfc6455#section-5.2 - // XXX: Check for that? - payloadLength = qFromBigEndian<quint64>(length) & ~(1LL << 63); - readingState = MaskPending; - }; break; - case MaskPending: { - if (!hasMask) { - readingState = PayloadBodyPending; - break; - } - - if (tcpSocket->bytesAvailable() < 4) - return; - - tcpSocket->read(maskingKey.data(), 4); // XXX: Handle return value - - if (opcode == OpClose) { - readingState = CloseDataPending; - } else { - readingState = PayloadBodyPending; - } - }; /* Intentional fall-through */ - case PayloadBodyPending: { - // TODO: Handle large payloads - if (tcpSocket->bytesAvailable() < static_cast<qint32>(payloadLength)) - return; - - if (opcode == OpClose) { - if (payloadLength >= 2 && tcpSocket->bytesAvailable() >= 2) { - uchar bytes[2]; - tcpSocket->read(reinterpret_cast<char*>(bytes), 2); - closeStatusCode = (ECloseStatusCode)qFromBigEndian<quint16>( - reinterpret_cast<const uchar*>(bytes)); - } else { - closeStatusCode = NoCloseStatusCode; - } - } - - QByteArray ApplicationData = tcpSocket->read(payloadLength); - if (hasMask) - ApplicationData = QWsSocket::mask(ApplicationData, maskingKey); - currentFrame.append(ApplicationData); - - readingState = HeaderPending; - - if (!isFinalFragment) - break; - - switch (opcode) { - case OpBinary: - emit frameReceived(currentFrame); - break; - case OpText: - emit frameReceived(QString::fromUtf8(currentFrame)); - break; - case OpPing: - write(QWsSocket::composeHeader(true, OpPong, 0)); - break; - case OpPong: - emit pong(pingTimer.elapsed()); - break; - case OpClose: - closingHandshakeReceived = true; - close(closeStatusCode); - break; - default: - // DO NOTHING - break; - } - - currentFrame.clear(); - }; break; - case CloseDataPending: - default: - break; - } /* while (true) switch */ -} - -qint64 QWsSocket::writeFrame(const QByteArray& byteArray) { - return tcpSocket->write(byteArray); -} - -qint64 QWsSocket::writeFrames(const QList<QByteArray>& framesList) { - qint64 nbBytesWritten = 0; - for (int i = 0; i < framesList.size(); i++) { - nbBytesWritten += writeFrame(framesList[i]); - } - return nbBytesWritten; -} - -void QWsSocket::processTcpStateChanged( - QAbstractSocket::SocketState tcpSocketState) { - QAbstractSocket::SocketState wsSocketState = QAbstractSocket::state(); - switch (tcpSocketState) { - case QAbstractSocket::HostLookupState: { - QAbstractSocket::setSocketState(QAbstractSocket::HostLookupState); - emit QAbstractSocket::stateChanged(QAbstractSocket::HostLookupState); - break; - } - case QAbstractSocket::ConnectingState: { - QAbstractSocket::setSocketState(QAbstractSocket::ConnectingState); - emit QAbstractSocket::stateChanged(QAbstractSocket::ConnectingState); - break; - } - case QAbstractSocket::ConnectedState: { - if (wsSocketState == QAbstractSocket::ConnectingState) { - key = QWsServer::generateNonce(); - QString handshake = - composeOpeningHandShake(QLatin1String("/"), - QLatin1String("example.com"), - QString(), - QString(), - key); - tcpSocket->write(handshake.toUtf8()); - } - break; - } - case QAbstractSocket::ClosingState: { - if (wsSocketState == QAbstractSocket::ConnectedState) { - QWsSocket::close(CloseGoingAway); - QAbstractSocket::setSocketState(QAbstractSocket::ClosingState); - emit QAbstractSocket::stateChanged(QAbstractSocket::ClosingState); - emit QAbstractSocket::aboutToClose(); - } - break; - } - case QAbstractSocket::UnconnectedState: { - if (wsSocketState != QAbstractSocket::UnconnectedState) { - QAbstractSocket::setSocketError(QAbstractSocket::NetworkError); - emit QAbstractSocket::error(QAbstractSocket::NetworkError); - QAbstractSocket::setSocketState(QAbstractSocket::UnconnectedState); - emit QAbstractSocket::stateChanged(QAbstractSocket::UnconnectedState); - emit QAbstractSocket::disconnected(); - } - closingHandshakeSent = false; - closingHandshakeReceived = false; - break; - } - default: - break; - } -} - -QByteArray QWsSocket::generateMaskingKey() { - QByteArray key; - for (int i = 0; i < 4; i++) { - key.append(qrand() % 0x100); - } - return key; -} - -QByteArray QWsSocket::generateMaskingKeyV4(QString key, QString nonce) { - QString concat = - key + nonce + QLatin1String("61AC5F19-FBBA-4540-B96F-6561F1AB40A8"); - QByteArray hash = - QCryptographicHash::hash(concat.toUtf8(), QCryptographicHash::Sha1); - return hash; -} - -QByteArray QWsSocket::mask(QByteArray& data, QByteArray& maskingKey) { - QByteArray result; - result.reserve(data.size()); - - for (int i = 0; i < data.size(); i++) { - result[i] = (data[i] ^ maskingKey[i % 4]); - } - - return result; -} - -QList<QByteArray> QWsSocket::composeFrames(QByteArray byteArray, - bool asBinary, - int maxFrameBytes) { - if (maxFrameBytes == 0) - maxFrameBytes = maxBytesPerFrame; - - QList<QByteArray> framesList; - - QByteArray maskingKey; - - int nbFrames = byteArray.size() / maxFrameBytes + 1; - - for (int i = 0; i < nbFrames; i++) { - QByteArray BA; - - // end, size - bool end = false; - quint64 size = maxFrameBytes; - EOpcode opcode = OpContinue; - if (i == nbFrames - 1) // for multi-frames - { - end = true; - size = byteArray.size(); - } - if (i == 0) { - if (asBinary) - opcode = OpBinary; - else - opcode = OpText; - } - - // Header - BA.append(QWsSocket::composeHeader(end, opcode, size, maskingKey)); - - // Application Data - QByteArray dataForThisFrame = byteArray.left(size); - byteArray.remove(0, size); - - // dataForThisFrame = QWsSocket::mask( dataForThisFrame, maskingKey ); - BA.append(dataForThisFrame); - - framesList << BA; - } - - return framesList; -} - -QByteArray QWsSocket::composeHeader(bool end, - EOpcode opcode, - quint64 payloadLength, - QByteArray maskingKey) { - QByteArray BA; - quint8 byte; - - // end, RSV1-3, Opcode - byte = 0x00; - // end - if (end) - byte = (byte | 0x80); - // Opcode - byte = (byte | opcode); - BA.append(byte); - - // Mask, PayloadLength - byte = 0x00; - QByteArray BAsize; - // Mask - if (maskingKey.size() == 4) - byte = (byte | 0x80); - // PayloadLength - if (payloadLength <= 125) { - byte = (byte | payloadLength); - } - // Extended payloadLength - else { - // 2 bytes - if (payloadLength <= 0xFFFF) { - byte = (byte | 126); - BAsize.append((payloadLength >> 1 * 8) & 0xFF); - BAsize.append((payloadLength >> 0 * 8) & 0xFF); - } - // 8 bytes - else if (payloadLength <= 0x7FFFFFFF) { - byte = (byte | 127); - BAsize.append((payloadLength >> 7 * 8) & 0xFF); - BAsize.append((payloadLength >> 6 * 8) & 0xFF); - BAsize.append((payloadLength >> 5 * 8) & 0xFF); - BAsize.append((payloadLength >> 4 * 8) & 0xFF); - BAsize.append((payloadLength >> 3 * 8) & 0xFF); - BAsize.append((payloadLength >> 2 * 8) & 0xFF); - BAsize.append((payloadLength >> 1 * 8) & 0xFF); - BAsize.append((payloadLength >> 0 * 8) & 0xFF); - } - } - BA.append(byte); - BA.append(BAsize); - - // Masking - if (maskingKey.size() == 4) - BA.append(maskingKey); - - return BA; -} - -void QWsSocket::ping() { - pingTimer.restart(); - QByteArray pingFrame = QWsSocket::composeHeader(true, OpPing, 0); - writeFrame(pingFrame); -} - -void QWsSocket::setResourceName(QString rn) { - _resourceName = rn; -} - -void QWsSocket::setHost(QString h) { - _host = h; -} - -void QWsSocket::setHostAddress(QString ha) { - _hostAddress = ha; -} - -void QWsSocket::setHostPort(int hp) { - _hostPort = hp; -} - -void QWsSocket::setOrigin(QString o) { - _origin = o; -} - -void QWsSocket::setProtocol(QString p) { - _protocol = p; -} - -void QWsSocket::setExtensions(QString e) { - _extensions = e; -} - -EWebsocketVersion QWsSocket::version() { - return _version; -} - -QString QWsSocket::resourceName() { - return _resourceName; -} - -QString QWsSocket::host() { - return _host; -} - -QString QWsSocket::hostAddress() { - return _hostAddress; -} - -int QWsSocket::hostPort() { - return _hostPort; -} - -QString QWsSocket::origin() { - return _origin; -} - -QString QWsSocket::protocol() { - return _protocol; -} - -QString QWsSocket::extensions() { - return _extensions; -} - -QString QWsSocket::composeOpeningHandShake(QString resourceName, - QString host, - QString origin, - QString extensions, - QString key) { - QString hs; - hs.append(QLatin1String("GET ") + resourceName + - QLatin1String(" HTTP/1.1\r\n")); - hs.append(QLatin1String("Host: ") + host + "\r\n"); - hs.append(QLatin1String("Upgrade: websocket\r\n")); - hs.append(QLatin1String("Connection: Upgrade\r\n")); - hs.append(QLatin1String("Sec-WebSocket-Key: ") + key + QLatin1String("\r\n")); - hs.append(QLatin1String("Origin: ") + origin + QLatin1String("\r\n")); - hs.append(QLatin1String("Sec-WebSocket-Extensions: ") + extensions + - QLatin1String("\r\n")); - hs.append(QLatin1String("Sec-WebSocket-Version: 13\r\n")); - hs.append(QLatin1String("\r\n")); - return hs; -} diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsSocket.h b/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsSocket.h deleted file mode 100644 index cdd19db38a..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QWsSocket.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef QWSSOCKET_H -#define QWSSOCKET_H - -#include <QTcpSocket> -#include <QHostAddress> -#include <QTime> - -enum EWebsocketVersion { - WS_VUnknow = -1, - WS_V0 = 0, - WS_V4 = 4, - WS_V5 = 5, - WS_V6 = 6, - WS_V7 = 7, - WS_V8 = 8, - WS_V13 = 13 -}; - -class QWsSocket : public QAbstractSocket { - Q_OBJECT - - friend class QWsServer; - - public: - enum EOpcode { - OpContinue = 0x0, - OpText = 0x1, - OpBinary = 0x2, - OpReserved3 = 0x3, - OpReserved4 = 0x4, - OpReserved5 = 0x5, - OpReserved6 = 0x6, - OpReserved7 = 0x7, - OpClose = 0x8, - OpPing = 0x9, - OpPong = 0xA, - OpReservedB = 0xB, - OpReservedV = 0xC, - OpReservedD = 0xD, - OpReservedE = 0xE, - OpReservedF = 0xF - }; - enum ECloseStatusCode { - NoCloseStatusCode = 0, - CloseNormal = 1000, - CloseGoingAway = 1001, - CloseProtocolError = 1002, - CloseDataTypeNotSupported = 1003, - CloseReserved1004 = 1004, - CloseMissingStatusCode = 1005, - CloseAbnormalDisconnection = 1006, - CloseWrongDataType = 1007, - ClosePolicyViolated = 1008, - CloseTooMuchData = 1009, - CloseMissingExtension = 1010, - CloseBadOperation = 1011, - CloseTLSHandshakeFailed = 1015 - }; - - public: - // ctor - QWsSocket(QObject* parent = 0, - QTcpSocket* socket = 0, - EWebsocketVersion ws_v = WS_V13); - // dtor - virtual ~QWsSocket(); - - // Public methods - EWebsocketVersion version(); - QString resourceName(); - QString host(); - QString hostAddress(); - int hostPort(); - QString origin(); - QString protocol(); - QString extensions(); - - void setResourceName(QString rn); - void setHost(QString h); - void setHostAddress(QString ha); - void setHostPort(int hp); - void setOrigin(QString o); - void setProtocol(QString p); - void setExtensions(QString e); - - qint64 write(const QString& string); // write data as text - qint64 write(const QByteArray& byteArray); // write data as binary - - public slots: - void connectToHost(const QString& hostName, - quint16 port, - OpenMode mode = ReadWrite); - void connectToHost(const QHostAddress& address, - quint16 port, - OpenMode mode = ReadWrite); - void disconnectFromHost(); - void abort(QString reason = QString()); - void ping(); - -signals: - void frameReceived(QString frame); - void frameReceived(QByteArray frame); - void pong(quint64 elapsedTime); - - protected: - qint64 writeFrames(const QList<QByteArray>& framesList); - qint64 writeFrame(const QByteArray& byteArray); - - protected slots: - virtual void close(ECloseStatusCode closeStatusCode = NoCloseStatusCode, - QString reason = QString()); - void processDataV0(); - void processDataV4(); - void processHandshake(); - void processTcpStateChanged(QAbstractSocket::SocketState socketState); - - private: - enum EReadingState { - HeaderPending, - PayloadLengthPending, - BigPayloadLenghPending, - MaskPending, - PayloadBodyPending, - CloseDataPending - }; - - // private vars - QTcpSocket* tcpSocket; - QByteArray currentFrame; - QTime pingTimer; - - EWebsocketVersion _version; - QString _resourceName; - QString _host; - QString _hostAddress; - int _hostPort; - QString _origin; - QString _protocol; - QString _extensions; - bool serverSideSocket; - - bool closingHandshakeSent; - bool closingHandshakeReceived; - - EReadingState readingState; - EOpcode opcode; - bool isFinalFragment; - bool hasMask; - quint64 payloadLength; - QByteArray maskingKey; - ECloseStatusCode closeStatusCode; - - static const QString regExpAcceptStr; - static const QString regExpUpgradeStr; - static const QString regExpConnectionStr; - QString handshakeResponse; - QString key; - - public: - // Static functions - static QByteArray generateMaskingKey(); - static QByteArray generateMaskingKeyV4(QString key, QString nonce); - static QByteArray mask(QByteArray& data, QByteArray& maskingKey); - static QList<QByteArray> composeFrames(QByteArray byteArray, - bool asBinary = false, - int maxFrameBytes = 0); - static QByteArray composeHeader(bool end, - EOpcode opcode, - quint64 payloadLength, - QByteArray maskingKey = QByteArray()); - static QString composeOpeningHandShake(QString resourceName, - QString host, - QString origin, - QString extensions, - QString key); - - // static vars - static int maxBytesPerFrame; -}; - -#endif // QWSSOCKET_H diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QtWebsocket.pro b/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QtWebsocket.pro deleted file mode 100644 index f52bda256e..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QtWebsocket.pro +++ /dev/null @@ -1,21 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2012-03-05T10:38:43 -# -#------------------------------------------------- - -QT += network - -QT -= gui - -TARGET = QtWebsocket -TEMPLATE = lib -CONFIG += staticlib - -SOURCES += \ - QWsServer.cpp \ - QWsSocket.cpp - -HEADERS += \ - QWsServer.h \ - QWsSocket.h diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QtWebsocket.vcproj b/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QtWebsocket.vcproj deleted file mode 100644 index 306dcada09..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/QtWebsocket/QtWebsocket.vcproj +++ /dev/null @@ -1,328 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9,00" - Name="QtWebsocket" - ProjectGUID="{7E3A920C-4257-41A1-B9B9-BFA138C1C8A2}" - Keyword="Qt4VSv1.0" - TargetFrameworkVersion="0" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="".\GeneratedFiles";".";"$(QTDIR)\include";".\GeneratedFiles\$(ConfigurationName)";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtNetwork"" - PreprocessorDefinitions=",UNICODE,WIN32,QT_LARGEFILE_SUPPORT;QT_DLL;QT_NO_DEBUG,NDEBUG;QT_CORE_LIB;QT_NETWORK_LIB;QTWEBSOCKET_LIB" - RuntimeLibrary="2" - TreatWChar_tAsBuiltInType="false" - DebugInformationFormat="0" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)\$(ProjectName).lib" - AdditionalLibraryDirectories="$(QTDIR)\lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(ProjectDir)$(PlatformName)\$(ConfigurationName)" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="".\GeneratedFiles";".";"$(QTDIR)\include";".\GeneratedFiles\$(ConfigurationName)";"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtNetwork"" - PreprocessorDefinitions=",UNICODE,WIN32,QT_LARGEFILE_SUPPORT;QT_DLL;QT_CORE_LIB;QT_NETWORK_LIB;QTWEBSOCKET_LIB" - RuntimeLibrary="3" - TreatWChar_tAsBuiltInType="false" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="$(OutDir)\$(ProjectName).lib" - AdditionalLibraryDirectories="$(QTDIR)\lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;cxx;c;def" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\QWsServer.cpp" - > - </File> - <File - RelativePath=".\QWsSocket.cpp" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\QWsServer.h" - > - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - Description="Moc'ing QWsServer.h..." - CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_NETWORK_LIB -DQTWEBSOCKET_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtNetwork"
" - AdditionalDependencies=""$(QTDIR)\bin\moc.exe";$(InputPath)" - Outputs="".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp"" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - Description="Moc'ing QWsServer.h..." - CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_NETWORK_LIB -DQTWEBSOCKET_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtNetwork"
" - AdditionalDependencies=""$(QTDIR)\bin\moc.exe";$(InputPath)" - Outputs="".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp"" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\QWsSocket.h" - > - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - Description="Moc'ing QWsSocket.h..." - CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_NETWORK_LIB -DQTWEBSOCKET_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtNetwork"
" - AdditionalDependencies=""$(QTDIR)\bin\moc.exe";$(InputPath)" - Outputs="".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp"" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - Description="Moc'ing QWsSocket.h..." - CommandLine=""$(QTDIR)\bin\moc.exe" "$(InputPath)" -o ".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_CORE_LIB -DQT_NETWORK_LIB -DQTWEBSOCKET_LIB "-I.\GeneratedFiles" "-I." "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtNetwork"
" - AdditionalDependencies=""$(QTDIR)\bin\moc.exe";$(InputPath)" - Outputs="".\GeneratedFiles\$(ConfigurationName)\moc_$(InputName).cpp"" - /> - </FileConfiguration> - </File> - </Filter> - <Filter - Name="Form Files" - Filter="ui" - UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}" - > - </Filter> - <Filter - Name="Resource Files" - Filter="qrc;*" - UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}" - ParseFiles="false" - > - </Filter> - <Filter - Name="Generated Files" - Filter="moc;h;cpp" - UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}" - SourceControlFiles="false" - > - <Filter - Name="Release" - Filter="cpp;moc" - SourceControlFiles="false" - > - <File - RelativePath=".\GeneratedFiles\Release\moc_QWsServer.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\GeneratedFiles\Release\moc_QWsSocket.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - </Filter> - <Filter - Name="Debug" - Filter="cpp;moc" - SourceControlFiles="false" - > - <File - RelativePath=".\GeneratedFiles\Debug\moc_QWsServer.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\GeneratedFiles\Debug\moc_QWsSocket.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - </Filter> - </Filter> - </Files> - <Globals> - <Global - Name="lreleaseOptions" - Value="" - /> - <Global - Name="lupdateOnBuild" - Value="0" - /> - <Global - Name="lupdateOptions" - Value="" - /> - <Global - Name="MocDir" - Value=".\GeneratedFiles\$(ConfigurationName)" - /> - <Global - Name="MocOptions" - Value="" - /> - <Global - Name="QtVersion Win32" - Value="4.8.2" - /> - <Global - Name="RccDir" - Value=".\GeneratedFiles" - /> - <Global - Name="UicDir" - Value=".\GeneratedFiles" - /> - </Globals> -</VisualStudioProject> diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/fordsdlcore_plugin.cpp b/src/components/qt_hmi/References/Work/fordsdlcore/fordsdlcore_plugin.cpp deleted file mode 100644 index 003b098d47..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/fordsdlcore_plugin.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include "fordsdlcore_plugin.h" -#include "smartdevicelink.h" -#include <QDebug> -#include <qqml.h> -#include "sdlalert.h" -#include <QQmlEngine> -#include <QQmlContext> - -QObject* sdlSingleton(QQmlEngine* engine, QJSEngine* js) { - Q_UNUSED(engine) - Q_UNUSED(js) - - engine->rootContext()->setContextProperty( - "MediaApps", SmartDeviceLink::getInstance().getMediaApps()); - - return (QObject*)&SmartDeviceLink::getInstance(); -} - -QObject* mediaAppsSingleton(QQmlEngine* engine, QJSEngine* js) { - Q_UNUSED(engine) - Q_UNUSED(js) - - return (QObject*)SmartDeviceLink::getInstance().getMediaApps(); -} - -void FordSdlCorePlugin::registerTypes(const char* uri) { - qmlRegisterSingletonType<SdlAppsListModel>( - uri, 1, 0, "MediaApps", mediaAppsSingleton); - qmlRegisterSingletonType<SmartDeviceLink>(uri, 1, 0, "AppLink", sdlSingleton); -} diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/fordsdlcore_plugin.h b/src/components/qt_hmi/References/Work/fordsdlcore/fordsdlcore_plugin.h deleted file mode 100644 index 2c8bf39d28..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/fordsdlcore_plugin.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef FORDSDLCORE_PLUGIN_H -#define FORDSDLCORE_PLUGIN_H - -#include <QQmlExtensionPlugin> - -class FordSdlCorePlugin : public QQmlExtensionPlugin { - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - - public: - void registerTypes(const char* uri); -}; - -#endif // FORDSDLCORE_PLUGIN_H diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/qmldir b/src/components/qt_hmi/References/Work/fordsdlcore/qmldir deleted file mode 100644 index da1a7b7f96..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.ford.sdlcore -plugin FordSdlCore - diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/sdlalert.cpp b/src/components/qt_hmi/References/Work/fordsdlcore/sdlalert.cpp deleted file mode 100644 index ec4350df77..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/sdlalert.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "sdlalert.h" - -SdlAlert::SdlAlert(QObject* parent) : QQuickItem() {} diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/sdlalert.h b/src/components/qt_hmi/References/Work/fordsdlcore/sdlalert.h deleted file mode 100644 index 9c32718c56..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/sdlalert.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef SDLALERT_H -#define SDLALERT_H - -#include <QQuickItem> - -class SdlAlert : public QQuickItem { - Q_OBJECT - public: - explicit SdlAlert(QObject* parent = 0); - -signals: - - public slots: -}; - -#endif // SDLALERT_H diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/sdlappslistmodel.cpp b/src/components/qt_hmi/References/Work/fordsdlcore/sdlappslistmodel.cpp deleted file mode 100644 index 419908339e..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/sdlappslistmodel.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "sdlappslistmodel.h" - -SdlAppsListModel::SdlAppsListModel(QObject* parent) - : QAbstractListModel(parent) {} diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/sdlappslistmodel.h b/src/components/qt_hmi/References/Work/fordsdlcore/sdlappslistmodel.h deleted file mode 100644 index b78aeeec01..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/sdlappslistmodel.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef SDLAPPSLISTMODEL_H -#define SDLAPPSLISTMODEL_H - -#include <QAbstractListModel> -#include <QStringList> - -class SdlAppsListModel : public QAbstractListModel { - Q_OBJECT - public: - explicit SdlAppsListModel(QObject* parent = 0); - - int rowCount(const QModelIndex& parent) const { - return m_data.size(); - } - - QVariant data(const QModelIndex& index, int role) const { - return m_data.values().at(index.row()); - } - - virtual QHash<int, QByteArray> roleNames() const { - QHash<int, QByteArray> roles; - roles['t'] = "text"; - return roles; - } - - void append(int id, QString string) { - beginResetModel(); - m_data.clear(); - m_data[id] = string; - endResetModel(); - } - - void clear() { - beginResetModel(); - m_data.clear(); - endResetModel(); - } - -signals: - - public slots: - - private: - QHash<int, QString> m_data; -}; - -#endif // SDLAPPSLISTMODEL_H diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/smartdevicelink.cpp b/src/components/qt_hmi/References/Work/fordsdlcore/smartdevicelink.cpp deleted file mode 100644 index 5ee8c455e9..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/smartdevicelink.cpp +++ /dev/null @@ -1,386 +0,0 @@ -#include "smartdevicelink.h" -#include <QDebug> -#include "QtWebsocket/QWsSocket.h" -#include <QJsonDocument> -#include <QJsonObject> -#include <unistd.h> - -SmartDeviceLink::SmartDeviceLink(QQuickItem* parent) : QObject(parent) { - connect(&m_ws_basic, SIGNAL(connected()), this, SLOT(basic_connected())); - connect(&m_ws_basic, - SIGNAL(frameReceived(QString)), - this, - SLOT(basic_receive(QString))); - connect(&m_ws_basic, SIGNAL(disconnected()), this, SLOT(disconnected())); - - connect(&m_ws_buttons, SIGNAL(connected()), this, SLOT(buttons_connected())); - connect(&m_ws_buttons, - SIGNAL(frameReceived(QString)), - this, - SLOT(buttons_receive(QString))); - connect(&m_ws_buttons, SIGNAL(disconnected()), this, SLOT(disconnected())); - - connect(&m_ws_tts, SIGNAL(connected()), this, SLOT(tts_connected())); - connect(&m_ws_tts, - SIGNAL(frameReceived(QString)), - this, - SLOT(tts_receive(QString))); - connect(&m_ws_tts, SIGNAL(disconnected()), this, SLOT(disconnected())); - - connect(&m_ws_vehicle, SIGNAL(connected()), this, SLOT(vehicle_connected())); - connect(&m_ws_vehicle, - SIGNAL(frameReceived(QString)), - this, - SLOT(vehicle_receive(QString))); - connect(&m_ws_vehicle, SIGNAL(disconnected()), this, SLOT(disconnected())); - - connect(&m_ws_ui, SIGNAL(connected()), this, SLOT(ui_connected())); - connect(&m_ws_ui, - SIGNAL(frameReceived(QString)), - this, - SLOT(ui_receive(QString))); - connect(&m_ws_ui, SIGNAL(disconnected()), this, SLOT(disconnected())); - - connect(&m_ws_vr, SIGNAL(connected()), this, SLOT(vr_connected())); - connect(&m_ws_vr, - SIGNAL(frameReceived(QString)), - this, - SLOT(vr_receive(QString))); - connect(&m_ws_vr, SIGNAL(disconnected()), this, SLOT(disconnected())); - - connect(this, - SIGNAL(newAppAvailable(int, QString)), - this, - SLOT(registerApp(int, QString))); - - m_ws_buttons.connectToHost(QLatin1String("127.0.0.1"), 8087); - m_ws_tts.connectToHost(QLatin1String("127.0.0.1"), 8087); - m_ws_vr.connectToHost(QLatin1String("127.0.0.1"), 8087); - m_ws_basic.connectToHost(QLatin1String("127.0.0.1"), 8087); - m_ws_vehicle.connectToHost(QLatin1String("127.0.0.1"), 8087); - m_ws_ui.connectToHost(QLatin1String("127.0.0.1"), 8087); -} - -SmartDeviceLink::~SmartDeviceLink() { - qDebug() << "SmartDeviceLink destroyed"; -} - -void SmartDeviceLink::basic_connected() { - basic_send( - "{\"jsonrpc\":\"2.0\",\"id\":600,\"method\":\"MB.registerComponent\"," - "\"params\":{\"componentName\":\"BasicCommunicationClient\"}}"); -} - -void SmartDeviceLink::buttons_connected() { - buttons_send( - "{\"jsonrpc\":\"2.0\",\"id\":200,\"method\":\"MB.registerComponent\"," - "\"params\":{\"componentName\":\"Buttons\"}}"); -} - -void SmartDeviceLink::tts_connected() { - tts_send( - "{\"jsonrpc\":\"2.0\",\"id\":300,\"method\":\"MB.registerComponent\"," - "\"params\":{\"componentName\":\"TTS\"}}"); -} - -void SmartDeviceLink::vehicle_connected() { - vehicle_send( - "{\"jsonrpc\":\"2.0\",\"id\":700,\"method\":\"MB.registerComponent\"," - "\"params\":{\"componentName\":\"VehicleInfo\"}}"); -} - -void SmartDeviceLink::ui_connected() { - ui_send( - "{\"jsonrpc\":\"2.0\",\"id\":400,\"method\":\"MB.registerComponent\"," - "\"params\":{\"componentName\":\"UI\"}}"); -} - -void SmartDeviceLink::vr_connected() { - vr_send( - "{\"jsonrpc\":\"2.0\",\"id\":500,\"method\":\"MB.registerComponent\"," - "\"params\":{\"componentName\":\"VR\"}}"); -} - -void SmartDeviceLink::basic_send(QString message) { - qDebug() << "Sending (basic):" << message; - m_ws_basic.write(message.append('\n')); -} - -void SmartDeviceLink::buttons_send(QString message) { - qDebug() << "Sending (buttons):" << message; - m_ws_buttons.write(message.append('\n')); -} - -void SmartDeviceLink::tts_send(QString message) { - qDebug() << "Sending (tts):" << message; - m_ws_tts.write(message.append('\n')); -} - -void SmartDeviceLink::vehicle_send(QString message) { - qDebug() << "Sending (vehicle):" << message; - m_ws_vehicle.write(message.append('\n')); -} - -void SmartDeviceLink::ui_send(QString message) { - qDebug() << "Sending (ui):" << message; - m_ws_ui.write(message.append('\n')); -} - -void SmartDeviceLink::vr_send(QString message) { - qDebug() << "Sending (vr):" << message; - m_ws_vr.write(message.append('\n')); -} - -void SmartDeviceLink::basic_receive(QString message) { - qDebug() << "Receiving(basic):" << message; - QJsonObject root = QJsonDocument::fromJson(message.toLocal8Bit()).object(); - int id = root.value("id").toDouble(); - int result = root.value("result").toDouble(); - QString method = root.value("method").toString(); - - if (id == 600) { - char* reg, *unreg, *update; - - asprintf(®, - "{\"jsonrpc\":\"2.0\",\"id\":%i,\"method\":\"MB.subscribeTo\"," - "\"params\":{\"propertyName\":\"BasicCommunication." - "OnAppRegistered\"}}", - result + 1); - basic_send(reg); - free(reg); - - asprintf(&unreg, - "{\"jsonrpc\":\"2.0\",\"id\":%i,\"method\":\"MB.subscribeTo\"," - "\"params\":{\"propertyName\":\"BasicCommunication." - "OnAppUnregistered\"}}", - result + 2); - basic_send(unreg); - free(unreg); - - asprintf(&update, - "{\"jsonrpc\":\"2.0\",\"id\":%i,\"method\":\"MB.subscribeTo\"," - "\"params\":{\"propertyName\":\"BasicCommunication." - "OnDeviceListUpdated\"}} ", - result + 3); - basic_send(update); - free(update); - } else if (method.compare("BasicCommunication.OnAppRegistered") == 0) { - QJsonObject params = root.value("params").toObject(); - QJsonObject application = params.value("application").toObject(); - QString appName = application.value("appName").toString(); - int appId = application.value("appId").toDouble(); - - char* update; - asprintf(&update, - "{\"jsonrpc\":\"2.0\",\"id\":3000,\"method\":\"BasicCommunication." - "ActivateApp\",\"params\":{\"appName\":\"%s\",\"appId\":%i}}", - appName.toLocal8Bit().data(), - appId); - basic_send(update); - free(update); - emit newAppAvailable(appId, appName); - } else if (method.compare("BasicCommunication.OnAppUnregistered") == 0) { - m_media_apps.clear(); - } -} - -void SmartDeviceLink::buttons_receive(QString message) { - qDebug() << "Receiving(buttons):" << message; - QJsonObject root = QJsonDocument::fromJson(message.toLocal8Bit()).object(); - int id = root.value("id").toDouble(); - QString method = root.value("method").toString(); - - if (method.compare("Buttons.GetCapabilities") == 0) { - buttons_send( - "{\"jsonrpc\":\"2.0\",\"id\":19,\"result\":{\"capabilities\":[{" - "\"name\":\"PRESET_0\",\"shortPressAvailable\":true," - "\"longPressAvailable\":true,\"upDownAvailable\":true},{\"name\":" - "\"PRESET_1\",\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"PRESET_2\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"PRESET_3\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"PRESET_4\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"PRESET_5\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"PRESET_6\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"PRESET_7\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"PRESET_8\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"PRESET_9\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"OK\",\"shortPressAvailable\":" - "true,\"longPressAvailable\":true,\"upDownAvailable\":true},{\"name\":" - "\"SEEKLEFT\",\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"SEEKRIGHT\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"TUNEUP\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true},{\"name\":\"TUNEDOWN\"," - "\"shortPressAvailable\":true,\"longPressAvailable\":true," - "\"upDownAvailable\":true}],\"presetBankCapabilities\":{" - "\"onScreenPresetsAvailable\":true},\"method\":\"Buttons." - "GetCapabilitiesResponse\",\"resultCode\":\"SUCCESS\"}}"); - } -} - -void SmartDeviceLink::tts_receive(QString message) { - qDebug() << "Receiving(tts):" << message; - QJsonObject root = QJsonDocument::fromJson(message.toLocal8Bit()).object(); - int id = root.value("id").toDouble(); - QString method = root.value("method").toString(); - - if (method.compare("TTS.GetCapabilities") == 0) { - tts_send( - "{\"jsonrpc\":\"2.0\",\"id\":18,\"result\":{\"capabilities\":[\"TEXT\"]" - ",\"resultCode\":\"SUCCESS\",\"method\":\"TTS." - "GetCapabilitiesResponse\"}}"); - } else if (method.compare("TTS.GetLanguage") == 0) { - tts_send( - "{\"jsonrpc\":\"2.0\",\"id\":26,\"result\":{\"resultCode\":\"SUCCESS\"," - "\"method\":\"TTS.GetLanguageResponse\",\"language\":\"EN-US\"}}"); - } else if (method.compare("TTS.GetSupportedLanguages") == 0) { - tts_send( - "{\"jsonrpc\":\"2.0\",\"id\":22,\"result\":{\"resultCode\":\"SUCCESS\"," - "\"method\":\"TTS.GetSupportedLanguagesResponse\",\"languages\":[\"EN-" - "US\",\"ES-MX\",\"FR-CA\",\"DE-EU\",\"ES-EU\",\"EN-EU\",\"RU-RU\",\"TR-" - "TR\",\"PL-EU\",\"FR-EU\",\"IT-EU\",\"SV-EU\",\"PT-EU\",\"NL-EU\",\"EN-" - "AU\",\"ZH-CN\",\"ZH-TW\",\"JA-JP\",\"AR\",\"KO-KR\"]}}"); - } -} - -void SmartDeviceLink::vehicle_receive(QString message) { - qDebug() << "Receiving(vehicle):" << message; - QJsonObject root = QJsonDocument::fromJson(message.toLocal8Bit()).object(); - int id = root.value("id").toDouble(); - QString method = root.value("method").toString(); - - if (method.compare("VehicleInfo.GetVehicleType") == 0) { - vehicle_send( - "{\"jsonrpc\":\"2.0\",\"id\":20,\"result\":{\"resultCode\":\"SUCCESS\"," - "\"method\":\"VehicleInfo.GetVehicleTypeResponse\",\"vehicleType\":{" - "\"make\":\"Ford\",\"model\":\"Fiesta\",\"modelYear\":\"2013\"," - "\"trim\":\"SE\"}}}"); - } -} - -void SmartDeviceLink::ui_receive(QString message) { - qDebug() << "Receiving(ui):" << message; - QJsonObject root = QJsonDocument::fromJson(message.toLocal8Bit()).object(); - int id = root.value("id").toDouble(); - int result = root.value("result").toDouble(); - QString method = root.value("method").toString(); - - if (id == 400) { - char* onchoise; - asprintf(&onchoise, - "{\"jsonrpc\":\"2.0\",\"id\":%i,\"method\":\"MB.subscribeTo\"," - "\"params\":{\"propertyName\":\"VR.OnChoise\"}}", - result + 1); - ui_send(onchoise); - free(onchoise); - - ui_send("{\"jsonrpc\":\"2.0\",\"method\":\"UI.OnReady\"}"); - } else if (method.compare("UI.GetCapabilities") == 0) { - ui_send( - "{\"jsonrpc\":\"2.0\",\"id\":16,\"result\":{\"displayCapabilities\":{" - "\"displayType\":\"GEN2_8_DMA\",\"textFields\":[{\"name\":" - "\"mainField1\",\"characterSet\":\"TYPE2SET\",\"width\":1,\"rows\":1},{" - "\"name\":\"mainField2\",\"characterSet\":\"TYPE2SET\",\"width\":1," - "\"rows\":1},{\"name\":\"statusBar\",\"characterSet\":\"TYPE2SET\"," - "\"width\":1,\"rows\":1},{\"name\":\"mediaClock\",\"characterSet\":" - "\"TYPE2SET\",\"width\":1,\"rows\":1},{\"name\":\"mediaTrack\"," - "\"characterSet\":\"TYPE2SET\",\"width\":1,\"rows\":1},{\"name\":" - "\"alertText1\",\"characterSet\":\"TYPE2SET\",\"width\":1,\"rows\":1},{" - "\"name\":\"alertText2\",\"characterSet\":\"TYPE2SET\",\"width\":1," - "\"rows\":1}],\"mediaClockFormats\":[\"CLOCK1\",\"CLOCK2\"," - "\"CLOCKTEXT1\",\"CLOCKTEXT2\",\"CLOCKTEXT3\"]}," - "\"hmiZoneCapabilities\":[\"FRONT\",\"BACK\"]," - "\"softButtonCapabilities\":[{\"shortPressAvailable\":true," - "\"longPressAvailable\":true,\"upDownAvailable\":true," - "\"imageSupported\":true}],\"method\":\"UI.GetCapabilitiesResponse\"," - "\"resultCode\":\"SUCCESS\"}}"); - } else if (method.compare("UI.GetSupportedLanguages") == 0) { - ui_send( - "{\"jsonrpc\":\"2.0\",\"id\":21,\"result\":{\"resultCode\":\"SUCCESS\"," - "\"method\":\"UI.GetSupportedLanguagesResponse\",\"languages\":[\"EN-" - "US\",\"ES-MX\",\"FR-CA\",\"DE-EU\",\"ES-EU\",\"EN-EU\",\"RU-RU\",\"TR-" - "TR\",\"PL-EU\",\"FR-EU\",\"IT-EU\",\"SV-EU\",\"PT-EU\",\"NL-EU\",\"EN-" - "AU\",\"ZH-CN\",\"ZH-TW\",\"JA-JP\",\"AR\",\"KO-KR\"]}}"); - } else if (method.compare("UI.GetLanguage") == 0) { - ui_send( - "{\"jsonrpc\":\"2.0\",\"id\":24,\"result\":{\"resultCode\":\"SUCCESS\"," - "\"method\":\"UI.GetLanguageResponse\",\"hmiDisplayLanguage\":\"EN-" - "US\"}}"); - } else if (method.compare("UI.Show") == 0) { - QJsonObject params = root.value("params").toObject(); - setShow1(params.value("mainField1").toString()); - setShow2(params.value("mainField2").toString()); - char* response; - asprintf(&response, - "{\"jsonrpc\":\"2.0\",\"id\":%i,\"result\":{\"resultCode\":" - "\"SUCCESS\",\"method\":\"UI.ShowResponse\"}}", - id); - ui_send(response); - free(response); - } else if (method.compare("UI.Alert") == 0) { - QJsonObject params = root.value("params").toObject(); - QString message(params.value("AlertText1").toString()); - message.append("\n").append(params.value("AlertText2").toString()); - char* response; - asprintf(&response, - "{\"jsonrpc\":\"2.0\",\"id\":%i,\"result\":{\"resultCode\":" - "\"SUCCESS\",\"method\":\"UI.AlertResponse\"}}", - id); - ui_send(response); - free(response); - emit alert(message); - } -} - -void SmartDeviceLink::vr_receive(QString message) { - qDebug() << "Receiving(vr):" << message; - QJsonObject root = QJsonDocument::fromJson(message.toLocal8Bit()).object(); - int id = root.value("id").toDouble(); - QString method = root.value("method").toString(); - - if (method.compare("VR.GetCapabilities") == 0) { - vr_send( - "{\"jsonrpc\":\"2.0\",\"id\":17,\"result\":{\"capabilities\":[\"TEXT\"]" - ",\"method\":\"VR.GetCapabilitiesResponse\",\"resultCode\":\"SUCCESS\"}" - "}"); - } else if (method.compare("VR.GetSupportedLanguages") == 0) { - vr_send( - "{\"jsonrpc\":\"2.0\",\"id\":23,\"result\":{\"resultCode\":\"SUCCESS\"," - "\"method\":\"VR.GetSupportedLanguagesResponse\",\"languages\":[\"EN-" - "US\",\"ES-MX\",\"FR-CA\",\"DE-EU\",\"ES-EU\",\"EN-EU\",\"RU-RU\",\"TR-" - "TR\",\"PL-EU\",\"FR-EU\",\"IT-EU\",\"SV-EU\",\"PT-EU\",\"NL-EU\",\"EN-" - "AU\",\"ZH-CN\",\"ZH-TW\",\"JA-JP\",\"AR\",\"KO-KR\"]}}"); - } else if (method.compare("VR.GetLanguage") == 0) { - vr_send( - "{\"jsonrpc\":\"2.0\",\"id\":25,\"result\":{\"resultCode\":\"SUCCESS\"," - "\"method\":\"VR.GetLanguageResponse\",\"language\":\"EN-US\"}}"); - } -} - -void SmartDeviceLink::registerApp(int appId, QString appName) { - qDebug() << "New app registered:" << appName; - m_media_apps.append(appId, appName); -} - -void SmartDeviceLink::setShow1(QString show) { - m_show1 = show; - emit show1Changed(show); -} - -void SmartDeviceLink::setShow2(QString show) { - m_show2 = show; - emit show2Changed(show); -} - -void SmartDeviceLink::disconnected() { - qDebug() << "Websocket disconnected"; -} diff --git a/src/components/qt_hmi/References/Work/fordsdlcore/smartdevicelink.h b/src/components/qt_hmi/References/Work/fordsdlcore/smartdevicelink.h deleted file mode 100644 index 18ad605f40..0000000000 --- a/src/components/qt_hmi/References/Work/fordsdlcore/smartdevicelink.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef SMARTDEVICELINK_H -#define SMARTDEVICELINK_H - -#include <QQuickItem> -#include <QStringListModel> -#include "QtWebsocket/QWsSocket.h" -#include "sdlappslistmodel.h" - -class SmartDeviceLink : public QObject { - Q_OBJECT - Q_PROPERTY(QString show1 READ getShow1 NOTIFY show1Changed) - Q_PROPERTY(QString show2 READ getShow2 NOTIFY show2Changed) - - public: - SmartDeviceLink(QQuickItem* parent = 0); - ~SmartDeviceLink(); - - static SmartDeviceLink& getInstance() { - static SmartDeviceLink instance; - return instance; - } - - SdlAppsListModel* getMediaApps() { - return &m_media_apps; - } - QString getShow1() { - return m_show1; - } - QString getShow2() { - return m_show2; - } - - private: - QWsSocket m_ws_basic; - QWsSocket m_ws_tts; - QWsSocket m_ws_buttons; - QWsSocket m_ws_vehicle; - QWsSocket m_ws_ui; - QWsSocket m_ws_vr; - - SdlAppsListModel m_media_apps; - - QString m_show1; - QString m_show2; - - void basic_send(QString message); - void tts_send(QString message); - void buttons_send(QString message); - void vehicle_send(QString message); - void ui_send(QString message); - void vr_send(QString message); - void setShow1(QString); - void setShow2(QString); - - public slots: - void basic_connected(); - void tts_connected(); - void buttons_connected(); - void vehicle_connected(); - void ui_connected(); - void vr_connected(); - - void basic_receive(QString); - void tts_receive(QString); - void buttons_receive(QString); - void vehicle_receive(QString); - void ui_receive(QString); - void vr_receive(QString); - void registerApp(int, QString); - - void disconnected(); - -signals: - void show1Changed(QString); - void show2Changed(QString); - void newAppAvailable(int, QString); - void alert(QString message); -}; - -#endif // SMARTDEVICELINK_H diff --git a/src/components/qt_hmi/qml_model_qt4/CMakeLists.txt b/src/components/qt_hmi/qml_model_qt4/CMakeLists.txt deleted file mode 100644 index e6eeb9e525..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/CMakeLists.txt +++ /dev/null @@ -1,87 +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. - -cmake_minimum_required(VERSION 2.8.11) - -set(components_dir ${CMAKE_CURRENT_SOURCE_DIR}/../..) -set(dbus_dir ${components_dir}/dbus) -set(codegen_dir ${dbus_dir}/codegen) -set(codegen ${codegen_dir}/make_qml_dbus_qml.py) -set(parser ${codegen_dir}/ford_xml_parser.py) -set(interfaces_dir ${components_dir}/interfaces) -set(api_xml ${interfaces_dir}/QT_HMI_API.xml) -set(proxy_dir ${CMAKE_CURRENT_BINARY_DIR}/hmi_api) -set(qml_dirs hmi_api controls models popups views) -set(qml_files MainWindow.qml) - -add_custom_target(qml_auto ALL - COMMAND python ${codegen} --infile ${api_xml} --version ${qt_version} --outdir ${proxy_dir} - DEPENDS ${api_xml} ${codegen} ${parser} - COMMENT "Generating files: - ${proxy_dir}/BasicCommunicationProxy.qml - ${proxy_dir}/ButtonsProxy.qml - ${proxy_dir}/NavigationProxy.qml - ${proxy_dir}/TTSProxy.qml - ${proxy_dir}/UIProxy.qml - ${proxy_dir}/VehicleInfoProxy.qml - ${proxy_dir}/VRProxy.qml - from: - ${api_xml} ..." -) - -add_custom_target(qml_copy_resources ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${CMAKE_CURRENT_BINARY_DIR}/res - COMMENT "Copying resources") - -if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - foreach(qml_dir ${qml_dirs}) - add_custom_target(qml_copy_${qml_dir} ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${qml_dir} ${CMAKE_CURRENT_BINARY_DIR}/${qml_dir} - COMMENT "Copying directory ${qml_dir}") - endforeach(qml_dir) - - add_dependencies(qml_auto qml_copy_hmi_api) - - foreach(qml_file ${qml_files}) - add_custom_target(qml_copy_${qml_file} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${qml_file} ${CMAKE_CURRENT_BINARY_DIR}/${qml_file} - COMMENT "Copying file ${qml_file}") - endforeach(qml_file) -endif() - -install(DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}/controls - ${CMAKE_CURRENT_BINARY_DIR}/hmi_api - ${CMAKE_CURRENT_BINARY_DIR}/models - ${CMAKE_CURRENT_BINARY_DIR}/popups - ${CMAKE_CURRENT_BINARY_DIR}/res - ${CMAKE_CURRENT_BINARY_DIR}/views - DESTINATION bin/hmi) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/MainWindow.qml DESTINATION bin/hmi) diff --git a/src/components/qt_hmi/qml_model_qt4/MainWindow.qml b/src/components/qt_hmi/qml_model_qt4/MainWindow.qml deleted file mode 100644 index 1a3b06fd41..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/MainWindow.qml +++ /dev/null @@ -1,356 +0,0 @@ -/** - * @file MainWindow.qml - * @brief Implementation of main window. - * 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. - */ - -import QtQuick 1.1 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import "./controls" -import "./views" -import "./hmi_api" as HmiApi -import "./models" -import "./popups" -import "hmi_api/Common.js" as Common -import "./models/Constants.js" as Constants -import "models/Internal.js" as Internal - -Rectangle { - width: 1280 - height: 768 - property string startQml: "./views/ApplicationListView.qml" - property int minWidth: Constants.mainScreenMinWidth - property int minHeight: Constants.mainScreenMiHeight - color: Constants.secondaryColor - - DataStorage { - id: dataContainer - - onSystemContextChanged: { - sdlUI.onSystemContext(systemContext) - } - - // Please note that applicationContext is changed only after setting currentApplication - onApplicationContextChanged: { - if (applicationContext) { - sdlBasicCommunication.onAppActivated(currentApplication.appId) - } else { - sdlBasicCommunication.onAppDeactivated(currentApplication.appId, contentLoader.item.category) - } - } - } - -// TODO(KKolodiy): find way for play sound -// Audio { -// id: beep -// source: "res/initial.wav" -// } - - SettingsStorage { - id: settingsContainer - } - - Item { - id: mainScreen - anchors.top: parent. top - anchors.left: parent.left - width: (parent.width - simulationScreen.width < minWidth) ? - minWidth : parent.width - simulationScreen.width - height: (parent.height - hardwareScreen.height < minHeight) ? - minHeight : parent.height - hardwareScreen.height - clip: true - visible: false - - Item { - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - height: parent.height * 0.10 - width: parent.width - HeaderMenu {} - } - - Item { - height: parent.height * 0.90 - width: parent.width - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - - Loader { - id: contentLoader - height: parent.height - Constants.margin - width: parent.width - 2 * Constants.margin - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.leftMargin: Constants.margin - anchors.rightMargin: Constants.margin - anchors.bottomMargin: Constants.margin - - - source:startQml - property variant viewTransitionStack : [] - - function reset() { - viewTransitionStack = [] - } - - property string currentLocation - function go(path, appId) { - console.debug("enter:", path, ", appId:", appId) - if (path) { - if (currentLocation !== path) { - viewTransitionStack.push({ uri: source.toString(), applicationContext: false }) - if (appId) { - dataContainer.setCurrentApplication(appId) - } - currentLocation = path - source = path - } - } - console.debug("exit") - } - - function back() { - if (viewTransitionStack.length) { - source = viewTransitionStack.pop().uri - } - currentLocation = "" - } - - onStatusChanged: { - if (status == Component.Ready) { - if (!dataContainer.activeAlert) { - dataContainer.applicationContext = item.applicationContext - } - else { - dataContainer.applicationSavedContext = item.applicationContext - } - if (viewTransitionStack && viewTransitionStack.length) { - viewTransitionStack[viewTransitionStack.length - 1].applicationContext = item.applicationContext - } - dataContainer.setSystemContext() - } - } - } - } - - WarningInfo { id: warningInfo } - - InteractionPopup { - id: interactionPopup - popUpName: "UI.PerformInteraction" - anchors.centerIn: parent - visible: false - } - - SliderPopup { - id: sliderPopup - popUpName: "UI.Slider" - anchors.centerIn: parent - visible: false - } - - PerformAudioPassThruPopup { - id: performAudioPassThruPopup - popUpName: "UI.PerformAudioPassThru" - anchors.centerIn: parent - visible: false - } - - VRHelpPopup { - id: vrHelpPopup - popUpName: "UI.VrHelp" - anchors.centerIn: parent - visible: false - } - - AlertWindow { - id: alertWindow - popUpName: "UI.Alert" - objectName: "AlertWindow" - anchors.fill: parent - visible: false - } - } - - Item { - id: simulationScreen - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: mainScreen.right - width: simulationPanel.width - clip: true - SimulationView { - id: simulationPanel - - VRPopUp { - id: vrPopUp - visible: false - anchors.fill: parent - } - - TTSPopUp { - id: ttsPopUp - anchors.top: parent.top - anchors.right: parent.right - visible: false - } - } - } - - Item { - id: hardwareScreen - anchors.top: mainScreen.bottom - anchors.left: parent.left - anchors.right: simulationScreen.left - height: hardwarePanel.height - clip: true - HardwareButtonsView { id: hardwarePanel } - } - - HMIProxy { - HmiApi.ButtonsProxy { - id: sdlButtons - objectName: "Buttons" - } - HmiApi.BasicCommunicationProxy { - id: sdlBasicCommunication - objectName: "BasicCommunication" - } - HmiApi.VRProxy { - id: sdlVR - objectName: "VR" - } - HmiApi.TTSProxy { - id: sdlTTS - objectName: "TTS" - } - HmiApi.NavigationProxy { - id: sdlNavigation - objectName: "Navigation" - } - HmiApi.VehicleInfoProxy { - id: sdlVehicleInfo - objectName: "VehicleInfo" - } - HmiApi.UIProxy { - id: sdlUI - objectName: "UI" - } - } - - SDLProxy { - id: sdlProxy - - onAppRegistered: { - dataContainer.addApplication( - { - appName: application.appName, - ngnMediaScreenAppName: application.ngnMediaScreenAppName, - icon: application.icon, - deviceName: application.deviceName, - appId: application.appId, - hmiDisplayLanguageDesired: application.hmiDisplayLanguageDesired, - isMediaApplication: application.isMediaApplication, - appType: application.appType, - hmiUIText: { }, - mediaClock: { - "updateMode": Internal.MediaClockUpdateMode.MCU_COUNTUP, - "runningMode": Internal.MediaClockRunningMode.MCR_STOPPED, - "startTime": -1, - "endTime": -1, - "startTimeForProgress": -1 - } - }); - } - - onAppUnregistered: { - console.debug("enter") - dataContainer.removeApplication(appId); - if ((dataContainer.currentApplication.appId === appId)) { - if (dataContainer.applicationContext) { - contentLoader.go("views/ApplicationListView.qml"); - } - if (contentLoader.viewTransitionStack.filter(function(x) { return x.applicationContext })) { - contentLoader.reset(); - } - dataContainer.currentApplication.reset() - } - console.debug("exit") - } - - onPlayTone: { - beep.play() - } - - } - - Component.onCompleted: { - dataContainer.hmiVRAvailable = true - dataContainer.hmiTTSAvailable = true - dataContainer.hmiNavigationAvailable = true - dataContainer.hmiVehicleInfoAvailable = true - dataContainer.hmiUIAvailable = true - - sdlBasicCommunication.onReady() - } - - /* - * Test Support Section - * - */ - function getSlider(){ - return sliderPopup - } - - function getDataStorage(){ - return dataContainer - } - - function getUIProxy(){ - return sdlUI - } - - function getMainScreen(){ - return mainScreen - } - - function getContentLoader(){ - return contentLoader - } - - function getWarningInfo(){ - return warningInfo - } - /* - * Test Support Section End - */ -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/ArrowKeys.qml b/src/components/qt_hmi/qml_model_qt4/controls/ArrowKeys.qml deleted file mode 100644 index 4f33960127..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/ArrowKeys.qml +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @file ArrowKeys.qml - * @brief Keys with arrow for cursor movement. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common - -Item { - width: buttonOk.width - height: buttonOk.height - - HardwareButton { - id: arrowUp - buttonId: Common.ButtonName.TUNEUP - name: "Up" - } - HardwareButton { - id: arrowDown - buttonId: Common.ButtonName.TUNEDOWN - name: "Down" - } - HardwareButton { - id: arrowLeft - buttonId: Common.ButtonName.SEEKLEFT - name: "Left" - } - HardwareButton { - id: arrowRight - buttonId: Common.ButtonName.SEEKRIGHT - name: "Right" - } - HardwareButton { - id: buttonOk - buttonId: Common.ButtonName.OK - name: "Ok" - longPressAvailable: false - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/BackButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/BackButton.qml deleted file mode 100644 index 906b3098ba..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/BackButton.qml +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file BackButton.qml - * @brief Button "Back" that return to previous menu. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -OvalButton { - text: "Back" - onClicked: { contentLoader.back() } - fontSize: Constants.fontSize - opacity: 0 - - NumberAnimation on opacity { - to: 1; - duration: Constants.animationDuration - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/CheckBox.qml b/src/components/qt_hmi/qml_model_qt4/controls/CheckBox.qml deleted file mode 100644 index 39d693b971..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/CheckBox.qml +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file CheckBox.qml - * @brief Check box - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Item { - property alias text: text.text - property alias color: text.color - property bool checked: false - - signal clicked - - onCheckedChanged: { - selector.color = checked ? Constants.primaryColorPressed : Constants.transparentColor - } - - height: checkbox.height + Constants.generalSpacing / 2 - width: checkbox.width + text.width + 1.5 * Constants.generalSpacing - - MouseArea { - anchors.fill: parent - onClicked: { checked = !checked; parent.clicked() } - } - Rectangle { - id: checkbox - width: text.font.pixelSize + Constants.generalSpacing / 2 - height: width - anchors.left: parent.left - border.color: Constants.controlsBorderColor - border.width: Constants.controlsBorderWidth - color: Constants.panelTextColor - radius: Constants.controlsRadius - Rectangle { - id: selector - anchors.fill: parent - anchors.margins: checkbox.width / 8 - color: Constants.transparentColor - } - } - Text { - id: text - anchors.left: checkbox.right - anchors.leftMargin: Constants.generalSpacing - anchors.verticalCenter: checkbox.verticalCenter - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/CircleButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/CircleButton.qml deleted file mode 100644 index 818f07ffc5..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/CircleButton.qml +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @file CircleButton.qml - * @brief Parent class for circle button. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Image { - id: circleBtn - source: imgOff - property alias text: btnText.text - property alias pixelSize: btnText.font.pixelSize - property string dest: "" - property bool isPressed: false - property string imgOff: "../res/buttons/round_btn.png" - property string imgOn: "../res/buttons/round_pressed_btn.png" - property string textColorOnPressed: Constants.secondaryColor - property string textColorDefault: Constants.primaryColor - - signal clicked() - function wasClicked() - { - clicked() - } - - Text { - anchors.centerIn: parent - id: btnText - color: textColorDefault - } - - MouseArea { - anchors.fill: parent - onPressed: { - console.log("CircleButton onPressed enter"); - source = imgOn - btnText.color = textColorOnPressed - isPressed = true - console.log("CircleButton onPressed exit"); - } - onReleased: { - console.log("CircleButton onReleased enter"); - source = imgOff - btnText.color = textColorDefault - isPressed = false - console.log("CircleButton onReleased exit"); - } - onClicked: { - console.log("CircleButton onClicked enter"); - if(dest !== ""){ - contentLoader.go(dest) - } - circleBtn.wasClicked() - console.log("CircleButton onClicked enter"); - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/ClickableImage.qml b/src/components/qt_hmi/qml_model_qt4/controls/ClickableImage.qml deleted file mode 100644 index f35f7c3020..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/ClickableImage.qml +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file ClickableImage.qml - * @brief Clickable image item - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Image { - signal pressed () - signal released () - signal canceled () - signal clicked() - - MouseArea { - anchors.fill: parent - - onPressed: { - parent.scale = Constants.pressedIconScale - parent.pressed() - } - - onReleased: { - parent.scale = 1 - parent.released() - } - - onCanceled: { - parent.scale = 1 - parent.canceled() - } - - onClicked: { - parent.clicked() - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/ClickableText.qml b/src/components/qt_hmi/qml_model_qt4/controls/ClickableText.qml deleted file mode 100644 index e6b9fbf246..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/ClickableText.qml +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file ClickableText.qml - * @brief Clickable text item - * 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. - */ - -import QtQuick 1.1 - -Text { - property string defaultColor - property string pressedColor - signal pressed () - signal released () - signal canceled () - signal clicked () - - color: defaultColor - - MouseArea { - anchors.fill: parent - - onPressed: { - press() - parent.pressed() - } - - onReleased: { - release() - parent.released() - } - - onCanceled: { - release() - parent.canceled() - } - - onClicked: { - parent.clicked() - } - } - - function press () { - color = pressedColor - } - - function release () { - color = defaultColor - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/ClimateControlBtn.qml b/src/components/qt_hmi/qml_model_qt4/controls/ClimateControlBtn.qml deleted file mode 100644 index abd344272c..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/ClimateControlBtn.qml +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @file ClimateControlBtn.qml - * @brief Round button, which is used at climat menu. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Item -{ - id: climateControlBtn - width: climateBtnImg.width - height: climateBtnImg.height - property string name: "" - property string txt: "" - state: "off" - - Image { - id: climateBtnImg - source: climateControlBtn.state === "off" ? "../res/climate/climate_round_off_btn.png" : "../res/climate/climate_round_on_btn.png" - - Image { - id: hoverImg - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - property string st: climateControlBtn.state === "off" ? "_off" : "_on" - source: climateControlBtn.name === "" ? "": "../res/climate/" + climateControlBtn.name + st + ".png" - } - - Text { - id: hoverText - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - text: climateControlBtn.txt - font.pixelSize: Constants.fontSize - color: climateControlBtn.state === "off" ? Constants.primaryColor : Constants.secondaryColor - } - - MouseArea { - anchors.fill: parent - onClicked: { - if(climateControlBtn.state === "on") { - climateControlBtn.state = "off" - climateBtnImg.source = "../res/climate/climate_round_off_btn.png" - if(climateControlBtn.txt != "") { - hoverText.color = Constants.primaryColor - } - if(climateControlBtn.name != "") { - hoverImg.source = "../res/climate/" + climateControlBtn.name + "_off.png" - } - } else { - climateControlBtn.state = "on" - climateBtnImg.source = "../res/climate/climate_round_on_btn.png" - if(climateControlBtn.txt != "") { - hoverText.color = Constants.secondaryColor - } - if(climateControlBtn.name != "") { - hoverImg.source = "../res/climate/" + climateControlBtn.name + "_on.png" - } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/ComboBox.qml b/src/components/qt_hmi/qml_model_qt4/controls/ComboBox.qml deleted file mode 100644 index d5129a2a10..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/ComboBox.qml +++ /dev/null @@ -1,143 +0,0 @@ -/** - * @file ComboBox.qml - * @brief Combo box - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Item { - id: container - width: Constants.defaultComboboxWidth - height: main.height - - property alias model: listView.model - property alias currentIndex: listView.currentIndex - property alias currentText: textMain.text - property string textRole - - function choose(name) { - var count = listView.count - for (var i = 0; i < count; ++i) { - if (name === listView.model.get(i).name) { - listView.currentIndex = i - break - } - } - - textMain.text = name - } - - Rectangle { - id: main - - anchors.left: parent.left - anchors.right: parent.right - height: label.font.pixelSize + Constants.generalSpacing - color: Constants.panelTextColor - border.color: Constants.controlsBorderColor - border.width: Constants.controlsBorderWidth - radius: Constants.controlsRadius - - Text { - id: textMain - anchors.left: parent.left - anchors.right: arrow.left - anchors.top: parent.top - anchors.bottom: parent.bottom - color: Constants.secondaryColor - verticalAlignment: Text.AlignVCenter - anchors.leftMargin: Constants.generalSpacing - anchors.rightMargin: Constants.generalSpacing - elide: Text.ElideRight - } - - Rectangle { - id: arrow - anchors.right: parent.right - height: parent.height; width: height - - color: Constants.panelTextColor - border.color: Constants.controlsBorderColor - border.width: Constants.controlsBorderWidth - radius: Constants.controlsRadius - - Text { - anchors.fill: parent - text: "v" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - color: Constants.secondaryColor - } - } - - MouseArea { - anchors.fill: parent - hoverEnabled: true - onClicked: listView.visible = !listView.visible - } - } - - ScrollableListView { - id: listView - anchors.top: main.bottom - anchors.left: main.left - anchors.right: main.right - height: 150 - visible: false - delegate: Rectangle { - anchors.left: parent.left - anchors.right: parent.right - height: label.font.pixelSize + Constants.generalSpacing - color: Constants.panelTextColor - border.color: Constants.controlsBorderColor - border.width: Constants.controlsBorderWidth - Text { - id: label - anchors.fill: parent - anchors.leftMargin: Constants.generalSpacing - anchors.rightMargin: Constants.generalSpacing - verticalAlignment: Text.AlignVCenter - text: model.name - color: Constants.secondaryColor - elide: Text.ElideRight - } - MouseArea { - anchors.fill: parent - hoverEnabled: true - onClicked: { choose(model.name); listView.visible = false } - onEntered: { parent.color = Constants.primaryColorPressed } - onExited: { parent.color = Constants.panelTextColor } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/GradientRectangle.qml b/src/components/qt_hmi/qml_model_qt4/controls/GradientRectangle.qml deleted file mode 100644 index 7b21bb4567..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/GradientRectangle.qml +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @file GradientRectangle.qml - * @brief Rectangle with gradient. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common - -Rectangle { - property string firstColor: "grey" - property string secondColor: "#2E2E2E" - property alias fontSize: text.font.pixelSize - property alias text: text.text - property int customButtonID - property bool isCustomButton: false - property bool clickProcessed - signal pressed() - signal released() - - radius: 5 - border.color: "#D3D3D3" - - Text { - id: text - anchors.fill: parent - font.pixelSize: Constants.titleFontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight - } - - MouseArea { - anchors.fill: parent - - onPressed: { - firstColor = "#2E2E2E" - secondColor = "grey" - parent.pressed() - } - onReleased: { - firstColor = "grey" - secondColor = "#2E2E2E" - parent.released() - } - } - - Timer { - id: timer - interval: Constants.customButtonTimer - repeat: false - triggeredOnStart: false - } - - onPressed: { - if (isCustomButton) { - timer.start() - clickProcessed = false - sdlButtons.onButtonEvent(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonEventMode.BUTTONDOWN, customButtonID) - } - } - - onReleased: { - if (isCustomButton) { - sdlButtons.onButtonEvent(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonEventMode.BUTTONUP, customButtonID) - timer.stop() - if (!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonPressMode.SHORT, customButtonID) - } - } - } - - Connections { - target: timer - onTriggered: { - if (isCustomButton) { - if(!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonPressMode.LONG, customButtonID) - clickProcessed = true - } - } - } - } - - gradient: Gradient { - GradientStop { - position: 0.1 - color: firstColor - } - GradientStop { - position: 0.5 - color: secondColor - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/GridItem.qml b/src/components/qt_hmi/qml_model_qt4/controls/GridItem.qml deleted file mode 100644 index 84528ab800..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/GridItem.qml +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file GridItem.qml - * @brief Item with animation for GridMenu - * 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. - */ -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Item { - id: item - opacity: 0 - SequentialAnimation { - id: animation - PauseAnimation {duration: index * 100 } - NumberAnimation { - target: item - duration: Constants.animationDuration - property: "opacity" - from: 0; to: 1; - } - } - Component.onCompleted: { - animation.start() - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/HardwareButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/HardwareButton.qml deleted file mode 100644 index ea8e406c6e..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/HardwareButton.qml +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @file HardwareButton.qml - * @brief Parent class for hardware button. - * 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. - */ - -import QtQuick 1.1 -import com.ford.sdl.hmi.hw_buttons 1.0 -import "../hmi_api/Common.js" as Common - -MaskedContainer { - property string name - property int buttonId: Common.ButtonName.CUSTOM_BUTTON - property bool upDownAvailable: true - property bool shortPressAvailable: true - property bool longPressAvailable: true - - signal hold - - Image { - source: "../res/controlButtons/" + name + "Button.png" - } - Image { - id: pressedImg - source: "../res/controlButtons/" + name + "Button_pressed.png" - visible: false - Behavior on opacity { - NumberAnimation { duration: 80 } - } - } - Timer { - id: timer - interval: 2000 - repeat: false - triggeredOnStart: false - } - property bool clickProcessed - onPressed: { - clickProcessed = false - pressedImg.visible = true - timer.start() - if (upDownAvailable) { - sdlButtons.onButtonEvent(buttonId, Common.ButtonEventMode.BUTTONDOWN, undefined) - } - } - - onReleased: { - if (upDownAvailable) { - sdlButtons.onButtonEvent(buttonId, Common.ButtonEventMode.BUTTONUP, undefined) - } - timer.stop() - if (!clickProcessed && shortPressAvailable) { - sdlButtons.onButtonPress(buttonId, Common.ButtonPressMode.SHORT, undefined) - } - pressedImg.visible = false - } - - Connections { - target: timer - onTriggered: { - if(!clickProcessed && longPressAvailable) { - sdlButtons.onButtonPress(buttonId, Common.ButtonPressMode.LONG, undefined) - clickProcessed = true - hold() - } - } - } - - Component.onCompleted: { - if (buttonId !== Common.ButtonName.CUSTOM_BUTTON) { - settingsContainer.buttonCapabilities.push( - { - name: buttonId, - upDownAvailable: upDownAvailable, - shortPressAvailable: shortPressAvailable, - longPressAvailable: longPressAvailable - }); - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/HeaderMenu.qml b/src/components/qt_hmi/qml_model_qt4/controls/HeaderMenu.qml deleted file mode 100644 index 2b0b418c54..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/HeaderMenu.qml +++ /dev/null @@ -1,134 +0,0 @@ -/** - * @file HeaderMenu.qml - * @brief Header menu view. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Item { - id: headerMenu - anchors.fill: parent - - Text { - anchors.leftMargin: Constants.margin - anchors.topMargin: Constants.margin - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - text: "75°" - } - - Item { - width: menuText.width - height: parent.height - anchors.topMargin: Constants.margin - anchors.horizontalCenter: headerMenu.horizontalCenter - signal clicked () - - ClickableText { - id: menuLogo - anchors.horizontalCenter: menuText.horizontalCenter - anchors.bottom: parent.verticalCenter - text: "≡" - defaultColor: Constants.primaryColor - pressedColor: Constants.primaryColorPressed - font.pixelSize: Constants.fontSize - - onClicked: parent.clicked() - onPressed: menuLogo.press() - onReleased: menuLogo.release() - onCanceled: menuLogo.release() - } - - ClickableText { - id: menuText - anchors.top: parent.verticalCenter - text: "MENU"; - defaultColor: Constants.primaryColor - pressedColor: Constants.primaryColorPressed - font.pixelSize: Constants.fontSize - - onClicked: parent.clicked() - onPressed: menuText.press() - onReleased: menuText.release() - onCanceled: menuText.release() - } - - onClicked: { - contentLoader.go("./views/MainMenuView.qml") - } - } - - Row { - id: clock - height: childrenRect.height - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.rightMargin: Constants.margin - anchors.topMargin: Constants.margin - property date date: new Date() - - Timer { - running: true - repeat: true - interval: 1000 - onTriggered: { - clock.date = new Date(); - } - } - - Text { - text: Qt.formatTime(clock.date, "hh"); - color: Constants.primaryColor - font.pixelSize: Constants.fontSize; - } - - Item { - width: 10 - height: parent.height - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: clock.date.getSeconds() % 2 ? ":" : "" - color: Constants.primaryColor - font.pixelSize: Constants.fontSize; - } - } - - Text { - text: Qt.formatTime(clock.date, "mm"); - color: Constants.primaryColor - font.pixelSize: Constants.fontSize; - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/Icon.qml b/src/components/qt_hmi/qml_model_qt4/controls/Icon.qml deleted file mode 100644 index d0bfdba78b..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/Icon.qml +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file Navigation.qml - * @brief Icon. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common - -Item { - property variant source - - Image { - anchors.fill: parent - source: url(parent.source) - - function image(turnIcon) { - if (turnIcon && turnIcon.imageType === Common.ImageType.STATIC) { - return turnIcon.value; - } else { - return ""; - } - } - - function url(turnIcon) { - if (turnIcon && turnIcon.imageType === Common.ImageType.DYNAMIC) { - return turnIcon.value; - } else { - return ""; - } - } - } - - function reset () { - source = undefined - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/ListItem.qml b/src/components/qt_hmi/qml_model_qt4/controls/ListItem.qml deleted file mode 100644 index c87c24de4d..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/ListItem.qml +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @file Entry.qml - * @brief Entry with icon and text for list. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Rectangle { - id: main - color: Constants.transparentColor - - property alias text: label.text - property alias fontSize: label.font.pixelSize - property alias icon: image.source - - Icon { - id: image - width: Constants.iconItemListSize - height: Constants.iconItemListSize - anchors.left: parent.left - anchors.leftMargin: Constants.generalSpacing - anchors.verticalCenter: parent.verticalCenter - visible: source ? true : false - } - Text { - id: label - anchors.verticalCenter: parent.verticalCenter - height: image.height - width: parent.width - image.width - z: 50 - verticalAlignment: Text.AlignVCenter - font.pixelSize: Constants.fontSize - text: "Name Entry" - anchors.left: image.right - anchors.leftMargin: Constants.generalSpacing - anchors.verticalCenterOffset: 0 - visible: text !== "" - color: Constants.primaryColor - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/MaskedButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/MaskedButton.qml deleted file mode 100644 index d8a95d1a00..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/MaskedButton.qml +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @file MaskedButton.qml - * @brief Masked button. - * 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. - */ - -import QtQuick 1.1 -import com.ford.sdl.hmi.hw_buttons 1.0 - -MaskedContainer { - property string name - - Image { - id: icon - source: "../res/controlButtons/" + name + "Button.png" - } - - onPressed: { - state = "pressed"; - } - - onReleased: { - state = ""; - } - - states: [ - State { - name: "pressed" - PropertyChanges { - target: icon - source: "../res/controlButtons/" + name + "Button_pressed.png" - } - } - - ] -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/MultiTouchArea.qml b/src/components/qt_hmi/qml_model_qt4/controls/MultiTouchArea.qml deleted file mode 100644 index e86dcedc8f..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/MultiTouchArea.qml +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file MultiTouchArea.qml - * @brief Area for multitouch. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common - -MultiPointTouchArea { - readonly property int created: Date.now() - - signal pressed(var touchPoints) - signal released(var touchPoints) - signal canceled(var touchPoints) - signal updated(var touchPoints) - - function fillEvent(touchPoints) { - var event = [] - for (var i = 0; i < touchPoints.length; ++i) { - event.push({ - id: touchPoints[i].pointId, - ts: [Date.now() - created], - c: [{ x: touchPoints.x, y: touchPoints.y }] // TODO(KKolodiy): need cast to int - }) - } - return event - } - - minimumTouchPoints: 1 - maximumTouchPoints: 10 - - onPressed: { - sdlUI.onTouchEvent(Common.BEGIN, fillEvent(touchPoints)) - parent.pressed(touchPoints) - } - onReleased: { - sdlUI.onTouchEvent(Common.END, fillEvent(touchPoints)) - parent.released(touchPoints) - } - onCanceled: { - sdlUI.onTouchEvent(Common.END, fillEvent(touchPoints)) - parent.canceled(touchPoints) - } - onUpdated: { - sdlUI.onTouchEvent(Common.MOVE, fillEvent(touchPoints)) - parent.updated(touchPoints) - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/OvalButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/OvalButton.qml deleted file mode 100644 index 59458499a7..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/OvalButton.qml +++ /dev/null @@ -1,240 +0,0 @@ -/** - * @file OvalButton.qml - * @brief Oval button with flexible width. - * 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. - */ - -import QtQuick 1.1 -import com.ford.sdl.hmi.hw_buttons 1.0 -import "../models/Constants.js" as Constants - -// Don't change constants. It break button -// TODO (dchmerev@luxoft.com): make this comment more clear -// todo (ykazakov): eliminate this problem and remove all such comments - -Item { - id: main - width: dynamic ? field.width + 2 * left.width : Constants.ovalButtonWidth - height: Constants.ovalButtonHeight - - signal clicked; - signal pressed; - signal released; - signal pressAndHold; - property alias text: label.text - property alias fontSize: label.font.pixelSize - property alias icon: image.source - property bool highlighted: false - property bool dynamic: false - property bool disabled: false - property color colorizeColor - property real colorizeStrength - - onDisabledChanged: colorize() - onHighlightedChanged: colorize() - Component.onCompleted: colorize() - - function colorize() { - if (disabled) { - colorizeColor = "gray"; - colorizeStrength = 1; - } else if (highlighted) { - colorizeColor = "cyan"; - colorizeStrength = 1; - } else { - colorizeStrength = 0; - } - } - - Item { - id: buttonBorderImage - visible: true - anchors.fill: parent - Image { - id: left - width: 31 - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.top: parent.top - source: "../res/buttons/oval_btn_left.png" - effect: Colorize { - color: main.colorizeColor - strength: main.colorizeStrength - } - } - - Image { - id: right - width: 31 - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - source: "../res/buttons/oval_btn_right.png" - effect: Colorize { - color: main.colorizeColor - strength: main.colorizeStrength - } - } - - Image { - id: top - height: 10 - anchors.right: parent.right - anchors.rightMargin: 31 - anchors.left: parent.left - anchors.leftMargin: 31 - anchors.top: parent.top - fillMode: Image.TileHorizontally - source: "../res/buttons/oval_btn_top.png" - effect: Colorize { - color: main.colorizeColor - strength: main.colorizeStrength - } - } - - Image { - id: bottom - height: 11 - anchors.right: parent.right - anchors.rightMargin: 31 - anchors.left: parent.left - anchors.leftMargin: 31 - anchors.bottom: parent.bottom - fillMode: Image.TileHorizontally - source: "../res/buttons/oval_btn_bottom.png" - effect: Colorize { - color: main.colorizeColor - strength: main.colorizeStrength - } - } - } - - Rectangle { - id: background - color: Constants.transparentColor - anchors.fill: parent - anchors.rightMargin: 31 - anchors.leftMargin: 31 - anchors.bottomMargin: 10 - anchors.topMargin: 10 - visible: true - effect: Colorize { - color: main.colorizeColor - strength: main.colorizeStrength - } - } - - MouseArea { - id: mousearea - anchors.rightMargin: 15 - anchors.leftMargin: 15 - anchors.bottomMargin: 11 - anchors.topMargin: 10 - anchors.fill: parent - enabled: !parent.disabled - onPressed: { - parent.state = "pressed"; - parent.pressed(); - } - onReleased: { - parent.state = ""; - parent.released(); - } - onClicked: { - parent.clicked(); - } - onPressAndHold: { - parent.pressAndHold(); - } - onCanceled: { - parent.state = ""; - } - } - - Item { - id: field - anchors.fill: background - - Icon { - id: image - width: Constants.iconButtonSize - height: Constants.iconButtonSize - anchors.verticalCenter: parent.verticalCenter - visible: source ? true : false - } - Text { - id: label - width: image.visible ? parent.width - image.width : parent.width - color: Constants.primaryColor - anchors.centerIn: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: Constants.ovalButtonFontSize - visible: true - elide: Text.ElideRight - effect: Colorize { - id: colorizeLabel - color: main.colorizeColor - strength: main.colorizeStrength - } - } - } - - states: [ - State { - name: "pressed" - PropertyChanges { - target: left - source: "../res/buttons/oval_btn_pressed_left.png" - } - - PropertyChanges { - target: right - source: "../res/buttons/oval_btn_pressed_right.png" - } - - PropertyChanges { - target: background - color: Constants.primaryColor - } - - PropertyChanges { - target: label - color: Constants.secondaryColor - } - - PropertyChanges { - target: colorizeLabel - strength: 0 - } - } - ] -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/PagedFlickable.qml b/src/components/qt_hmi/qml_model_qt4/controls/PagedFlickable.qml deleted file mode 100644 index 6d40ad6478..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/PagedFlickable.qml +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file PagedFlickable.qml - * @brief Animated row. - * 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. - */ - -import QtQuick 1.1 - -Item -{ - id: flickablePage - height: container.height + pager.height - default property alias content: containerRow.children - property alias spacing: containerRow.spacing - property int elementWidth - property int snapTo - property int count: 0 - - Flickable { - id: container - anchors.bottom: parent.bottom - maximumFlickVelocity: 1500 - contentWidth: containerRow.width - height: containerRow.height - width: parent.width - interactive: contentWidth > width - - onMovementEnded: { - var rest = contentX % snapTo - var t = 0.25 - if (rest > parent.snapTo / 2) { - rest = rest - parent.snapTo - } - var vel = 2 * rest / t - flickDeceleration = Math.abs(vel) / t - flick(vel, 0) - flickDeceleration = 1500 - } - Row { - id: containerRow - anchors.verticalCenter: parent.verticalCenter - } - } - - Pager { - id: pager - space: 7 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - - pages: { - if ( (container.contentWidth % container.width) >= (flickablePage.elementWidth / 2 + flickablePage.spacing)) { - return Math.ceil(container.contentWidth / container.width) - } - else { - return Math.floor(container.contentWidth / container.width) - } - } - - activePage: { - if (container.contentX <= 0) { - return 0 - } - else if ( (container.contentWidth - container.contentX) < container.width) { - return pages -1 - } - else { - if ( (container.contentX % container.width) >= (flickablePage.elementWidth / 2 + flickablePage.spacing)) { - return Math.ceil(container.contentX / container.width) - } - else if ( (container.contentX % container.width) > 0) { - return Math.floor(container.contentX / container.width) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/Pager.qml b/src/components/qt_hmi/qml_model_qt4/controls/Pager.qml deleted file mode 100644 index 471d932113..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/Pager.qml +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file Pager.qml - * @brief Bubbles that indicate about page switch. - * 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. - */ - -import QtQuick 1.1 - -Row { - id: pager - property int pages - property int activePage: 0 - property int space - property int itemsInRowOnScreen: 3 - - spacing: space - visible: pages !== 1 - - Repeater { - model: pages - Image { - source: index === activePage ? "../res/white_ball.png" : "../res/blue_ball.png" - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/PlayPauseButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/PlayPauseButton.qml deleted file mode 100644 index 825884cc1e..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/PlayPauseButton.qml +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file PlayPauseButton.qml - * @brief Behavior of Play/Pause button. - * 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. - */ - -import QtQuick 1.1 - -Image { - id: playPauseButton - property string sourceOnPressed: "" - property string sourceOnReleased: "" - - signal clicked - - MouseArea { - anchors.fill: parent - onPressed: { - playPauseButton.source = playPauseButton.sourceOnPressed - } - onReleased: { - playPauseButton.source = playPauseButton.sourceOnReleased - } - onClicked: { - playPauseButton.clicked() - } - } - states: [ - State { - name: "Play" - PropertyChanges { - target: playPauseButton - source: "../res/buttons/player_play_btn.png" - sourceOnPressed: "../res/buttons/player_play_pressed_btn.png" - sourceOnReleased: "../res/buttons/player_pause_btn.png" - } - }, - - State { - name: "Pause" - PropertyChanges { - target: playPauseButton - source: "../res/buttons/player_pause_btn.png" - sourceOnPressed: "../res/buttons/player_pause_pressed_btn.png" - sourceOnReleased: "../res/buttons/player_play_btn.png" - } - } - ] -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/PowerSwitchButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/PowerSwitchButton.qml deleted file mode 100644 index 2027e1f592..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/PowerSwitchButton.qml +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @file PowerSwitchBtn.qml - * @brief On/Off button. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Rectangle { - id: powerSwitchBtn - state: "Turn ON" - width: 120 - height: 80 - radius: 5 - property bool pressed; - - gradient: Gradient { - GradientStop { position: pressed ? 1.0 : 0.0; color: "#2c2c2c" } - GradientStop { position: pressed ? 0.0 : 1.0; color: "black" } - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.pressed = true - } - onReleased: { - parent.pressed = false - parent.state = parent.state === "Turn ON" ? "Turn OFF" : "Turn ON" - btnText.text = parent.state - if (parent.state === "Turn OFF") { - contentLoader.reset() - mainScreen.visible = true - warningInfo.showOkButton() - } - } - } - - Text { - id: btnText - color: "red" - text: parent.state - anchors.centerIn: parent - font.pixelSize: Constants.powerButtonFornSize - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/PresetRow.qml b/src/components/qt_hmi/qml_model_qt4/controls/PresetRow.qml deleted file mode 100644 index 1454ed812d..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/PresetRow.qml +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @file PresetRow.qml - * @brief Animated row with radio stations. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Item { - id: presetRow - height: childrenRect.height - property variant presets: [] - property int selectedIndex: 0 - signal presetSelected - signal presetButtonPressed() - signal presetButtonReleased() - signal presetButtonClicked() - signal presetButtonHold() - - Image { - id: circleButton - source: "../res/buttons/preset_pressed_btn.png" - visible: false - enabled: false - } - - PagedFlickable { - width: parent.width - spacing: (width - (circleButton.width * 4)) / 3 - snapTo: spacing + circleButton.width - elementWidth: circleButton.width - - Repeater { - model: presetRow.presets.length - delegate: - Column { - width: circleButton.width - Image { - anchors.horizontalCenter: parent.horizontalCenter - source: presetRow.selectedIndex === index ? "../res/buttons/preset_pressed_btn.png" : "../res/buttons/preset_btn.png" - MouseArea { - anchors.fill: parent - onPressed: { - presetRow.selectedIndex = index; - presetButtonPressed() - } - onReleased: { - presetRow.selectedIndex = index; - presetButtonReleased() - } - onClicked: { - presetRow.selectedIndex = index - presetButtonClicked() - } - onPressAndHold: { - presetRow.selectedIndex = index; - presetButtonHold() - } - } - Text { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - text: index + 1 - font.pixelSize: Constants.fontSize - color: presetRow.selectedIndex === index ? Constants.secondaryColor : Constants.primaryColor - } - } - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: presetRow.presets[index] - font.pixelSize: Constants.fontSize - color: "white" - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/PushButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/PushButton.qml deleted file mode 100644 index 36ee9bbb3f..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/PushButton.qml +++ /dev/null @@ -1,136 +0,0 @@ -/** - * @file PushButton.qml - * @brief Simple button - * 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. - */ - -import QtQuick 1.1 - -Rectangle { - id: toggleButton - width: 160 - height: 40 - radius: 2 - border.width: 2 - border.color: "#000000" - gradient: grUnpressed - - property alias label : label.text - - signal pressed() - signal unpressed() - signal clicked() - - property bool toggleMode: false - - state: "unpressed" - onStateChanged: { - if (state == "pressed") { - pressed(); - } else { - unpressed(); - } - } - - Text { - id: label - color: "white" - text: "PushButton" - font.pixelSize: 18 - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.horizontalCenter: parent.horizontalCenter - anchors.fill: parent - } - MouseArea { - id: mouseArea - - anchors.fill: parent - onPressed: { - if (toggleMode) { - if (parent.state == "unpressed") { - parent.state = "pressed" - } else { - parent.state = "unpressed" - } - } else { - parent.state = "pressed" - } - } - onReleased: { - if (!toggleMode) { - parent.state = "unpressed" - if (mouse.isClick) { - parent.clicked() - } - } - } - } - - states: [ - State { - name: "pressed" - PropertyChanges { - target: toggleButton - gradient: grPressed - } - }, - State { - name: "unpressed" - PropertyChanges { - target: toggleButton - gradient: grUnpressed - } - } - ] - - Gradient { - id: grUnpressed - - GradientStop { position: 0.0; color: "#2c2c2c" } - GradientStop { position: 1.0; color: "#0c0c0c" } - } - - Gradient { - id: grPressed - - GradientStop { position: 0.0; color: "black" } - GradientStop { position: 1.0; color: "black" } - } - - transitions: [ - Transition { - from: "unpressed" - to: "pressed" - reversible: true - } - ] -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/ScrollableListView.qml b/src/components/qt_hmi/qml_model_qt4/controls/ScrollableListView.qml deleted file mode 100644 index cc26c87271..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/ScrollableListView.qml +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file ScrollableListView.qml - * @brief ListView with scrollbar on the right - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -ListView { - clip: true - - Rectangle { - visible: parent.height < parent.contentHeight - anchors.right: parent.right - y: parent.visibleArea.yPosition * parent.height - width: Constants.scrollBarWidth - height: parent.visibleArea.heightRatio * parent.height - color: Constants.primaryColor - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/ScrollableText.qml b/src/components/qt_hmi/qml_model_qt4/controls/ScrollableText.qml deleted file mode 100644 index 82f568414b..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/ScrollableText.qml +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @file ScrollableText.qml - * @brief Text with scrollers if text more than zone - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Item { - property alias text: text.text - clip: true - - Flickable { - id: flickable - anchors.fill: parent - contentWidth: text.width - contentHeight: text.height - - Text { - id: text - color: Constants.popUpBorderColor - font.pixelSize: Constants.ttsFontSize - } - } - Rectangle { - visible: flickable.height < flickable.contentHeight - anchors.right: flickable.right - y: flickable.visibleArea.yPosition * flickable.height - width: Constants.scrollBarWidth - height: flickable.visibleArea.heightRatio * flickable.height - color: Constants.popUpBorderColor - } - Rectangle { - visible: flickable.width < flickable.contentWidth - anchors.bottom: flickable.bottom - x: flickable.visibleArea.xPosition * flickable.width - height: Constants.scrollBarWidth - width: flickable.visibleArea.widthRatio * flickable.width - color: Constants.popUpBorderColor - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/SoftButton.js b/src/components/qt_hmi/qml_model_qt4/controls/SoftButton.js deleted file mode 100644 index 227f638366..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/SoftButton.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file SoftButton.js - * @brief Soft button view constants - * 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. - */ -.pragma library - -var Action = { - doOnClicked: 0, - doOnReleased: 1 -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/SoftButton.qml b/src/components/qt_hmi/qml_model_qt4/controls/SoftButton.qml deleted file mode 100644 index b92cd51263..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/SoftButton.qml +++ /dev/null @@ -1,104 +0,0 @@ -/** - * @file SoftButton.qml - * @brief Soft button view - * 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. - */ -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "SoftButton.js" as SoftButton - -OvalButton { - property variant button - property int appId - visible: !!button - - signal defaultAction; - signal stealFocus; - signal keepContext; - - property int actionOrder: SoftButton.Action.doOnClicked - - highlighted: button ? button.isHighlighted : false - onPressed: { - actionOrder = SoftButton.Action.doOnClicked - sdlButtons.onButtonEvent(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonEventMode.BUTTONDOWN, button.softButtonID) - } - - onReleased: { - if (actionOrder === SoftButton.Action.doOnReleased) { - switch (button.systemAction) { - case Common.SystemAction.DEFAULT_ACTION: - defaultAction(); - break; - case Common.SystemAction.STEAL_FOCUS: - if (dataContainer.currentApplication.isMediaApplication) { - contentLoader.go("views/SDLPlayerView.qml", appId); - } else { - contentLoader.go("views/SDLNonMediaView.qml", appId); - } - stealFocus(); - break; - case Common.SystemAction.KEEP_CONTEXT: - keepContext(); - break; - } - } - - sdlButtons.onButtonEvent(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonEventMode.BUTTONUP, button.softButtonID) - } - - onClicked: { - sdlButtons.onButtonPress(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonPressMode.SHORT, button.softButtonID); - switch (button.systemAction) { - case Common.SystemAction.DEFAULT_ACTION: - defaultAction(); - break; - case Common.SystemAction.STEAL_FOCUS: - if (dataContainer.currentApplication.isMediaApplication) { contentLoader.go("views/SDLPlayerView.qml", appId); } - else { contentLoader.go("views/SDLNonMediaView.qml", appId); } - stealFocus(); - break; - case Common.SystemAction.KEEP_CONTEXT: - keepContext(); - break; - } - } - - onPressAndHold: { - actionOrder = SoftButton.Action.doOnReleased; // action should be triggered on release - sdlButtons.onButtonPress(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonPressMode.LONG, button.softButtonID); - } - - onButtonChanged: { - icon = button && button.type !== Common.SoftButtonType.SBT_TEXT ? button.image : undefined; - text = button && button.type !== Common.SoftButtonType.SBT_IMAGE ? button.text : "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/controls/StatusBar.qml b/src/components/qt_hmi/qml_model_qt4/controls/StatusBar.qml deleted file mode 100644 index a6d7640f36..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/controls/StatusBar.qml +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file StatusBar.qml - * @brief Status bar that contains text string. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Text { - text: dataContainer.currentApplication.hmiUIText.statusBar - color: Constants.primaryColor - font.pixelSize: Constants.statusBarFontSize -} diff --git a/src/components/qt_hmi/qml_model_qt4/hmi_api/Async.js b/src/components/qt_hmi/qml_model_qt4/hmi_api/Async.js deleted file mode 100644 index ebc5bfa3ca..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/hmi_api/Async.js +++ /dev/null @@ -1,7 +0,0 @@ -.pragma library - -var async_uid = 1; - -function AsyncCall() { - this.__async_uid = async_uid++; -} diff --git a/src/components/qt_hmi/qml_model_qt4/hmi_api/BasicCommunication.qml b/src/components/qt_hmi/qml_model_qt4/hmi_api/BasicCommunication.qml deleted file mode 100644 index 9d7e0432f2..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/hmi_api/BasicCommunication.qml +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @file BasicCommunication.qml - * @brief Implement of interface Basic Communication. - * 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. - */ - -import QtQuick 1.1 - -Item { - function updateDeviceList (deviceList) { - dataContainer.deviceList.clear(); - for(var i = 0; i < deviceList.length; i++) { - dataContainer.deviceList.append({ name: deviceList[i].name, devid: deviceList[i].id }) - } - } - - function updateAppList (applications) { - dataContainer.applicationList.clear(); - for(var i = 0; i < applications.length; i++) { - dataContainer.applicationList.append({ - appName: applications[i].appName, - ngnMediaScreenAppName: applications[i].ngnMediaScreenAppName, - icon: applications[i].icon, - deviceName: applications[i].deviceName, - appId: applications[i].appID, - hmiDisplayLanguageDesired: applications[i].hmiDisplayLanguageDesired, - isMediaApplication: applications[i].isMediaApplication, - appType: applications[i].appType - }); - } - } - - function allowDeviceToConnect (device) { - return { - allow: true - } - } - - function mixingAudioSupported() { - return { - attenuatedSupport: true - } - } - - function allowAllApps() { - return { - allowed: true - } - } - - function allowApp(app, appPermissions) { - return { - allowed: true - } - } - - function activateApp() { - contentLoader.go("views/SDLPlayerView.qml", appID); - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/hmi_api/Buttons.qml b/src/components/qt_hmi/qml_model_qt4/hmi_api/Buttons.qml deleted file mode 100644 index 83ea933eda..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/hmi_api/Buttons.qml +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file Buttons.qml - * @brief Implement of interface Buttons. - * 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. - */ - -import QtQuick 1.1 - -Item -{ - function getCapabilities() - { - return { - capabilities: settingsContainer.buttonCapabilities, - presetBankCapabilities: { - onScreenPresetsAvailable: true - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/hmi_api/Navigation.qml b/src/components/qt_hmi/qml_model_qt4/hmi_api/Navigation.qml deleted file mode 100644 index 3ec131c8c1..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/hmi_api/Navigation.qml +++ /dev/null @@ -1,127 +0,0 @@ -/** - * @file Navigation.qml - * @brief Navigation. - * 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. - */ - -import QtQuick 1.1 -import "Common.js" as Common - -Item { - function isReady () { - return { - available: dataContainer.hmiNavigationAvailable - } - } - - function showConstantTBT(navigationTexts, turnIcon, nextTurnIcon, distanceToManeuver, - distanceToManeuverScale, maneuverComplete, - softButtons, appID) { - console.debug("enter") - navigationTexts.forEach(fillTexts); - dataContainer.navigationModel.turnIcon = turnIcon ? turnIcon.value : "" - dataContainer.navigationModel.nextTurnIcon = nextTurnIcon ? nextTurnIcon.value : "" - dataContainer.navigationModel.distanceToManeuver = distanceToManeuver; - dataContainer.navigationModel.distanceToManeuverScale = distanceToManeuverScale; - if (maneuverComplete !== undefined) { - dataContainer.navigationModel.maneuverComplete = maneuverComplete; - } - if (softButtons !== undefined) { - dataContainer.navigationModel.softButtons.clear(); - softButtons.forEach(fillSoftButtons, dataContainer.navigationModel.softButtons); - } - dataContainer.navigationModel.appId = appID; - contentLoader.go("./views/TurnByTurnView.qml"); - console.debug("exit") - } - - function alertManeuver(softButtons) { - console.debug("enter") - if (softButtons !== undefined) { - dataContainer.navigationModel.alertManeuverSoftButtons.clear(); - softButtons.forEach(fillSoftButtons, dataContainer.navigationModel.alertManeuverSoftButtons); - } - console.debug("exit") - } - - function updateTurnList(turnList, softButtons, appID) { - console.debug("enter") - if (turnList !== undefined) { - dataContainer.getApplication(appID).turnList.clear(); - turnList.forEach(fillTurnList, dataContainer.getApplication(appID).turnList); - } - if (softButtons !== undefined) { - dataContainer.getApplication(appID).turnListSoftButtons.clear(); - softButtons.forEach(fillSoftButtons, dataContainer.getApplication(appID).turnListSoftButtons); - } - dataContainer.navigationModel.appId = appID; - console.debug("exit") - } - - function fillTexts(element, index, array) { - switch (element.fieldName) { - case Common.TextFieldName.navigationText1: - dataContainer.navigationModel.text1 = element.fieldText; - break; - case Common.TextFieldName.navigationText2: - dataContainer.navigationModel.text2 = element.fieldText; - break; - case Common.TextFieldName.ETA: - dataContainer.navigationModel.eta = element.fieldText; - break; - case Common.TextFieldName.totalDistance: - dataContainer.navigationModel.totalDistance = element.fieldText; - break; - case Common.TextFieldName.timeToDestination: - dataContainer.navigationModel.timeToDestination = element.fieldText; - break; - } - } - - function fillSoftButtons(element, index, array) { - this.append({ - type: element.type, - text: element.text, - image: element.image, - isHighlighted: element.isHighlighted, - buttonId: element.softButtonID, - systemAction: element.systemAction - }); - } - - function fillTurnList(element, index, array) { - this.append({ - navigationText: element.navigationText, - turnIcon: element.turnIcon - }); - console.debug(element.navigationText) - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/hmi_api/TTS.qml b/src/components/qt_hmi/qml_model_qt4/hmi_api/TTS.qml deleted file mode 100644 index 96aa9b2c29..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/hmi_api/TTS.qml +++ /dev/null @@ -1,115 +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. - */ - -import QtQuick 1.1 -import "Common.js" as Common -import "Async.js" as Async - -Item { - function isReady() { - return { - available: dataContainer.hmiTTSAvailable - } - } - - function speak(ttsChunks, appID) { - // appID unused - console.debug('enter:', ttsChunks, appID); - if (ttsPopUp.async) { - console.log('speak send abort'); - throw Common.Result.ABORTED; - } - - var message = ttsChunks.map(function(str) { return str.text }).join('\n'); - ttsPopUp.activate(message); - ttsPopUp.async = new Async.AsyncCall(); - console.debug('exit'); - return ttsPopUp.async; - } - - function stopSpeaking() { - console.debug("enter"); - ttsPopUp.deactivate(); - console.debug("exit"); - } - - function getLanguage() { - return { - language: dataContainer.hmiTTSVRLanguage - } - } - - function getSupportedLanguages() { - return { - languages: settingsContainer.sdlLanguagesList - } - } - - function getCapabilities() { - return { - capabilities: Common.SpeechCapabilities.SC_TEXT - } - } - - function changeRegistration(language, appID) { - console.debug("enter:", language, appID); - dataContainer.changeRegistrationTTSVR(language, appID); - console.debug("exit"); - } - - function setGlobalProperties(helpPrompt, timeoutPrompt, appID) { - console.debug("enter: " + helpPrompt + ", " + timeoutPrompt + ", " + appID) - - var newHelpPropmt = helpPrompt ? - helpPrompt.map( - function (structure) { - return structure.text - } - ).join(", ") : - dataContainer.currentApplication.helpPrompt - - var newTimeoutPrompt = timeoutPrompt ? - timeoutPrompt.map( - function (structure) { - return structure.text - } - ).join(", ") : - dataContainer.currentApplication.timeoutPrompt - - dataContainer.setApplicationProperties(dataContainer.currentApplication.appId, { - helpPrompt: newHelpPropmt, - timeoutPrompt: newTimeoutPrompt - }) - console.debug("exit") - } -} - diff --git a/src/components/qt_hmi/qml_model_qt4/hmi_api/UI.qml b/src/components/qt_hmi/qml_model_qt4/hmi_api/UI.qml deleted file mode 100644 index 648cd1397f..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/hmi_api/UI.qml +++ /dev/null @@ -1,449 +0,0 @@ -/** - * @file UI.qml - * @brief UI interface implementation. - * 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. - */ - -import QtQuick 1.1 -import "Common.js" as Common -import "Async.js" as Async -import "../models/Internal.js" as Internal - -Item { - function filter (strings, fields) { - console.debug("enter") -// substrings for each allowed field - var fieldSubstrings = {} -// this cycle concatenates allowed lines sorting them by field - for (var stringIndex = 0; stringIndex < strings.length; ++stringIndex) { - for (var fieldIndex = 0; fieldIndex < fields.length; ++fieldIndex) { - var fieldName = strings[stringIndex].fieldName - if (fieldName === fields[fieldIndex]) { - if (fieldSubstrings[fieldName] !== undefined) { - fieldSubstrings[fieldName] += "\n"; - fieldSubstrings[fieldName] += strings[stringIndex].fieldText - } - else { - fieldSubstrings[fieldName] = strings[stringIndex].fieldText - } - } - } - } - console.debug("exit") - return fieldSubstrings - } - - function alert (alertStrings, duration, softButtons, progressIndicator, appID) { - var fieldSubstrings = alertStrings - .sort(function(a, b) { return a.fieldName - b.fieldName }) // sorting by fieldName - .map(function(val) { return val.fieldText }); // mapping to array of strings - - var tryAgainTime = alertWindow.alert(fieldSubstrings, duration, progressIndicator, softButtons, appID) - if (tryAgainTime === undefined) { - alertWindow.async = new Async.AsyncCall(); - return alertWindow.async; - } - else { - return { - "__retCode": Common.Result.REJECTED, - "tryAgainTime": tryAgainTime - } - } - } - - function show (showStrings, alignment, graphic, softButtons, customPresets, appID) { - console.debug("enter: " + showStrings + ", " + alignment + ", " + graphic + ", "+ softButtons + ", " + customPresets + ", " + appID) - var app = dataContainer.getApplication(appID); - - if (softButtons) { - app.softButtons.clear() - softButtons.forEach(function(x) { app.softButtons.append(x); }); - } - - if (customPresets) { - app.customPresets.clear() - customPresets.forEach( function(x) { app.customPresets.append( {text: x} ); } ) - } - - var textAlignment - switch (alignment) { - case Common.TextAlignment.LEFT_ALIGNED: - textAlignment = Text.AlignLeft - break; - case Common.TextAlignment.RIGHT_ALIGNED: - textAlignment = Text.AlignRight - break; - case Common.TextAlignment.CENTERED: - textAlignment = Text.AlignHCenter - break; - default: - textAlignment = Text.AlignHCenter - break; - } - - // with this array we grab only the lines we need - var showFields = [ - Common.TextFieldName.mainField1, - Common.TextFieldName.mainField2, - Common.TextFieldName.mainField3, - Common.TextFieldName.mainField4, - Common.TextFieldName.statusBar, - Common.TextFieldName.mediaClock, - Common.TextFieldName.mediaTrack - ] - var fieldSubstrings = filter(showStrings, showFields) - var showData = { hmiUIText: {} } - if (fieldSubstrings[Common.TextFieldName.mainField1] !== undefined) { showData.hmiUIText.mainField1 = fieldSubstrings[Common.TextFieldName.mainField1]; } - if (fieldSubstrings[Common.TextFieldName.mainField2] !== undefined) { showData.hmiUIText.mainField2 = fieldSubstrings[Common.TextFieldName.mainField2]; } - if (fieldSubstrings[Common.TextFieldName.mainField3] !== undefined) { showData.hmiUIText.mainField3 = fieldSubstrings[Common.TextFieldName.mainField3]; } - if (fieldSubstrings[Common.TextFieldName.mainField4] !== undefined) { showData.hmiUIText.mainField4 = fieldSubstrings[Common.TextFieldName.mainField4]; } - if (fieldSubstrings[Common.TextFieldName.statusBar] !== undefined) { showData.hmiUIText.statusBar = fieldSubstrings[Common.TextFieldName.statusBar]; } - if (fieldSubstrings[Common.TextFieldName.mediaTrack] !== undefined) { showData.hmiUIText.mediaTrack = fieldSubstrings[Common.TextFieldName.mediaTrack]; } - if (graphic) { showData.hmiUIText.image = graphic.value; } - if (textAlignment) { showData.hmiUITextAlignment = textAlignment; } - if (fieldSubstrings[Common.TextFieldName.mediaClock]) { - showData.mediaClock = { - "updateMode": Internal.MediaClockUpdateMode.MCU_COUNTUP, - "runningMode": Internal.MediaClockRunningMode.MCR_STOPPED, - "magic": Internal.stringToHmsTime(fieldSubstrings[Common.TextFieldName.mediaClock]), - "total": 0 - } - } - - dataContainer.setApplicationProperties(appID, showData); - console.debug("exit") - } - - function addCommand (cmdID, menuParams, cmdIcon, appID) { - dataContainer.addCommand(cmdID, menuParams, cmdIcon, appID) - } - - function deleteCommand (cmdID, appID) { - dataContainer.deleteCommand(cmdID, appID) - } - - function addSubMenu (menuID, menuParams, appID) { - dataContainer.addSubMenu(menuID, menuParams, appID) - } - - function deleteSubMenu (menuID, appID) { - dataContainer.deleteSubMenu(menuID, appID) - } - - function performInteraction (initialText, choiceSet, vrHelp, timeout, appID) { - console.debug("enter") - var async = dataContainer.interactionModel.performInteraction(initialText, choiceSet, vrHelp, timeout, appID) - console.debug("exit") - return async - } - - function setMediaClockTimer (startTime, endTime, updateMode, appID) { - console.debug("enter: {", startTime, ", ", endTime, ", ", updateMode, ", ", appID, "}") - - var app = dataContainer.getApplication(appID) - var newStartTime - var newEndTime - var newUpdateMode - var newRunningMode - var newStartTimeForProgress - var resultCode - var sendErrorResponce = false - - switch (updateMode) { - case Common.ClockUpdateMode.COUNTUP: - if (startTime === undefined) { - resultCode = Common.Result.INVALID_DATA - sendErrorResponce = true - break - } - newStartTime = Internal.hmsTime(startTime.hours, startTime.minutes, startTime.seconds) - newEndTime = endTime ? Internal.hmsTime(endTime.hours, endTime.minutes, endTime.seconds) : -1 - newUpdateMode = Internal.MediaClockUpdateMode.MCU_COUNTUP - newRunningMode = Internal.MediaClockRunningMode.MCR_RUNNING - newStartTimeForProgress = Internal.hmsTime(startTime.hours, startTime.minutes, startTime.seconds) - resultCode = Common.Result.SUCCESS - break - - case Common.ClockUpdateMode.COUNTDOWN: - if (startTime === undefined) { - resultCode = Common.Result.INVALID_DATA - sendErrorResponce = true - break - } - newStartTime = Internal.hmsTime(startTime.hours, startTime.minutes, startTime.seconds) - newEndTime = endTime ? Internal.hmsTime(endTime.hours, endTime.minutes, endTime.seconds) : -1 - newUpdateMode = Internal.MediaClockUpdateMode.MCU_COUNTDOWN - newRunningMode = Internal.MediaClockRunningMode.MCR_RUNNING - newStartTimeForProgress = Internal.hmsTime(startTime.hours, startTime.minutes, startTime.seconds) - resultCode = Common.Result.SUCCESS - break - - case Common.ClockUpdateMode.PAUSE: - // Already paused or cleared - if ((app.mediaClock.runningMode === Internal.MediaClockRunningMode.MCR_STOPPED) - || (app.mediaClock.startTime === -1 && app.mediaClock.endTime === -1)) { - resultCode = Common.Result.IGNORED - sendErrorResponce = true - break - } - newStartTime = app.mediaClock.startTime - newEndTime = app.mediaClock.endTime - newRunningMode = Internal.MediaClockRunningMode.MCR_STOPPED - newUpdateMode = app.mediaClock.updateMode - newStartTimeForProgress = app.mediaClock.startTime - resultCode = Common.Result.SUCCESS - break - - case Common.ClockUpdateMode.RESUME: - // Already resumed or cleared - if ((app.mediaClock.runningMode === Internal.MediaClockRunningMode.MCR_RUNNING) - || (app.mediaClock.startTime === -1 && app.mediaClock.endTime === -1)) { - resultCode = Common.Result.IGNORED - sendErrorResponce = true - break - } - newStartTime = app.mediaClock.startTime - newEndTime = app.mediaClock.endTime - newRunningMode = Internal.MediaClockRunningMode.MCR_RUNNING - newStartTimeForProgress = app.mediaClock.startTime - newUpdateMode = app.mediaClock.updateMode - resultCode = Common.Result.SUCCESS - break - - case Common.ClockUpdateMode.CLEAR: - newStartTime = -1 - newEndTime = -1 - newRunningMode = Internal.MediaClockRunningMode.MCR_STOPPED - newUpdateMode = app.mediaClock.updateMode - newStartTimeForProgress = -1 - resultCode = Common.Result.SUCCESS - break - } - - if (sendErrorResponce) { - console.debug("exit with result code: ", resultCode) - return { __retCode: resultCode } - } - - dataContainer.setApplicationProperties(appID, { - "mediaClock": { - "updateMode": newUpdateMode, - "runningMode": newRunningMode, - "startTime": newStartTime, - "endTime": newEndTime, - "startTimeForProgress": newStartTimeForProgress - } - }) - - console.debug("exit") - return { __retCode: resultCode } - } - - function setGlobalProperties (vrHelpTitle, vrHelp, menuTitle, menuIcon, keyboardProperties, appID) { - console.debug("enter: " + vrHelpTitle + ", " + vrHelp + ", " + menuTitle + ", " + menuIcon + ", " + keyboardProperties + ", " + appID) - if (vrHelpTitle) { - vrHelpPopup.title = vrHelpTitle - } - dataContainer.setVrHelp(vrHelp) - console.debug("exit") - } - - function showVrHelp (vrHelpTitle, vrHelp, appID) { - console.debug("enter: " + vrHelpTitle + ", " + vrHelp + ", " + appID) - if (vrHelpTitle) { - vrHelpPopup.title = vrHelpTitle - } - dataContainer.setVrHelp(vrHelp) - vrHelpPopup.show() - console.debug("exit") - } - - function isReady () { - return { - available: dataContainer.hmiUIAvailable - } - } - - function getLanguage () { - return { - language: dataContainer.hmiUILanguage - } - } - - function getSupportedLanguages () { - return { - languages: settingsContainer.sdlLanguagesList - } - } - - function changeRegistration (language, appID) { - dataContainer.changeRegistrationUI(language, appID) - } - - function setAppIcon (syncFileName, appID) { - dataContainer.setApplicationProperties(appID, { icon: syncFileName.value }) - } - - function slider (numTicks, position, sliderHeader, sliderFooter, timeout, appID) { - console.debug("enter", numTicks, position, sliderHeader, sliderFooter, timeout, appID) - if (dataContainer.uiSlider.running) { - console.debug("aborted") - return {__retCode: Common.Result.ABORTED, sliderPosition: position} - } - - dataContainer.uiSlider.appName = dataContainer.getApplication(appID).appName - dataContainer.uiSlider.header = sliderHeader - dataContainer.uiSlider.footer = sliderFooter - dataContainer.uiSlider.numTicks = numTicks - dataContainer.uiSlider.position = position - dataContainer.uiSlider.timeout = timeout - - if (timeout !== 0) { - sliderPopup.showSlider() - sliderPopup.async = new Async.AsyncCall(); - console.debug("exit") - return sliderPopup.async; - } else { - return { sliderPosition: position } - } - } - - function scrollableMessage (messageText, timeout, softButtons, appID) { - console.debug("scrollableMessage ", messageText, timeout, softButtons, appID) - if(dataContainer.scrollableMessageModel.running){ - //send error response if long message already running - console.debug("scrollableMessage throw") - throw Common.Result.ABORTED - } - - dataContainer.scrollableMessageModel.longMessageText = messageText.fieldText - dataContainer.scrollableMessageModel.softButtons.clear(); - if (softButtons !== undefined) { - softButtons.forEach(fillSoftButtons, dataContainer.scrollableMessageModel.softButtons); - } - dataContainer.scrollableMessageModel.timeout = timeout - dataContainer.scrollableMessageModel.appId = appID - dataContainer.scrollableMessageModel.async = new Async.AsyncCall() - contentLoader.go("./views/ScrollableMessageView.qml") - console.debug("scrollableMessage exit") - return dataContainer.scrollableMessageModel.async - } - - function getCapabilities() { - return { - "audioPassThruCapabilities": { - "samplingRate": Common.SamplingRate.RATE_44KHZ, - "bitsPerSample": Common.BitsPerSample.RATE_8_BIT, - "audioType": Common.AudioType.PCM - }, - "displayCapabilities": settingsContainer.displayCapabilities, - "hmiZoneCapabilities": Common.HmiZoneCapabilities.FRONT, - "softButtonCapabilities": settingsContainer.softButtonCapabilities - } - } - - function performAudioPassThru (audioPassThruDisplayTexts, timeout, appID) { - console.debug("enter", audioPassThruDisplayTexts, timeout) - - if (dataContainer.uiAudioPassThru.running) { - console.debug("aborted") - throw Common.Result.ABORTED - } - - dataContainer.uiAudioPassThru.appName = dataContainer.getApplication(appID).appName - dataContainer.uiAudioPassThru.timeout = timeout - if (audioPassThruDisplayTexts.length === 2) { - dataContainer.uiAudioPassThru.firstLine = audioPassThruDisplayTexts[0].fieldText - dataContainer.uiAudioPassThru.secondLine = audioPassThruDisplayTexts[1].fieldText - } - performAudioPassThruPopup.async = new Async.AsyncCall(); - performAudioPassThruPopup.showAudioPassThru() - console.debug("exit") - return performAudioPassThruPopup.async; - } - - function endAudioPassThru () { - console.debug("enter") - if (!dataContainer.uiAudioPassThru.running) { - console.debug("rejected") - throw Common.Result.REJECTED - } - DBus.sendReply({__retCode: Common.Result.SUCCESS}) - performAudioPassThruPopup.complete(Common.Result.SUCCESS) - console.debug("exit") - } - - function closePopUp (methodName) { - console.debug("enter") - var popUpToClose - - if (dataContainer.activePopup.length === 0) { - return { __retCode: Common.Result.ABORT, __message: "No active PopUps"} - } - - if (methodName !== undefined) { - popUpToClose = methodName - } else { - popUpToClose = dataContainer.activePopup[dataContain.activePopUp.length - 1] - } - - switch (popUpToClose) { - case "UI.PerformInteraction": - interactionPopup.complete(Common.Result.SUCCESS) - break - case "UI.Slider": - sliderPopup.complete(Common.Result.SUCCESS) - break - case "UI.PerformAudioPassThru": - performAudioPassThruPopup.complete(Common.Result.SUCCESS) - break - case "UI.Alert": - alertWindow.complete(Common.Result.SUCCESS) - break - case "UI.VrHelp": - vrHelpPopup.complete(Common.Result.SUCCESS) - break - } - console.debug("exit") - } - - function fillSoftButtons(element, index, array) { - this.append({ - type: element.type, - text: element.text, - image: element.image, - isHighlighted: element.isHighlighted, - softButtonID: element.softButtonID, - systemAction: element.systemAction - }); - } - -} diff --git a/src/components/qt_hmi/qml_model_qt4/hmi_api/VR.qml b/src/components/qt_hmi/qml_model_qt4/hmi_api/VR.qml deleted file mode 100644 index 37d19f6a46..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/hmi_api/VR.qml +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @file VR.qml - * @brief Implement of interface VR. - * 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. - */ - -import QtQuick 1.1 -import "Common.js" as Common - -Item { - function isReady() { - return { - available: dataContainer.hmiVRAvailable - } - } - - function addCommand(cmdID, vrCommands, appID) { - console.log("VR.AddCommand: cmd ", cmdID, ", app ", appID); - for (var i = 0; i < vrCommands.length; ++i) { - dataContainer.vrCommands.append({ - cmdID: cmdID, - command: vrCommands[i], - appID: appID === undefined ? 0 : appID, - }); - } - console.log("exit") - } - - function deleteCommand(cmdID, appID) { - console.log("VR.DeleteCommand: cmd ", cmdID, ", app ", appID); - for (var i = 0; i < dataContainer.vrCommands.count; ) { - if ((dataContainer.vrCommands.get(i).cmdID === cmdID) && - ((appID === undefined) || (dataContainer.vrCommands.get(i).appID === appID))) { - dataContainer.vrCommands.remove(i); - continue; - } - ++i; - } - console.log("exit") - } - - function getLanguage() { - return { - language: dataContainer.hmiTTSVRLanguage - } - } - - function getSupportedLanguages() { - return { - languages: settingsContainer.sdlLanguagesList - } - } - - function getCapabilities() { - return { - vrCapabilities: [ Common.VrCapabilities.VR_TEXT ] - } - } - - function changeRegistration(language, appID) { - console.debug("enter:", language, appID); - dataContainer.changeRegistrationTTSVR(language, appID); - console.debug("exit"); - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/hmi_api/VehicleInfo.qml b/src/components/qt_hmi/qml_model_qt4/hmi_api/VehicleInfo.qml deleted file mode 100644 index 18f3a1ce9e..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/hmi_api/VehicleInfo.qml +++ /dev/null @@ -1,749 +0,0 @@ -/** - * @file VehicleInfo.qml - * @brief Vehicle information interface realisation. - * 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. - */ - -import QtQuick 1.1 -import "Common.js" as Common - -Item { - function isReady () { - return { - available: dataContainer.hmiVehicleInfoAvailable - } - } - - function getVehicleType() { - return { - "vehicleType": { - "make": "Ford", - "model": "Fiesta", - "modelYear": "2013", - "trim": "SE" - } - } - } - - function getGpsData(appID) { - console.debug("enter") - console.debug("exit") - return { gps: dataContainer.vehicleInfoModel.gps } - } - - function getSpeed(appID) { - console.debug("enter") - console.debug("exit") - return { speed: dataContainer.vehicleInfoModel.speed } - } - - function getRpm(appID) { - console.debug("enter") - console.debug("exit") - return { - rpm: dataContainer.vehicleInfoModel.rpm, - __retCode: Common.Result.DATA_NOT_AVAILABLE - } - } - - function getFuelLevel(appID) { - console.debug("enter") - console.debug("exit") - return { fuelLevel: dataContainer.vehicleInfoModel.fuelLevel } - } - - function getFuelLevelState(appID) { - console.debug("enter") - console.debug("exit") - return { fuelLevel_State: dataContainer.vehicleInfoModel.fuelLevel_State } - } - - function getInstantFuelConsumption(appID) { - console.debug("enter") - console.debug("exit") - return { instantFuelConsumption: dataContainer.vehicleInfoModel.instantFuelConsumption } - } - - function getExternalTemperature(appID) { - console.debug("enter") - console.debug("exit") - return { externalTemperature: dataContainer.vehicleInfoModel.externalTemperature } - } - - function getVin(appID) { - console.debug("enter") - console.debug("exit") - return { vin: dataContainer.vehicleInfoModel.vin } - } - - function getPrndl(appID) { - console.debug("enter") - if (dataContainer.vehicleInfoModel.prndl === -1) { // Test value, to check response - console.debug("exit") - return { - prndl: dataContainer.vehicleInfoModel.prndl, - __retCode: Common.Result.DATA_NOT_AVAILABLE - } - } - console.debug("exit") - return { prndl: dataContainer.vehicleInfoModel.prndl } - } - - function getTirePressure(appID) { - console.debug("enter") - console.debug("exit") - return { tirePressure: dataContainer.vehicleInfoModel.tirePressure } - } - - function getOdometer(appID) { - console.debug("enter") - console.debug("exit") - return { odometer: dataContainer.vehicleInfoModel.odometer } - } - - function getBeltStatus(appID) { - console.debug("enter") - console.debug("exit") - return { beltStatus: dataContainer.vehicleInfoModel.beltStatus } - } - - function getBodyInformation(appID) { - console.debug("enter") - console.debug("exit") - return { bodyInformation: dataContainer.vehicleInfoModel.bodyInformation } - } - - function getDeviceStatus(appID) { - console.debug("enter") - console.debug("exit") - return { deviceStatus: dataContainer.vehicleInfoModel.deviceStatus } - } - - function getDriverBraking(appID) { - console.debug("enter") - console.debug("exit") - return { driverBraking: dataContainer.vehicleInfoModel.driverBraking } - } - - function getWiperStatus(appID) { - console.debug("enter") - console.debug("exit") - return { wiperStatus: dataContainer.vehicleInfoModel.wiperStatus } - } - - function getHeadLampStatus(appID) { - console.debug("enter") - console.debug("exit") - return { headLampStatus: dataContainer.vehicleInfoModel.headLampStatus } - } - - function getEngineTorque(appID) { - console.debug("enter") - console.debug("exit") - return { engineTorque: dataContainer.vehicleInfoModel.engineTorque } - } - - function getAccPedalPosition(appID) { - console.debug("enter") - console.debug("exit") - return { accPedalPosition: dataContainer.vehicleInfoModel.accPedalPosition } - } - - function getSteeringWheelAngle(appID) { - console.debug("enter") - console.debug("exit") - return { steeringWheelAngle: dataContainer.vehicleInfoModel.steeringWheelAngle } - } - - function getECallInfo(appID) { - console.debug("enter") - console.debug("exit") - return { eCallInfo: dataContainer.vehicleInfoModel.eCallInfo } - } - - function getAirbagStatus(appID) { - console.debug("enter") - console.debug("exit") - return { airbagStatus: dataContainer.vehicleInfoModel.airbagStatus } - } - - function getEmergencyEvent(appID) { - console.debug("enter") - console.debug("exit") - return { emergencyEvent: dataContainer.vehicleInfoModel.emergencyEvent } - } - - function getClusterModeStatus(appID) { - console.debug("enter") - console.debug("exit") - return { clusterModeStatus: dataContainer.vehicleInfoModel.clusterModeStatus } - } - - function getMyKey(appID) { - console.debug("enter") - console.debug("exit") - return { myKey: dataContainer.vehicleInfoModel.myKey } - } - - function getDTCs(ecuName, dtcMask, appID) { - var ecuHeader = 2 - var dtc = [] - - for (var i = 0; i < 3; i++) { - dtc.push("line" + i) - } - return {ecuHeader: ecuHeader, dtc: dtc} - } - - function readDID(ecuName, didLocation, appID) { - console.debug("Enter") - //TODO{ALeshin}: refactoring of this function, when we'll have Vehicle Info module - var didResult = [] - - for (var i = 0; i < didLocation.length; i++) { - if (i < 10) { - didResult[i] = {} - didResult[i].resultCode = Common.VehicleDataResultCode.VDRC_SUCCESS - didResult[i].didLocation = didLocation[i] - didResult[i].data = '0' - } - else { - didResult[i] = {} - didResult[i].resultCode = Common.VehicleDataResultCode.VDRC_DATA_NOT_AVAILABLE - didResult[i].didLocation = didLocation[i] - didResult[i].data = '0' - } - } - console.debug("Exit") - return {didResult: didResult} - } - - function subscribeGps(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onGpsChanged.disconnect(model.sendGpsChange) - model.onGpsChanged.connect(model.sendGpsChange) - console.debug("exit") - return {gps: - { dataType: Common.VehicleDataType.VEHICLEDATA_GPS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS} } - } - function unsubscribeGps(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onGpsChanged.disconnect(model.sendGpsChange) - console.debug("exit") - return {gps: - { dataType: Common.VehicleDataType.VEHICLEDATA_GPS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS} } - - } - - function subscribeSpeed(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onSpeedChanged.disconnect(model.sendSpeedChange) - model.onSpeedChanged.connect(model.sendSpeedChange) - console.debug("exit") - return { speed: - { dataType: Common.VehicleDataType.VEHICLEDATA_SPEED, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeSpeed(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onSpeedChanged.disconnect(model.sendSpeedChange) - console.debug("exit") - return { speed: - { dataType: Common.VehicleDataType.VEHICLEDATA_SPEED, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeRpm(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onRpmChanged.disconnect(model.sendRpmChange) - model.onRpmChanged.connect(model.sendRpmChange) - console.debug("exit") - return { rpm: - { dataType: Common.VehicleDataType.VEHICLEDATA_RPM, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeRpm(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onRpmChanged.disconnect(model.sendRpmChange) - console.debug("exit") - return { rpm: - { dataType: Common.VehicleDataType.VEHICLEDATA_RPM, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeFuelLevel(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onFuelLevelChanged.disconnect(model.sendFuelLevelChange) - model.onFuelLevelChanged.connect(model.sendFuelLevelChange) - console.debug("exit") - return { fuelLevel: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELLEVEL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeFuelLevel(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onFuelLevelChanged.disconnect(model.sendFuelLevelChange) - console.debug("exit") - return { fuelLevel: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELLEVEL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeFuelLevel_State(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onFuelLevel_StateChanged.disconnect(model.sendFuelLevel_StateChange) - model.onFuelLevel_StateChanged.connect(model.sendFuelLevel_StateChange) - console.debug("exit") - return { fuelLevel_State: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeFuelLevel_State(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onFuelLevel_StateChanged.disconnect(model.sendFuelLevel_StateChange) - console.debug("exit") - return { fuelLevel_State: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeInstantFuelConsumption(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onInstantFuelConsumptionChanged.disconnect(model.sendInstantFuelConsumptionChange) - model.onInstantFuelConsumptionChanged.connect(model.sendInstantFuelConsumptionChange) - console.debug("exit") - return { instantFuelConsumption: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELCONSUMPTION, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeInstantFuelConsumption(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onInstantFuelConsumptionChanged.disconnect(model.sendInstantFuelConsumptionChange) - console.debug("exit") - return { instantFuelConsumption: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELCONSUMPTION, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeExternalTemperature(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onExternalTemperatureChanged.disconnect(model.sendExternalTemperatureChange) - model.onExternalTemperatureChanged.connect(model.sendExternalTemperatureChange) - console.debug("exit") - return { externalTemperature: - { dataType: Common.VehicleDataType.VEHICLEDATA_EXTERNTEMP, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeExternalTemperature(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onExternalTemperatureChanged.disconnect(model.sendExternalTemperatureChange) - console.debug("exit") - return { externalTemperature: - { dataType: Common.VehicleDataType.VEHICLEDATA_EXTERNTEMP, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribePrndl(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onPrndlChanged.disconnect(model.sendPrndlChange) - model.onPrndlChanged.connect(model.sendPrndlChange) - console.debug("exit") - return { prndl: - { dataType: Common.VehicleDataType.VEHICLEDATA_PRNDL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribePrndl(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onPrndlChanged.disconnect(model.sendPrndlChange) - console.debug("exit") - return { prndl: - { dataType: Common.VehicleDataType.VEHICLEDATA_PRNDL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeVin(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onVinChanged.disconnect(model.sendVinChange) - model.onVinChanged.connect(model.sendVinChange) - console.debug("exit") - return { vin: - { dataType: Common.VehicleDataType.VEHICLEDATA_VIN, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeVin(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onVinChanged.disconnect(model.sendVinChange) - console.debug("exit") - return { vin: - { dataType: Common.VehicleDataType.VEHICLEDATA_VIN, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeTirePressure(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onTirePressureChanged.disconnect(model.sendTirePressureChange) - model.onTirePressureChanged.connect(model.sendTirePressureChange) - console.debug("exit") - return { tirePressure: - { dataType: Common.VehicleDataType.VEHICLEDATA_TIREPRESSURE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeTirePressure(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onTirePressureChanged.disconnect(model.sendTirePressureChange) - console.debug("exit") - return { tirePressure: - { dataType: Common.VehicleDataType.VEHICLEDATA_TIREPRESSURE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeOdometer(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onOdometerChanged.disconnect(model.sendOdometerChange) - model.onOdometerChanged.connect(model.sendOdometerChange) - console.debug("exit") - return { odometer: - { dataType: Common.VehicleDataType.VEHICLEDATA_ODOMETER, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeOdometer(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onOdometerChanged.disconnect(model.sendOdometerChange) - console.debug("exit") - return { odometer: - { dataType: Common.VehicleDataType.VEHICLEDATA_ODOMETER, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeBeltStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onBeltStatusChanged.disconnect(model.sendBeltStatusChange) - model.onBeltStatusChanged.connect(model.sendBeltStatusChange) - console.debug("exit") - return { beltStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_BELTSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeBeltStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onBeltStatusChanged.disconnect(model.sendBeltStatusChange) - console.debug("exit") - return { beltStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_BELTSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeBodyInformation(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onBodyInformationChanged.disconnect(model.sendBodyInformationChange) - model.onBodyInformationChanged.connect(model.sendBodyInformationChange) - console.debug("exit") - return { bodyInformation: - { dataType: Common.VehicleDataType.VEHICLEDATA_BODYINFO, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeBodyInformation(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onBodyInformationChanged.disconnect(model.sendBodyInformationChange) - console.debug("exit") - return { bodyInformation: - { dataType: Common.VehicleDataType.VEHICLEDATA_BODYINFO, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeDeviceStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onDeviceStatusChanged.disconnect(model.sendDeviceStatusChange) - model.onDeviceStatusChanged.connect(model.sendDeviceStatusChange) - console.debug("exit") - return { deviceStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_DEVICESTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeDeviceStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onDeviceStatusChanged.disconnect(model.sendDeviceStatusChange) - console.debug("exit") - return { deviceStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_DEVICESTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeDriverBraking(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onDriverBrakingChanged.disconnect(model.sendDriverBrakingChange) - model.onDriverBrakingChanged.connect(model.sendDriverBrakingChange) - console.debug("exit") - return { driverBraking: - { dataType: Common.VehicleDataType.VEHICLEDATA_BRAKING, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeDriverBraking(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onDriverBrakingChanged.disconnect(model.sendDriverBrakingChange) - console.debug("exit") - return { driverBraking: - { dataType: Common.VehicleDataType.VEHICLEDATA_BRAKING, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeWiperStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onWiperStatusChanged.disconnect(model.sendWiperStatusChange) - model.onWiperStatusChanged.connect(model.sendWiperStatusChange) - console.debug("exit") - return { wiperStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_WIPERSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeWiperStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onWiperStatusChanged.disconnect(model.sendWiperStatusChange) - console.debug("exit") - return { wiperStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_WIPERSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeHeadLampStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onHeadLampStatusChanged.disconnect(model.sendHeadLampStatusChange) - model.onHeadLampStatusChanged.connect(model.sendHeadLampStatusChange) - console.debug("exit") - return { headLampStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeHeadLampStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onHeadLampStatusChanged.disconnect(model.sendHeadLampStatusChange) - console.debug("exit") - return { headLampStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeEngineTorque(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onEngineTorqueChanged.disconnect(model.sendEngineTorqueChange) - model.onEngineTorqueChanged.connect(model.sendEngineTorqueChange) - console.debug("exit") - return { engineTorque: - { dataType: Common.VehicleDataType.VEHICLEDATA_ENGINETORQUE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeEngineTorque(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onEngineTorqueChanged.disconnect(model.sendEngineTorqueChange) - console.debug("exit") - return { engineTorque: - { dataType: Common.VehicleDataType.VEHICLEDATA_ENGINETORQUE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeAccPedalPosition(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onAccPedalPositionChanged.disconnect(model.sendAccPedalPositionChange) - model.onAccPedalPositionChanged.connect(model.sendAccPedalPositionChange) - console.debug("exit") - return { accPedalPosition: - { dataType: Common.VehicleDataType.VEHICLEDATA_ACCPEDAL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeAccPedalPosition(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onAccPedalPositionChanged.disconnect(model.sendAccPedalPositionChange) - console.debug("exit") - return { accPedalPosition: - { dataType: Common.VehicleDataType.VEHICLEDATA_ACCPEDAL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeSteeringWheelAngle(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onSteeringWheelAngleChanged.disconnect(model.sendSteeringWheelAngleChange) - model.onSteeringWheelAngleChanged.connect(model.sendSteeringWheelAngleChange) - console.debug("exit") - return { steeringWheelAngle: - { dataType: Common.VehicleDataType.VEHICLEDATA_STEERINGWHEEL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeSteeringWheelAngle(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onSteeringWheelAngleChanged.disconnect(model.sendSteeringWheelAngleChange) - console.debug("exit") - return { steeringWheelAngle: - { dataType: Common.VehicleDataType.VEHICLEDATA_STEERINGWHEEL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeECallInfo(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onECallInfoChanged.disconnect(model.sendECallInfoChange) - model.onECallInfoChanged.connect(model.sendECallInfoChange) - console.debug("exit") - return { eCallInfo: - { dataType: Common.VehicleDataType.VEHICLEDATA_ECALLINFO, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeECallInfo(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onECallInfoChanged.disconnect(model.sendECallInfoChange) - console.debug("exit") - return { eCallInfo: - { dataType: Common.VehicleDataType.VEHICLEDATA_ECALLINFO, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeAirbagStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onAirbagStatusChanged.disconnect(model.sendAirbagStatusChange) - model.onAirbagStatusChanged.connect(model.sendAirbagStatusChange) - console.debug("exit") - return { airbagStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_AIRBAGSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeAirbagStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onAirbagStatusChanged.disconnect(model.sendAirbagStatusChange) - console.debug("exit") - return { airbagStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_AIRBAGSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeEmergencyEvent(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onEmergencyEventChanged.disconnect(model.sendEmergencyEventChange) - model.onEmergencyEventChanged.connect(model.sendEmergencyEventChange) - console.debug("exit") - return { emergencyEvent: - { dataType: Common.VehicleDataType.VEHICLEDATA_EMERGENCYEVENT, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeEmergencyEvent(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onEmergencyEventChanged.disconnect(model.sendEmergencyEventChange) - console.debug("exit") - return { emergencyEvent: - { dataType: Common.VehicleDataType.VEHICLEDATA_EMERGENCYEVENT, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeClusterModeStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onClusterModeStatusChanged.disconnect(model.sendClusterModeStatusChange) - model.onClusterModeStatusChanged.connect(model.sendClusterModeStatusChange) - console.debug("exit") - return { clusterModeStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeClusterModeStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onClusterModeStatusChanged.disconnect(model.sendClusterModeStatusChange) - console.debug("exit") - return { clusterModeStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeMyKey(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onMyKeyChanged.disconnect(model.sendMyKeyChange) - model.onMyKeyChanged.connect(model.sendMyKeyChange) - console.debug("exit") - return { myKey: - { dataType: Common.VehicleDataType.VEHICLEDATA_MYKEY, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeMyKey(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onMyKeyChanged.disconnect(model.sendMyKeyChange) - console.debug("exit") - return { myKey: - { dataType: Common.VehicleDataType.VEHICLEDATA_MYKEY, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/log4cxx.properties b/src/components/qt_hmi/qml_model_qt4/log4cxx.properties deleted file mode 100644 index 0bc5ac8fdf..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/log4cxx.properties +++ /dev/null @@ -1,41 +0,0 @@ -# Socket logger -log4j.appender.SocketHub=org.apache.log4j.net.SocketHubAppender -log4j.appender.SocketHub.port=4555 -log4j.appender.SocketHub.locationInfo=true - -# Only ERROR and FATAL messages are logged to console -log4j.appender.Console=org.apache.log4j.ConsoleAppender -log4j.appender.Console.ImmediateFlush=true -log4j.appender.Console.layout=org.apache.log4j.PatternLayout -log4j.appender.Console.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %m%n -log4j.appender.Console.Threshold=ERROR - -# Log for all DBus plugin messages -log4j.appender.DBusPluginLogFile=org.apache.log4j.FileAppender -log4j.appender.DBusPluginLogFile.File=DBusPlugin.log -log4j.appender.DBusPluginLogFile.append=false -log4j.appender.DBusPluginLogFile.DatePattern='.' yyyy-MM-dd -log4j.appender.DBusPluginLogFile.ImmediateFlush=true -log4j.appender.DBusPluginLogFile.layout=org.apache.log4j.PatternLayout -log4j.appender.DBusPluginLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n - -# Log for all HMI Framework plugin -log4j.appender.HmiFrameworkPluginLogFile=org.apache.log4j.FileAppender -log4j.appender.HmiFrameworkPluginLogFile.File=HmiFrameworkPlugin.log -log4j.appender.HmiFrameworkPluginLogFile.append=false -log4j.appender.HmiFrameworkPluginLogFile.DatePattern='.' yyyy-MM-dd -log4j.appender.HmiFrameworkPluginLogFile.ImmediateFlush=true -log4j.appender.HmiFrameworkPluginLogFile.layout=org.apache.log4j.PatternLayout -log4j.appender.HmiFrameworkPluginLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n - -# Log for all Qt HMI -log4j.rootLogger=ALL, Console - -# Log for DBus plugin QtHMI -log4j.logger.DBusPlugin=ALL, DBusPluginLogFile - -# Log for HMI Framework plugin -log4j.logger.HmiFrameworkPlugin=ALL, HmiFrameworkPluginLogFile - -# Log by log4cxx plugin -log4j.logger.Log4cxxPlugin=ALL, HmiFrameworkPluginLogFile diff --git a/src/components/qt_hmi/qml_model_qt4/models/ApplicationData.qml b/src/components/qt_hmi/qml_model_qt4/models/ApplicationData.qml deleted file mode 100644 index a50113095c..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/ApplicationData.qml +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file ApplicationData.qml - * @brief Model for Application. - * 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. - */ - -import QtQuick 1.1 - -QtObject { - property string mainField1 - property string mainField2 - property string mainField3 - property string mainField4 - property string statusBar - property string mediaTrack - property string image - - function reset () { - console.debug("enter") - mainField1 = "" - mainField2 = "" - mainField3 = "" - mainField4 = "" - statusBar = "" - mediaTrack = "" - image = "" - console.debug("exit") - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/ApplicationModel.qml b/src/components/qt_hmi/qml_model_qt4/models/ApplicationModel.qml deleted file mode 100644 index 206eaa9185..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/ApplicationModel.qml +++ /dev/null @@ -1,91 +0,0 @@ -/** - * @file ApplicationModel.qml - * @brief Own fields for each application. - * 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. - */ - -import QtQuick 1.1 -import "../controls" - -QtObject { - property int appId - property string appName - property string ngnMediaScreenAppName - property Icon appIcon: Icon { } - property string deviceName - property int hmiDisplayLanguageDesired - property bool isMediaApplication - property variant appType - property int hmiUITextAlignment - - // media player - property string playPauseState - property ApplicationData hmiUIText: ApplicationData { } - property MediaClockModel mediaClock: MediaClockModel { } - - property string helpPrompt - property string timeoutPrompt - property ListModel options: ListModel { } - - property ListModel currentSubMenu: options - property ListModel turnList - property ListModel softButtons - property ListModel turnListSoftButtons - property ListModel customPresets - property int languageTTSVR - // This place is for adding new properties - - function reset () { - console.debug("enter") - appId = -1 - appName = "" - ngnMediaScreenAppName = "" - appIcon.reset() - deviceName = "" - hmiDisplayLanguageDesired = -1 - isMediaApplication = false - appType = undefined - playPauseState = "" - hmiUIText.reset() -// no need to reset mediaClock - helpPrompt = "" - timeoutPrompt = "" - options.clear() - currentSubMenu = options - turnList = null - softButtons = null - turnListSoftButtons = null - customPresets = null - languageTTSVR = -1 - hmiUITextAlignment = null - console.debug("exit") - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/CarMenuModel.qml b/src/components/qt_hmi/qml_model_qt4/models/CarMenuModel.qml deleted file mode 100644 index f636d1e794..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/CarMenuModel.qml +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file CarMenuModel.qml - * @brief Car menu list of elements. - * 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. - */ -import QtQuick 1.1 - -ListModel -{ - ListElement { - name: "ambient" - icon: "../res/vehicle/Ambient Lighti Icon.png" - qml: "" - } - ListElement { - name: "cal" - icon: "../res/vehicle/cal.png" - qml: "" - } - ListElement { - name: "ev" - icon: "../res/vehicle/EV Icon.png" - qml: "" - } - ListElement { - name: "folders" - icon: "../res/vehicle/folders.png" - qml: "" - } - ListElement { - name: "key" - icon: "../res/vehicle/key_car.png" - qml: "" - } - ListElement { - name: "mcs" - icon: "../res/vehicle/MCS Icon.png" - qml: "" - } - ListElement { - name: "sun" - icon: "../res/vehicle/sun.png" - qml: "" - } - ListElement { - name: "sync" - icon: "../res/vehicle/SYNC Services.png" - qml: "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/Constants.js b/src/components/qt_hmi/qml_model_qt4/models/Constants.js deleted file mode 100644 index 1bc5c558ba..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/Constants.js +++ /dev/null @@ -1,249 +0,0 @@ -/** - * @file Constants.js - * @brief Namespace of constants. - * 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. - */ -.pragma library - -// Colors - -// Main color of HMI model(now it ~lightblue). Buttons, text, icons of this color. -var primaryColor = "#1d81d5" - -// Color of pressed buttons, text, icons etc. -var primaryColorPressed = "#8ec0ea" - -// Secondary color of HMI model, backgroud of this color. -var secondaryColor = "black" - -// Color of text at buttonts that are inactive (at phone keyboard, when no any contact started with current letter). -var inactiveButtonTextColor = "grey" - -// Color of text at buttonts that are inactive but nevertheless pressed (at phone keyboard, when no any contact started with current letter). -var inactiveButtonTextColorPressed = "lightgrey" - -// Color of text at contact list screen view (Name, number and number type). -var contactTextColor = "lightblue" - -// Color of text at buttons, when they are pressed. -var pressedButtonTextColor = "black" - -// Color of text at "white" buttons, for all other buttons (which most) use primaryColor. -var releasedButtonTextColor = "white" - -// Transparent background. -var transparentColor = "#00000000" - -// "Warning" word color -var warningColor = "red" - -// Color for PopUp -var popUpBorderColor = "white" - -// Color for hardware and simulation panels -var panelColor = "#003" - -// Color for text in hardware and simulation panels -var panelTextColor = "white" - -// Audio pass thru PopUp text color -var audioPassThruTextColor = "white" - -// Color for border of controls -var controlsBorderColor = "#ababab" - -//-------------------------------------------------------------------------------------- - -// Font sizes of different elements - -// Font size for most of text in HMI model. -var fontSize = 20 - -// Font size for text inside oval buttons. -var ovalButtonFontSize = 15 - -// Title font size -var titleFontSize = 35 - -// Power on/off button font size -var powerButtonFornSize = 25 - -// Font size of status bar -var statusBarFontSize = 15 - -// Size icon for buttons -var iconButtonSize = 30 - -// Size icon for item list -var iconItemListSize = 40 - -// font size fo TTS popup -var ttsFontSize = 12 - -// Font size for list of applications -var appListFontSize = 40 - -// Size of contact list fields -var contactListNameFieldSize = 0.4 -var contactListPhoneFieldSize = 0.3 -var contactListDescriptionFieldSize = 0.3 - -//-------------------------------------------------------------------------------------- - -// Sizes of buttons, menus, screen, etc - -// Minimal width and height of screen (screen wont resize, if height and width are lower). -var mainScreenMinWidth = 800 -var mainScreenMiHeight = 600 - -// Width for long oval button -var ovalButtonWidth = 163 - -// Height for oval button -var ovalButtonHeight = 65 - -// Height item list -var itemListHeight = 60 - -// Width for TTS popup -var ttsPopUpWidth = 250 - -// Height for TTS popup -var ttsPopUpHeight = 100 - -// Width for popup view -var popupWidth = 700 - -// Width for alert window -var alertWidth = 360 - -// Height for popup view -var popupHeigth = 500 - -// Width for combobox -var defaultComboboxWidth = 150 - -// Size icon for list of applications -var appListIconSize = 100 - -// DistanceBar height -var distanceBarHeight = 1 - - -//--------------------------------------------------------------------------------------- - -// Other - -// Offset from the edges of the screen. -var margin = 20 - -// Offset from the edges of the popup -var popupMargin = 15 - -// Spacing between contacts at contact screen view. -var contactListSpacing = 30 - -// Duration of appearance of icon/button at icon/button menus. -var animationDuration = 500 - -// Duration of appearence of "OK" button at warning screen view, when HMI starts. -var warningScreenDuration = 1000 - -// Timer to check how long preset button is pressed. -var presetButtonTimer = 800 - -// Spacing between icon and item in list -var iconItemListSpacing = 20 - -// Spacing between item on views -var generalSpacing = 10 - -// Width of scrollBar -var scrollBarWidth = 5 - -// Speak text for a given time -var ttsSpeakTime = 2000 - -// Maximal number of submenus -var maximumSubmenus = 1000 - -// Maximal number of commands in submenu or root menu -var maximumCommandsPerSubmenu = 1000 - -// padding for popup view -var popUpPadding = 20 - -// Padding for TTS popup -var ttsPopUpPadding = 10 - -// ------------------------- -var sliderBarWidth = 400 -var sliderBarHeight = 50 -var sliderBarRadius = 3 -var sliderBarBorderWidth = 1 -var sliderTextColor = "white" -var sliderBarBorderColor = "white" -var sliderBarFillColor = "white" - -// ------------------------- -var scrollableMessageTextColor = "white" -var scrollableMessageScrollBarColor = "gray" -var scrollableMessageScrollBarWidth = 10 - -// Padding for hardware and simulation panels -var panelPadding = 20 - -// Scale for pressed icon in menu -var pressedIconScale = 1.1 - -// Values of color effect for highlighted button -var highlightedButtonHue = 0.9 -var highlightedButtonSaturation = 0.0 -var highlightedButtonLightness = 0.1 - -// Values of color effect for disabled button -var disabledButtonHue = 0.0 -var disabledButtonSaturation = -1.0 -var disabledButtonLightness = 0.1 - -// Count of rows for grid menu -var menuRowCount = 2 - -// Count of columns for grid menu -var menuColumnCount = 3 - -// Radius of controls -var controlsRadius = 2 - -// Width of border of controls -var controlsBorderWidth = 1 -// Position for element that came without position value (should be always at the end) -var positionOfElementWithoutPosition = 1001 diff --git a/src/components/qt_hmi/qml_model_qt4/models/ContactsListModel.qml b/src/components/qt_hmi/qml_model_qt4/models/ContactsListModel.qml deleted file mode 100644 index 348d30156c..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/ContactsListModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @file ContactsListModel.qml - * @brief List of contacts. - * 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. - */ -import QtQuick 1.1 - -ListModel -{ - // TODO {ALeshin}: This list model should be sorted in ABC and Upper/lower case order, - // when it will be filled dynamically. - ListElement { name: "Aaron" ; phone:"(614)555-2444";type:"Mobile"} - ListElement { name: "Adrian" ; phone:"(740)245-3434";type:"Mobile" } - ListElement { name: "Albert" ; phone:"(614)245-5584";type:"Mobile" } - ListElement { name: "Alice" ; phone:"(313)878-3566";type:"Office"} - ListElement { name: "Alec" ; phone:"(917)608-2418";type:"Mobile"} - ListElement { name: "Alexander" ; phone:"(614)608-2400";type:"Home"} - ListElement { name: "Alexander Vasil'evich Michail Leontiy" ; phone:"(614)608-2400";type:"Mobile"} - ListElement { name: "Amber" ; phone:"(614)608-2111";type:"Mobile"} - ListElement { name: "Amy" ; phone:"(440)245-3434";type:"Mobile" } - ListElement { name: "Andy" ; phone:"(313)245-3434";type:"Mobile" } - ListElement { name: "Antje" ; phone:"(567)245-3434";type:"Home" } - ListElement { name: "buddy" ; phone:"(614)813-6610";type:"Mobile" } - ListElement { name: "Barry" ; phone:"(313)555-2211";type:"Mobile" } - ListElement { name: "Bea" ; phone:"(614)455-3434";type:"Mobile" } - ListElement { name: "Ben" ; phone:"(614)882-1843";type:"Office" } - ListElement { name: "Blake" ; phone:"(330)149-7778";type:"Mobile" } - ListElement { name: "Bob Mould" ; phone:"(313)245-3434";type:"Mobile" } - ListElement { name: "Brian" ; phone:"(614)332-7499";type:"Mobile" } - ListElement { name: "Calvin" ; phone:"(614)442-9974";type:"Mobile" } - ListElement { name: "Carl" ; phone:"(567)773-3434";type:"Home" } - ListElement { name: "Cat Power" ; phone:"(313)608-3434";type:"Home"} - ListElement { name: "Cathy" ; phone:"(313)444-456";type:"Home"} - ListElement { name: "Chris" ; phone:"(734)997-6514";type:"Home" } - ListElement { name: "Cloud Nothings"; phone:"(444)608-543";type:"Mobile"} - ListElement { name: "Cody" ; phone:"(567)365-8413";type:"Home" } - ListElement { name: "Curtis" ; phone:"(614)245-1547";type:"Office" } - ListElement { name: "Dakota" ; phone:"(567)555-4444";type:"Home" } - ListElement { name: "Dale" ; phone:"(567)723-1974";type:"Mobile" } - ListElement { name: "Dallas"; phone:"(614)556-879";type:"Home"} - ListElement { name: "Damian" ; phone:"(614)245-3434";type:"Office" } - ListElement { name: "Daniel"; phone:"(614)556-879";type:"Home"} - ListElement { name: "Darina"; phone:"(313)895-888";type:"Mobile"} - ListElement { name: "Dee "; phone:"(313)432-3434";type:"Home"} -// ListElement { name: "Edward" ; phone:"(917)608-975";type:"Office"} - ListElement { name: "Ferdinand" ; phone:"(917)879-795";type:"Mobile"} - ListElement { name: "gomez" ; phone:"(313)455-543";type:"Mobile"} - ListElement { name: "Harry Potter"; phone:"(313)888-432";type:"Home"} - ListElement { name: "Ivan"; phone:"(313)996-225";type:"Home"} -// ListElement { name: "James" ; phone:"(917)608-3434";type:"Mobile"} - ListElement { name: "Karen"; phone:"(313)998-332";type:"Home"} - ListElement { name: "Luis Torres"; phone:"(313)779-111";type:"Home"} - ListElement { name: "Mary"; phone:"(313)234-098";type:"Mobile"} - ListElement { name: "Neil"; phone:"(313)444-112";type:"Mobile"} - ListElement { name: "Oswald"; phone:"(313)456-921";type:"Mobile"} - ListElement { name: "Oscar"; phone:"(313)332-778";type:"Home"} - ListElement { name: "~1123"; phone:"(313)1332";type:"Home"} - ListElement { name: "Patrice"; phone:"(313)789-111";type:"Mobile"} - ListElement { name: "Queen Elizabeth"; phone:"(313)897-666";type:"Mobile"} - ListElement { name: "Rose"; phone:"(313)111-211";type:"Mobile"} - ListElement { name: "Susell"; phone:"(313)345-122";type:"Home"} - ListElement { name: "Thomas"; phone:"(917)608-342";type:"Mobile"} - ListElement { name: "Titus Andronicus" ; phone:"(917)608-321";type:"Office"} - ListElement { name: "Toretto" ; phone:"(917)608-3434";type:"Home"} - ListElement { name: "Uhl" ; phone:"(313)444-654";type:"Office"} - ListElement { name: "willi" ; phone:"(313)224-5712";type:"Office"} - ListElement { name: "Wanda" ; phone:"(313)666-6969";type:"Office"} - ListElement { name: "wanda" ; phone:"(313)666-6969";type:"Office"} - ListElement { name: "Zara" ; phone:"(313)231-009";type:"Mobile"} -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/DataStorage.qml b/src/components/qt_hmi/qml_model_qt4/models/DataStorage.qml deleted file mode 100644 index cc5f6fc215..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/DataStorage.qml +++ /dev/null @@ -1,510 +0,0 @@ -/** - * @file DataStorage.qml - * @brief Container for data. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "Internal.js" as Internal -import "Constants.js" as Constants - -QtObject { - - property string contactsFirstLetter // first letter of contact's name that need to find at contact list - property ApplicationModel currentApplication: ApplicationModel { } - property SliderModel uiSlider: SliderModel { } - property PerformAudioPassThruModel uiAudioPassThru: PerformAudioPassThruModel { } - - function getApplication(appId) { - console.log("dataContainer getApplication enter"); - for(var i = 0; i < applicationList.count; i++) { - if(applicationList.get(i).appId === appId) { - console.log("Application found", applicationList.get(i)); - return applicationList.get(i); - } - } - console.log("dataContainer getApplication exit"); - } - - onApplicationListChanged: { - console.log("onApplicationListChanged()"); - setCurrentApplication(appId); - } - - function setCurrentApplication(appId) { - console.log("Enter setCurrentApplication function"); - var oldApplicationContext = applicationContext; - if (currentApplication.appId !== appId) { - applicationContext = false; - } - - for(var i = 0; i < applicationList.count; i++) { - if(applicationList.get(i).appId === appId) { - currentApplication.appId = appId - var application = applicationList.get(i) - currentApplication.appName = application.appName - currentApplication.appType = application.appType - currentApplication.appIcon.source = application.icon - currentApplication.playPauseState = application.playPauseState - currentApplication.options = application.options - currentApplication.softButtons = application.softButtons - currentApplication.customPresets = application.customPresets - - if (application.hmiUIText.mainField1 !== undefined) { - currentApplication.hmiUIText.mainField1 = application.hmiUIText.mainField1 - } - if (application.hmiUIText.mainField2 !== undefined) { - currentApplication.hmiUIText.mainField2 = application.hmiUIText.mainField2 - } - if (application.hmiUIText.mainField3 !== undefined) { - currentApplication.hmiUIText.mainField3 = application.hmiUIText.mainField3 - } - if (application.hmiUIText.mainField4 !== undefined) { - currentApplication.hmiUIText.mainField4 = application.hmiUIText.mainField4 - } - if (application.hmiUIText.statusBar !== undefined) { - currentApplication.hmiUIText.statusBar = application.hmiUIText.statusBar - } - if (application.hmiUIText.mediaTrack !== undefined) { - currentApplication.hmiUIText.mediaTrack = application.hmiUIText.mediaTrack - } - if (application.hmiUIText.image !== undefined) { - currentApplication.hmiUIText.image = application.hmiUIText.image - } - if (application.hmiUITextAlignment !== undefined) { - currentApplication.hmiUITextAlignment = application.hmiUITextAlignment - } - if (application.helpPrompt !== undefined) { - currentApplication.helpPrompt = application.helpPrompt - } - if (application.timeoutPrompt !== undefined) { - currentApplication.timeoutPrompt = application.timeoutPrompt - } - // Check fields with mandatory = false - - currentApplication.deviceName = application.deviceName - currentApplication.isMediaApplication = application.isMediaApplication - currentApplication.turnList = application.turnList - currentApplication.turnListSoftButtons = application.turnListSoftButtons - currentApplication.mediaClock.updateMode = application.mediaClock.updateMode - currentApplication.mediaClock.runningMode = application.mediaClock.runningMode - currentApplication.mediaClock.startTimeForProgress = application.mediaClock.startTimeForProgress - if (application.mediaClock.startTime !== undefined) { - currentApplication.mediaClock.startTime = application.mediaClock.startTime - } - if (application.mediaClock.endTime !== undefined) { - currentApplication.mediaClock.endTime = application.mediaClock.endTime - } - currentApplication.languageTTSVR = application.languageTTSVR - currentApplication.hmiDisplayLanguageDesired = application.hmiDisplayLanguageDesired - // This place is for adding new properties - } - } - applicationContext = oldApplicationContext; - currentApplicationChanged() - console.log("Exit setCurrentApplication function") - } - - function addApplication(app) { - console.log("enter") - applicationList.append({ - appName: app.appName, - ngnMediaScreenAppName: app.ngnMediaScreenAppName, - icon: app.icon, - deviceName: app.deviceName, - appId: app.appId, - hmiDisplayLanguageDesired: app.hmiDisplayLanguageDesired, - isMediaApplication: app.isMediaApplication, - appType: app.appType, - helpPrompt: "", - timeoutPrompt: "", - customPresets: app.customPresets ? app.customPresets : [], - playPauseState: 'Pause', - hmiUIText: app.hmiUIText, - hmiUITextAlignment: app.hmiUITextAlignment, - options: [], - turnList: [], - turnListSoftButtons: [], - mediaClock: app.mediaClock, - languageTTSVR: Common.Language.EN_US, - softButtons: [] - // This place is for adding new properties - }) - - if (app.isMediaApplication) { - musicSourceModel.insert(0, { - "title": app.appName, - "qml": "views/SDLPlayerView.qml", - "appId": app.appId - }) - } - - console.log("exit") - } - - function setApplicationProperties(appId, props) { - console.log("Enter setApplicationProperties function"); - var app = getApplication(appId) - for (var p in props) { - if (props[p] !== undefined) { - app[p] = props[p] - } - } - if (currentApplication.appId === appId) { - setCurrentApplication(appId); // copy new values to current application - } - console.log("Exit setApplicationProperties function"); - } - - function removeApplication(appId) { - console.log("enter"); - for (var j = 0; j < musicSourceModel.count; ++j) { - if (musicSourceModel.get(j).appId === appId) { - musicSourceModel.remove(j); - break; - } - } - for (var i = 0; i < applicationList.count; i++) { - if (applicationList.get(i).appId === appId) { - applicationList.remove(i); - break; - } - } - console.log("exit"); - } - - property int systemContext - property int hmiContext - property bool applicationContext: false - property bool applicationSavedContext - property string routeText: "" - property PlayerState cdPlayerState: PlayerState { - playPauseState: 'Pause' - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - } - property PlayerState ipodPlayerState: PlayerState { - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - playPauseState: 'Pause' - } - property PlayerState usbPlayerState: PlayerState { - playPauseState: 'Pause' - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - } - property PlayerState linePlayerState: PlayerState { - playPauseState: 'Pause' - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - } - property PlayerState btPlayerState: PlayerState { - playPauseState: 'Pause' - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - } - property PlayerState amPlayerState: PlayerState { - songName: "So Far Around The Bend" - albumName: "The National" - presets: [ "1130", "950", "760", "1270", "1400", "2100", "940", "1001" ] - } - property PlayerState fmPlayerState: PlayerState { - songName: "So Far Around The Bend" - albumName: "The National" - presets: ["96.3", "107.9", "104.3", "101.9", "105.3", "100.5", "107.9", "103.4"] - } - property PlayerState siriusPlayerState: PlayerState { - songName: "So Far Around The Bend" - albumName: "The National" - presets: [ "Lithium", "Spectrum", "ESPN", "Alt Nation", "Lithium", "Spectrum", "ESPN", "Alt Nation" ] - } - - property bool hmiVRAvailable: false - property bool hmiTTSAvailable: false - property bool hmiNavigationAvailable: false - property bool hmiVehicleInfoAvailable: false - property bool hmiUIAvailable: false - - property int hmiUILanguage: Common.Language.EN_US - property int hmiTTSVRLanguage: Common.Language.EN_US - - property ListModel deviceList: ListModel { } - property ListModel applicationList: ListModel { } - - property ListModel vrCommands: ListModel {} - - property ListModel vrHelp: ListModel {} - - function reset () { - console.log("dataContainer reset enter"); - routeText = "" - console.log("dataContainer reset exit"); - } - - function changeRegistrationUI (language, appID) { - console.log("dataContainer changeRegistrarionUI enter"); - setApplicationProperties(appID, { hmiDisplayLanguageDesired: language }); - console.log("dataContainer changeRegistrarionUI exit"); - } - - function changeRegistrationTTSVR(language, appID) { - console.log("dataContainer changeRegistrationTTSVR enter"); - setApplicationProperties(appID, { languageTTSVR: language }); - console.log("dataContainer changeRegistrationTTSVR exit"); - } - - function addCommand (cmdID, menuParams, cmdIcon, appID) { - console.debug("enter: " + - cmdID + - ", " + - (menuParams ? - "{" + menuParams.parentID + ", " + menuParams.position + ", " + menuParams.menuName + "}" : menuParams) + - ", " + - (cmdIcon ? - "{" + cmdIcon.value + ", " + cmdIcon.imageType + "}" : cmdIcon) + - ", " + - appID - ) - var commandToAddPosition - var app = getApplication(appID) - var currentMenu = app.options - var maximumCommands = Constants.maximumCommandsPerSubmenu - var index = 0 - - if ((menuParams) && (menuParams.parentID)) { // Work with sub menu - var parentNotFound = true - for (var optionIndex = 0; optionIndex < app.options.count; ++optionIndex) { - if ((app.options.get(optionIndex).type === Internal.MenuItemType.MI_SUBMENU) && (app.options.get(optionIndex).id === menuParams.parentID)) { - currentMenu = app.options.get(optionIndex).subMenu - parentNotFound = false - maximumCommands += 1 - } - } - if (parentNotFound) { - console.log("UI::addCommand(): parentID " + menuParams.parentID + " not found") - } - } - - if (currentMenu.count < maximumCommands) { - if (menuParams && (menuParams.position !== undefined)) { - commandToAddPosition = menuParams.position - } else { - commandToAddPosition = Constants.positionOfElementWithoutPosition - } - for (var i = 0; i < currentMenu.count; i++) { - if (commandToAddPosition >= currentMenu.get(i).position) { - index = i + 1 - } else { - break - } - } - currentMenu.insert( index, - { id: cmdID, - name: menuParams.menuName, - type: Internal.MenuItemType.MI_NODE, - position: commandToAddPosition, - icon: cmdIcon ? cmdIcon : {}, - subMenu: [] - }) - } else { - console.log("addCommand(): too many commands in menu: ", menuParams.parentID, " rejecting") - throw Common.Result.REJECTED - } - console.debug("exit") - } - - function deleteCommand (cmdID, appID) { - console.debug("enter: " + cmdID + ", " + appID) - for (var optionIndex = 0; optionIndex < getApplication(appID).options.count; ++optionIndex) { - var option = getApplication(appID).options.get(optionIndex) - if (option.type === Internal.MenuItemType.MI_NODE) { - if (option.id === cmdID) { - getApplication(appID).options.remove(optionIndex) - break - } - } - if (option.type === Internal.MenuItemType.MI_SUBMENU) { - var subMenu = option.subMenu - var idMatchFound = false - for (var subOptionIndex = 0; subOptionIndex < subMenu.count; ++subOptionIndex) { - if (subMenu.get(subOptionIndex).id === cmdID) { - idMatchFound = true - if (subMenu !== currentApplication.currentSubMenu) { - subMenu.remove(subOptionIndex) - } - else { - console.log("UI::deleteCommand(): cannot remove item from current submenu") - throw Common.Result.IN_USE - } - break - } - } - if (idMatchFound) { - break - } - } - } - console.debug("exit") - } - - function addSubMenu (menuID, menuParams, appID) { - console.debug("enter: " + menuID + ", {" + menuParams.parentID + ", " + menuParams.position + ", " + menuParams.menuName + "}, " + appID) - var app = getApplication(appID) - var index = 0 - var count = app.options.count - var subMenuToAddPosition - - if (count < Constants.maximumSubmenus) { - if (menuParams.position !== undefined) { - subMenuToAddPosition = menuParams.position - } else { - subMenuToAddPosition = Constants.positionOfElementWithoutPosition - } - for (var i = 0; i < count; i++) { - if (subMenuToAddPosition >= app.options.get(i).position) { - index = i + 1 - } else { - break - } - } - app.options.insert(index, { - "id": menuID, - "name": menuParams.menuName, - "position": subMenuToAddPosition, - "type": Internal.MenuItemType.MI_SUBMENU, - "icon": undefined, - "subMenu": [{ - "id": -1, - "name": menuParams.menuName, - "position": -1, - "type": Internal.MenuItemType.MI_PARENT, - "icon": { - "imageType": Common.ImageType.DYNAMIC, - "value": "../res/nav/turnArrow.png" - }, - "subMenu": getApplication(appID).options - }] - }) - } - else { - console.log("addSubMenu(): too many submenus, rejecting") - throw Common.Result.REJECTED - } - console.debug("exit") - } - - function deleteSubMenu (menuID, appID) { - console.debug("enter: " + menuID + ", " + appID) - for (var optionIndex = 0; optionIndex < getApplication(appID).options.count; ++optionIndex) { - var option = getApplication(appID).options.get(optionIndex) - if ((option.type === Internal.MenuItemType.MI_SUBMENU) && (option.id === menuID)) { - if (option.subMenu !== currentApplication.currentSubMenu) { - getApplication(appID).options.remove(optionIndex) - } - else { - console.log("UI::deleteSubMenu(): cannot remove current submenu") - throw Common.Result.IN_USE - } - break - } - } - console.debug("exit") - } - - function setVrHelp (vrHelp) { - this.vrHelp.clear() - var index - for (var i = 0; i < vrHelp.length; ++i) { - index = 0 -// sort by simple inserts - while ((index < this.vrHelp.count) && (this.vrHelp.get(index).position < vrHelp[i].position)) { - ++index - } - this.vrHelp.insert(index, { - "text": vrHelp[i].text, - "icon": vrHelp[i].image ? vrHelp[i].image : {}, - "position": vrHelp[i].position - }) - } - } - - property NavigationModel navigationModel: NavigationModel { } - property VehicleInfoModel vehicleInfoModel: VehicleInfoModel { } - property ScrollableMessageModel scrollableMessageModel: ScrollableMessageModel { } - property bool activeVR: false - - property InteractionModel interactionModel: InteractionModel { - } - - property int driverDistractionState: Common.DriverDistractionState.DD_OFF - onDriverDistractionStateChanged: { - sdlUI.onDriverDistraction(driverDistractionState); - } - property bool activeTTS: false - property variant activePopup - property int popups: 0 - - property bool activeAlert: false - - onActiveVRChanged: setSystemContext() - onActiveAlertChanged: setSystemContext() - onPopupsChanged: setSystemContext() - - function setSystemContext () { - console.debug("enter") - if (popups > 0) { - systemContext = Common.SystemContext.SYSCTXT_HMI_OBSCURED - } - else if (activeAlert) { - systemContext = Common.SystemContext.SYSCTXT_ALERT - } - else if (activeVR) { - systemContext = Common.SystemContext.SYSCTXT_VRSESSION - } - else if (contentLoader.item !== null) { - systemContext = contentLoader.item.systemContext - } - console.debug("exit") - } - property MusicSourceModel musicSourceModel: MusicSourceModel { - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/InteractionModel.qml b/src/components/qt_hmi/qml_model_qt4/models/InteractionModel.qml deleted file mode 100644 index 8da8a035db..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/InteractionModel.qml +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @file InteractionModel.qml - * @brief Interaction model. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Async.js" as Async - -QtObject { - property string initialText - property ListModel choice: ListModel { - } - property int timeout - property variant async - - function performInteraction (initialText, choiceSet, vrHelp, timeout, appID) { - console.debug("enter") - this.initialText = initialText.fieldText - choice.clear() - for (var i = 0; i < choiceSet.length; ++i) { - choice.append({"id": choiceSet[i].choiceID, "name": choiceSet[i].menuName ? choiceSet[i].menuName : "choiceID = " + choiceSet[i].choiceID, image: choiceSet[i].image}) - } - this.timeout = timeout - interactionPopup.activate() - async = new Async.AsyncCall() - console.debug("exit") - return async - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/Internal.js b/src/components/qt_hmi/qml_model_qt4/models/Internal.js deleted file mode 100644 index 4a1ebc625a..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/Internal.js +++ /dev/null @@ -1,163 +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. - */ - -var MenuItemType = { - MI_NODE: 0, - MI_SUBMENU: 1, - MI_PARENT: 2 -} - -function activePageChoose(flickElement, pages) { - if (flickElement.contentX <= 0) { - return 0 - } - else if ( (flickElement.contentWidth - flickElement.contentX) < flickElement.width) { - return pages -1 - } - else { - if ( (flickElement.contentX % flickElement.width) >= (1/6 * flickElement.width)) { - return Math.ceil(flickElement.contentX / flickElement.width) - } - else if ( (flickElement.contentX % flickElement.width) > 0) { - return Math.floor(flickElement.contentX / flickElement.width) - } - } -} - -var MediaClockUpdateMode = { - MCU_COUNTUP: 0, - MCU_COUNTDOWN: 1, -} - -var MediaClockRunningMode = { - MCR_RUNNING: 0, - MCR_STOPPED: 1 -} - -function appendVrHelpItem (arrayElement, index, array) { - this.append({ - text: arrayElement.text, - image: arrayElement.image ? arrayElement.image : "", - position: arrayElement.position - }) -} - -function checkBit(value, bitPosition) { - return (value & (1 << bitPosition)) -} - -function getArrayForPresetRow() { - var array = [] - for (var i = 0; i < dataContainer.currentApplication.customPresets.count; i++) { - array.push(dataContainer.currentApplication.customPresets.get(i).text) - } - return array -} - -function pad (string, length, lead) { - if (!lead) { - lead = '0' - } - var paddedString = "" + string - while (paddedString.length < length) { - paddedString = lead + paddedString - } - return paddedString -} - -function hmsTime (hours, minutes, seconds) { - return 60 * (60 * hours + minutes) + seconds -} - -function hmsTimeToString (hmsTime) { - if (hmsTime === -1) { - return "0:00:00" - } - - var _time = hmsTime - var seconds = _time % 60 - _time -= seconds - _time /= 60 - var minutes = _time % 60 - _time -= minutes - _time /= 60 - var hours = _time - var string = "" - string += hours - string += ":" - string += pad(minutes, 2) - string += ":" - string += pad(seconds, 2) - return string -} - -function stringToHmsTime (hmsString) { - console.debug("enter: \"" + hmsString + "\"") - var substrings = hmsString.split(":") - var seconds = substrings.length > 0 ? parseInt(substrings.pop()) : 0 - if (seconds >= 60) { - console.log("incorrect field \"seconds\": " + seconds) - console.debug("exit") - return 0 - } - var minutes = substrings.length > 0 ? parseInt(substrings.pop()) : 0 - if (minutes >= 60) { - console.log("incorrect field \"minutes\": " + minutes) - console.debug("exit") - return 0 - } - var hours = substrings.length > 0 ? parseInt(substrings.pop()) : 0 - console.debug("exit") - return hmsTime(hours, minutes, seconds) -} - -function mediaClockUpdateModeToString (mediaClockUpdateMode) { - switch (mediaClockUpdateMode) { - case MediaClockUpdateMode.MCU_COUNTUP: - return "Internal.MediaClockUpdateMode.MCU_COUNTUP" - case MediaClockUpdateMode.MCU_COUNTDOWN: - return "Internal.MediaClockUpdateMode.MCU_COUNTDOWN" - default: - return "" - } -} - -function mediaClockRunningModeToString (mediaClockRunningMode) { - switch (mediaClockRunningMode) { - case MediaClockRunningMode.MCR_RUNNING: - return "Internal.MediaClockRunningMode.MCR_RUNNING" - case MediaClockRunningMode.MCR_STOPPED: - return "Internal.MediaClockRunningMode.MCR_STOPPED" - default: - return "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/MainMenuListModel.qml b/src/components/qt_hmi/qml_model_qt4/models/MainMenuListModel.qml deleted file mode 100644 index 49b4e7fb9a..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/MainMenuListModel.qml +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file MainMenuListModel.qml - * @brief Main menu list of elements. - * 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. - */ -import QtQuick 1.1 - -ListModel -{ - ListElement { - name: "Climate" - icon: "../res/snow.png" - qml: "./views/ClimateControlView.qml" - } - - ListElement { - name: "Navigation" - icon: "../res/arrow.png" - qml: "./views/NavigationNoRouteGridView.qml" - } - - ListElement { - name: "Media" - icon: "../res/notes.png" - qml: "./views/MusicSourceView.qml" - } - - ListElement { - name: "Preferences" - icon: "../res/gear.png" - qml: "" - } - - ListElement { - name: "Apps" - icon: "../res/apps.png" - qml: "./views/ApplicationListView.qml" - } - - ListElement { - name: "Phone" - icon: "../res/phone/phone.png" - qml: "./views/PhoneMenuGridView.qml" - } - - ListElement { - name: "Car" - icon: "../res/car.png" - qml: "./views/CarMenuGridView.qml" - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/MediaClockModel.qml b/src/components/qt_hmi/qml_model_qt4/models/MediaClockModel.qml deleted file mode 100644 index 8f062008a4..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/MediaClockModel.qml +++ /dev/null @@ -1,112 +0,0 @@ -/** - * @file MediaClockModel.qml - * @brief Media clock model - * 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. - */ - -import QtQuick 1.1 -import "Internal.js" as Internal - -QtObject { - property int updateMode - property int runningMode - property int startTime - property int endTime - property int upperTimeLimit: 60 * 60 * 60 - 1 - property int startTimeForProgress - property real progress - - property Timer timer: Timer { - id: timer - interval: 1000 - repeat: true - onTriggered: onTimer() - } - onRunningModeChanged: { - if (runningMode === Internal.MediaClockRunningMode.MCR_STOPPED) { - timer.stop() - } else { - timer.start() - } - } - - onStartTimeChanged: { - if (startTime === -1) { - progress = 0 - } else { - if (updateMode === Internal.MediaClockUpdateMode.MCU_COUNTUP) { - progress = (endTime !== -1) ? (startTime / endTime) : (startTime / upperTimeLimit) - } else { - progress = (endTime !== -1) ? ( (startTime - endTime) / (startTimeForProgress - endTime) ) - : (startTime / startTimeForProgress) - } - } - } - - function onTimer () { - switch (updateMode) { - case Internal.MediaClockUpdateMode.MCU_COUNTUP: - if (endTime !== -1) { - if (startTime < endTime) { - startTime++ - } else { - timer.stop() - runningMode = Internal.MediaClockRunningMode.MCR_STOPPED - console.debug("count Up timer stopped") - } - } else { - if (startTime < upperTimeLimit) { - startTime++ - } else { - startTime = 0 - } - } - break - case Internal.MediaClockUpdateMode.MCU_COUNTDOWN: - console.debug("count down") - if (--startTime === 0) { - timer.stop() - runningMode = Internal.MediaClockRunningMode.MCR_STOPPED - startTime = endTime = -1 - console.debug("count Down timer stopped") - } - break - } - dataContainer.setApplicationProperties(dataContainer.currentApplication.appId, { - "mediaClock": {startTime: startTime, - endTime: endTime, - updateMode: updateMode, - runningMode: runningMode, - startTimeForProgress: startTimeForProgress - } - }) - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/MusicSourceModel.qml b/src/components/qt_hmi/qml_model_qt4/models/MusicSourceModel.qml deleted file mode 100644 index b01c4cf834..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/MusicSourceModel.qml +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file MusicSourceModel.qml - * @brief Music source menu list of elements. - * 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. - */ -import QtQuick 1.1 - -ListModel -{ - ListElement { - title: "FM" - qml: "./views/FMPlayerView.qml" - appId: 0 - } - ListElement { - title: "AM" - qml: "./views/AMPlayerView.qml" - appId: 0 - } - ListElement { - title: "BT Audio" - qml: "./views/BTPlayerView.qml" - appId: 0 - } - ListElement { - title: "Sirius" - qml: "./views/SiriusPlayerView.qml" - appId: 0 - } - ListElement { - title: "CD" - qml: "./views/CDPlayerView.qml" - appId: 0 - } - ListElement { - title: "iPod" - qml: "./views/IPodPlayerView.qml" - appId: 0 - } - ListElement { - title: "USB" - qml: "./views/UsbPlayerView.qml" - appId: 0 - } - ListElement { - title: "LineIn" - qml: "./views/LineInPlayerView.qml" - appId: 0 - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/NavigationMenuModel.qml b/src/components/qt_hmi/qml_model_qt4/models/NavigationMenuModel.qml deleted file mode 100644 index 963225719e..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/NavigationMenuModel.qml +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file NavigationMenuModel.qml - * @brief Music source menu list of elements. - * 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. - */ - -import QtQuick 1.1 - -ListModel -{ - ListElement { - title: "Home" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Keyboard" - icon: "../res/buttons/long_oval_btn.png" - qml: "./views/NavigationKeyboardView.qml" - } - ListElement { - title: "Favorites" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Work" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Recent" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "POI" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Scout" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Waze" - icon: "../res/buttons/long_oval_btn.png" - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/NavigationModel.qml b/src/components/qt_hmi/qml_model_qt4/models/NavigationModel.qml deleted file mode 100644 index f9203875d3..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/NavigationModel.qml +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @file NavigationModel.qml - * @brief Model for Navigation. - * 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. - */ - -import QtQuick 1.1 - -QtObject { - property string text1: "" - property string text2: "" - property string totalDistance: "" - property string eta: "" - property string timeToDestination: "" - property variant turnIcon - property variant nextTurnIcon - - property real distanceToManeuver: 0 - property real distanceToManeuverScale: 0 - property bool maneuverComplete - property ListModel softButtons: ListModel {} - property int appId: -1 - property ListModel alertManeuverSoftButtons: ListModel {} -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/PerformAudioPassThruModel.qml b/src/components/qt_hmi/qml_model_qt4/models/PerformAudioPassThruModel.qml deleted file mode 100644 index 8b861d37a2..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/PerformAudioPassThruModel.qml +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file PerformAudioPassThruModel.qml - * @brief Data model audio pass thru. - * 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. - */ - -import QtQuick 1.1 - -QtObject { - property string appName: "" - property string firstLine: "" - property string secondLine: "" - property int timeout: 0 - property bool running: false -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/PhoneMenuModel.qml b/src/components/qt_hmi/qml_model_qt4/models/PhoneMenuModel.qml deleted file mode 100644 index a191f46e46..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/PhoneMenuModel.qml +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file PhoneMenuModel.qml - * @brief Phone menu list of elements. - * 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. - */ -import QtQuick 1.1 - -ListModel -{ - ListElement { - name: "phone" - icon: "../res/phone/phone.png" - qml: "" - } - ListElement { - name: "contacts" - icon: "../res/phone/contacts.png" - qml: "./views/PhoneKeyboardView.qml" - } - ListElement { - name: "messages" - icon: "../res/phone/messages.png" - qml: "" - } - ListElement { - name: "DND" - icon: "../res/phone/dnd_off.png" - qml: "" - } - ListElement { - name: "texts" - icon: "../res/phone/texts.png" - qml: "" - } - ListElement { - name: "recent" - icon: "../res/phone/recent.png" - qml: "" - } - ListElement { - name: "keyboard" - icon: "../res/phone/keypad.png" - qml: "" - } - ListElement { - name: "more" - icon: "../res/phone/more.png" - qml: "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/PlayerState.qml b/src/components/qt_hmi/qml_model_qt4/models/PlayerState.qml deleted file mode 100644 index bbacd49f8c..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/PlayerState.qml +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file PlayerState.qml - * @brief List of parameters for each player. - * 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. - */ -import QtQuick 1.1 - -// Player state for all players except SDL media player -Item { - // Media players - property string playPauseState - property string albumImage - property string trackNumber - property int songPosition - property string trackName - - // Radio Players - property variant presets: [] - - // Both players - property string songName - property string albumName -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/ScrollableMessageModel.qml b/src/components/qt_hmi/qml_model_qt4/models/ScrollableMessageModel.qml deleted file mode 100644 index 6fd441ac3d..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/ScrollableMessageModel.qml +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file ScrollableMessageModel.qml - * @brief Model for Scrollable Message. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common - -QtObject { - property string longMessageText: "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" - property ListModel softButtons: ListModel {} - property int appId: -1 - property int timeout: 0 - property variant async - property bool running: false - -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/SettingsStorage.qml b/src/components/qt_hmi/qml_model_qt4/models/SettingsStorage.qml deleted file mode 100644 index 7fb6cfcdd6..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/SettingsStorage.qml +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @file SettingsStorage.qml - * @brief Storage for keeping settings. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common - -Item -{ - property variant sdlLanguagesList: [ - Common.Language.EN_US, - Common.Language.ES_MX, - Common.Language.FR_CA, - Common.Language.DE_DE, - Common.Language.ES_ES, - Common.Language.EN_GB, - Common.Language.RU_RU, - Common.Language.TR_TR, - Common.Language.PL_PL, - Common.Language.FR_FR, - Common.Language.IT_IT, - Common.Language.SV_SE, - Common.Language.PT_PT, - Common.Language.NL_NL, - Common.Language.ZH_TW, - Common.Language.JA_JP, - Common.Language.AR_SA, - Common.Language.KO_KR, - Common.Language.PT_BR, - Common.Language.CS_CZ, - Common.Language.DA_DK, - Common.Language.NO_NO - ] - - property variant displayCapabilities: { - "displayType": Common.DisplayType.GEN2_8_DMA, - "textFields": [ - Common.TextFieldName.mainField1, - Common.TextFieldName.mainField2, - Common.TextFieldName.mainField3, - Common.TextFieldName.mainField4, - Common.TextFieldName.statusBar, - Common.TextFieldName.mediaClock, - Common.TextFieldName.mediaTrack, - Common.TextFieldName.alertText1, - Common.TextFieldName.alertText2, - Common.TextFieldName.alertText3, - Common.TextFieldName.scrollableMessageBody, - Common.TextFieldName.initialInteractionText, - Common.TextFieldName.navigationText1, - Common.TextFieldName.navigationText2, - Common.TextFieldName.ETA, - Common.TextFieldName.totalDistance, - Common.TextFieldName.navigationText, - Common.TextFieldName.audioPassThruDisplayText1, - Common.TextFieldName.audioPassThruDisplayText2, - Common.TextFieldName.sliderHeader, - Common.TextFieldName.sliderFooter, - Common.TextFieldName.notificationText - ], - "mediaClockFormats": [ - Common.MediaClockFormat.CLOCK1, - Common.MediaClockFormat.CLOCK2, - Common.MediaClockFormat.CLOCK3, - Common.MediaClockFormat.CLOCKTEXT1, - Common.MediaClockFormat.CLOCKTEXT2, - Common.MediaClockFormat.CLOCKTEXT3, - Common.MediaClockFormat.CLOCKTEXT4 - ], - "graphicSupported": true, - "imageCapabilities": [ Common.ImageType.DYNAMIC ], - "templatesAvailable": [ "" ], - "screenParams": { - "resolution": { - "resolutionWidth": 800, - "resolutionHeight": 480 - }, - "touchEventAvailable": { - "pressAvailable": true, - "multiTouchAvailable": true, - "doublePressAvailable": true - } - }, - "numCustomPresetsAvailable": 6 - } - - property variant softButtonCapabilities: { - "shortPressAvailable": true, - "longPressAvailable": true, - "upDownAvailable": true, - "imageSupported": true - } - - property variant buttonCapabilities: [] -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/SliderModel.qml b/src/components/qt_hmi/qml_model_qt4/models/SliderModel.qml deleted file mode 100644 index d335c9eb2a..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/SliderModel.qml +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file SliderModel.qml - * @brief Data model for slider. - * 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. - */ - -import QtQuick 1.1 - -QtObject { - property string appName: "" - property string header: "" - property variant footer: [] - property int numTicks: 0 - property int position: 0 - property int timeout: 0 - property bool running: false -} diff --git a/src/components/qt_hmi/qml_model_qt4/models/VehicleInfoModel.qml b/src/components/qt_hmi/qml_model_qt4/models/VehicleInfoModel.qml deleted file mode 100644 index f5c309880c..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/models/VehicleInfoModel.qml +++ /dev/null @@ -1,234 +0,0 @@ -/** - * @file VehicleInfoModel.qml - * @brief Data model for vehicle info. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common - -QtObject { - id: vehicleInfo - property real speed: 80.1 - property int rpm: 5000 - property real fuelLevel: 0.2 - property int fuelLevel_State: Common.ComponentVolumeStatus.CVS_LOW - property real instantFuelConsumption: 2.2 - property int driverBraking: Common.VehicleDataEventStatus.VDES_NO_EVENT - property int wiperStatus: Common.WiperStatus.OFF - property real engineTorque: 2.5 - property real accPedalPosition: 0.5 - property real steeringWheelAngle: 1.2 - property real externalTemperature: 40.0 - property string vin: '52-452-52-752' - property int odometer: 2 - property int prndl: Common.PRNDL.FIFTH - - property variant headLampStatus: { - "lowBeamsOn": false, - "highBeamsOn": false, - "ambientLightSensorStatus": Common.AmbientLightStatus.TWILIGHT_1 - } - property variant deviceStatus: { - 'voiceRecOn': false, - 'btIconOn': false, - 'callActive': false, - 'phoneRoaming': false, - 'textMsgAvailable': false, - 'battLevelStatus': Common.DeviceLevelStatus.ZERO_LEVEL_BARS, - 'stereoAudioOutputMuted': false, - 'monoAudioOutputMuted': false, - 'signalLevelStatus': Common.DeviceLevelStatus.ZERO_LEVEL_BARS, - 'primaryAudioSource': Common.PrimaryAudioSource.NO_SOURCE_SELECTED, - 'eCallEventActive': false - } - property variant bodyInformation: { - 'parkBrakeActive': false, - 'ignitionStableStatus': Common.IgnitionStableStatus.IGNITION_SWITCH_NOT_STABLE, - 'ignitionStatus': Common.IgnitionStatus.IS_UNKNOWN - } - property variant beltStatus: { - 'driverBeltDeployed': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'passengerBeltDeployed': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'passengerBuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'driverBuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'leftRow2BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'passengerChildDetected': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'rightRow2BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'middleRow2BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'middleRow3BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'leftRow3BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'rightRow3BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'leftRearInflatableBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'rightRearInflatableBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'middleRow1BeltDeployed': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'middleRow1BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - } - property variant tirePressure: { - 'pressureTelltale': Common.WarningLightStatus.WLS_ON, - 'leftFront': { status: Common.ComponentVolumeStatus.CVS_NORMAL}, - 'rightFront': { status: Common.ComponentVolumeStatus.CVS_UNKNOWN }, - 'leftRear': { status: Common.ComponentVolumeStatus.CVS_NORMAL }, - 'rightRear': { status: Common.ComponentVolumeStatus.CVS_UNKNOWN }, - 'innerLeftRear': { status: Common.ComponentVolumeStatus.CVS_UNKNOWN }, - 'innerRightRear': { status: Common.ComponentVolumeStatus.CVS_UNKNOWN } - } - property variant gps: { - 'longitudeDegrees': 42.3293, - 'latitudeDegrees': -83.0464, - 'utcYear': 2013, - 'utcMonth': 2, - 'utcDay': 14, - 'utcHours': 13, - 'utcMinutes': 16, - 'utcSeconds': 54, - 'compassDirection': Common.CompassDirection.SOUTHWEST, - 'pdop': 4, - 'hdop': 5, - 'vdop': 6, - 'actual': false, - 'satellites': 8, - 'dimension': Common.Dimension.Dimension_2D, - 'altitude': 7, - 'heading': 173, - 'speed': 2 - } - property variant ecuDIDData: { - 'data1': 'ECU 1 Test Data', - 'data2': 'ECU 2 Test Data' - } - property variant eCallInfo: { - "eCallNotificationStatus" : Common.VehicleDataNotificationStatus.VDNS_NORMAL, - "auxECallNotificationStatus" : Common.VehicleDataNotificationStatus.VDNS_ACTIVE, - "eCallConfirmationStatus" : Common.ECallConfirmationStatus.ECCS_NORMAL - } - property variant airbagStatus: { - "driverAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NO_EVENT, - "driverSideAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NO, - "driverCurtainAirbagDeployed" : Common.VehicleDataEventStatus.VDES_YES, - "passengerAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NOT_SUPPORTED, - "passengerCurtainAirbagDeployed" : Common.VehicleDataEventStatus.VDES_FAULT, - "driverKneeAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NO, - "passengerSideAirbagDeployed" : Common.VehicleDataEventStatus.VDES_YES, - "passengerKneeAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NOT_SUPPORTED - } - property variant emergencyEvent: { - "emergencyEventType" : Common.EmergencyEventType.EET_NO_EVENT, - "fuelCutoffStatus" : Common.EmergencyEventType.EET_FRONTAL, - "rolloverEvent" : Common.EmergencyEventType.EET_SIDE, - "maximumChangeVelocity" : Common.EmergencyEventType.EET_REAR, - "multipleEvents" : Common.EmergencyEventType.EET_ROLLOVER - } - property variant clusterModeStatus: { - "powerModeActive" : true, - "powerModeQualificationStatus" : Common.PowerModeQualificationStatus.POWER_MODE_UNDEFINED, - "carModeStatus" : Common.CarModeStatus.CMS_NORMAL, - "powerModeStatus" : Common.PowerModeStatus.KEY_OUT - } - property variant myKey: { - "e911Override": Common.VehicleDataStatus.VDS_NO_DATA_EXISTS - } - - - function sendGpsChange(){ - sdlVehicleInfo.onGps(vehicleInfo.gps) - } - function sendSpeedChange(){ - sdlVehicleInfo.onSpeed(vehicleInfo.speed) - } - function sendRpmChange(){ - sdlVehicleInfo.onRpm(vehicleInfo.rpm) - } - function sendFuelLevelChange(){ - sdlVehicleInfo.onFuelLevel(vehicleInfo.fuelLevel) - } - function sendFuelLevel_StateChange(){ - sdlVehicleInfo.onFuelLevel_State(vehicleInfo.fuelLevel_State) - } - function sendInstantFuelConsumptionChange(){ - sdlVehicleInfo.onInstantFuelConsumption(vehicleInfo.instantFuelConsumption) - } - function sendExternalTemperatureChange(){ - sdlVehicleInfo.onExternalTemperature(vehicleInfo.externalTemperature) - } - function sendPrndlChange() { - if (dataContainer.vehicleInfoModel.prndl !== -1) - {sdlVehicleInfo.onPrndl(vehicleInfo.prndl)} - } - function sendTirePressureChange(){ - sdlVehicleInfo.onTirePressure(vehicleInfo.tirePressure) - } - function sendOdometerChange(){ - sdlVehicleInfo.onOdometer(vehicleInfo.odometer) - } - function sendBeltStatusChange(){ - sdlVehicleInfo.onBeltStatus(vehicleInfo.beltStatus) - } - function sendBodyInformationChange(){ - sdlVehicleInfo.onBodyInformation(vehicleInfo.bodyInformation) - } - function sendDeviceStatusChange(){ - sdlVehicleInfo.onDeviceStatus(vehicleInfo.deviceStatus) - } - function sendDriverBrakingChange(){ - sdlVehicleInfo.onDriverBraking(vehicleInfo.driverBraking) - } - function sendWiperStatusChange(){ - sdlVehicleInfo.onWiperStatus(vehicleInfo.wiperStatus) - } - function sendHeadLampStatusChange(){ - sdlVehicleInfo.onHeadLampStatus(vehicleInfo.headLampStatus) - } - function sendEngineTorqueChange(){ - sdlVehicleInfo.onEngineTorque(vehicleInfo.engineTorque) - } - function sendAccPedalPositionChange(){ - sdlVehicleInfo.onAccPedalPosition(vehicleInfo.accPedalPosition) - } - function sendSteeringWheelAngleChange(){ - sdlVehicleInfo.onSteeringWheelAngle(vehicleInfo.steeringWheelAngle) - } - function sendECallInfoChange(){ - sdlVehicleInfo.onECallInfo(vehicleInfo.eCallInfo) - } - function sendAirbagStatusChange(){ - sdlVehicleInfo.onAirbagStatus(vehicleInfo.airbagStatus) - } - function sendEmergencyEventChange(){ - sdlVehicleInfo.onEmergencyEvent(vehicleInfo.emergencyEvent) - } - function sendClusterModeStatusChange(){ - sdlVehicleInfo.onClusterModeStatus(vehicleInfo.clusterModeStatus) - } - function sendMyKeyChange(){ - sdlVehicleInfo.onMyKey(vehicleInfo.myKey) - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/AlertWindow.qml b/src/components/qt_hmi/qml_model_qt4/popups/AlertWindow.qml deleted file mode 100644 index 70e7ba29ef..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/AlertWindow.qml +++ /dev/null @@ -1,285 +0,0 @@ -/** - * @file AlertWindow.qml - * @brief Alert popup window - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -Rectangle { - id: alertWindow - property date lastAlertTime - property variant softButtons - property int appId - property string popUpName // TODO{ALESHIN}: No requerments for closePopUp, if alert couldn't be closed by closePopUp request - delete everywhere - - color: "transparent" - - property variant async - - Rectangle { - id: rectangle - - anchors.centerIn: parent - color: "black" - border.color: "white" - - width: alertContent.width + 60 - height: alertContent.height + 60 - - property alias alertString: alert.text - property alias appNameString: appName.text - property int duration - - Column { - id: alertContent - anchors.centerIn: parent - spacing: 20 - - Text { - id: appName - anchors.horizontalCenter: parent.horizontalCenter - color: "white" - font.pointSize: 16 - } - - Row { - width: Constants.alertWidth - spacing: 20 - - Image { - id: alertLogo - source: "../res/warning.png" - } - - Text { - id: alert - width: parent.width - alertLogo.width - parent.spacing - clip: true - color: "white" - font.pointSize: 16 - } - } - - Rectangle { - id: progressIndicator - color: "white" - height: 10 - } - - Column { - Item { - width: Constants.alertWidth - height: alertButton1.visible ? alertButton1.height : 0 - - SoftButton { - id: alertButton1 - appId: alertWindow.appId - button: softButtons && softButtons.length > 0 ? softButtons[0] : undefined - anchors.left: parent.left - anchors.right: alertButton2.visible ? alertButton2.left : parent.right - width: Constants.alertWidth / 2 - onPressed: { alertWindow.keep = true; } - onReleased: { alertWindow.keep = false; } - onKeepContext: { - alertWindow.restart(); - sdlUI.onResetTimeout(appId, "UI.Alert") - } - onDefaultAction: { alertWindow.complete(Common.Result.SUCCESS); } - onStealFocus: { - contentLoader.go("views/SDLPlayerView.qml", appId); - alertWindow.complete(Common.Result.SUCCESS); - } - } - SoftButton { - id: alertButton2 - appId: alertWindow.appId - button: softButtons && softButtons.length > 1 ? softButtons[1] : undefined - anchors.right: parent.right - width: Constants.alertWidth / 2 - onPressed: { alertWindow.keep = true; } - onReleased: { alertWindow.keep = false; } - onKeepContext: { - alertWindow.restart(); - sdlUI.onResetTimeout(appId, "UI.Alert") - } - onDefaultAction: { alertWindow.complete(Common.Result.SUCCESS); } - onStealFocus: { - contentLoader.go("views/SDLPlayerView.qml", appId); - alertWindow.complete(Common.Result.SUCCESS); - } - } - } - Item { - width: Constants.alertWidth - height: alertButton3.visible ? childrenRect.height : 0 - SoftButton { - id: alertButton3 - appId: alertWindow.appId - button: softButtons && softButtons.length > 2 ? softButtons[2] : undefined - anchors.left: parent.left - anchors.right: alertButton4.visible ? alertButton4.left : parent.right - width: Constants.alertWidth / 2 - onPressed: { alertWindow.keep = true; } - onReleased: { alertWindow.keep = false; } - onKeepContext: { - alertWindow.restart(); - sdlUI.onResetTimeout(appId, "UI.Alert") - } - onDefaultAction: { alertWindow.complete(Common.Result.SUCCESS); } - onStealFocus: { - contentLoader.go("views/SDLPlayerView.qml", appId); - alertWindow.complete(Common.Result.SUCCESS); - } - } - SoftButton { - id: alertButton4 - appId: alertWindow.appId - button: softButtons && softButtons.length > 3 ? softButtons[3] : undefined - anchors.right: parent.right - width: Constants.alertWidth / 2 - onPressed: { alertWindow.keep = true; } - onReleased: { alertWindow.keep = false; } - onKeepContext: { - alertWindow.restart(); - sdlUI.onResetTimeout(appId, "UI.Alert") - } - onDefaultAction: { alertWindow.complete(Common.Result.SUCCESS); } - onStealFocus: { - contentLoader.go("views/SDLPlayerView.qml", appId); - alertWindow.complete(Common.Result.SUCCESS); - } - } - } - } - } - - SequentialAnimation { - id: animation - PropertyAction { target: progressIndicator; property: "width"; value: alertContent.width } - PropertyAnimation { - id: shrinkProgressAnimation - target: progressIndicator - property: "width" - to: 0 - duration: rectangle.duration - } - } - } - - Timer { - id: timer - onTriggered: { - complete(Common.Result.SUCCESS) - } - } - - function alert (alertStrings, duration, showIndicator, sButtons, applicationId) { - if (timer.running) { // we have alert already - var currentTime = new Date() - var timeFromLastAlert = currentTime - lastAlertTime - var timeLeft = timer.interval - timeFromLastAlert - var discreteInMilliseconds = 1000 // wish to round left time to integer seconds - var timeLeftRounded = discreteInMilliseconds * Math.ceil(timeLeft / discreteInMilliseconds) - return timeLeftRounded - } - else { - lastAlertTime = new Date(); - appId = applicationId - rectangle.appNameString = dataContainer.getApplication(appId).appName; - softButtons = sButtons; - rectangle.alertString = alertStrings.join('\n'); - timer.interval = duration; - rectangle.duration = duration; - timer.start(); - show(); - - progressIndicator.visible = !!showIndicator - progressIndicator.width = alertContent.width - console.log("ProgressIndicator.width:", progressIndicator.width) - animation.start() - } - } - - function show () { - dataContainer.activeAlert = true - dataContainer.applicationSavedContext = dataContainer.applicationContext - visible = true - } - - function complete (reason, data) { - if (!keep) { - hide() - switch (reason) { - case Common.Result.SUCCESS: - DBus.sendReply(async, { __retCode: Common.Result.SUCCESS, __message: "UI.Alert" }) - break - // For other cases - } - } - timer.stop() - } - - function hide() { - console.debug(popUpName, "HIDE") - dataContainer.activeAlert = false - dataContainer.applicationContext = dataContainer.applicationSavedContext - visible = false - } - - function restart() { - animation.restart(); - timer.restart(); - } - - property bool keep: false - - onKeepChanged: { - if (visible && !keep && !timer.running) { - hide() - } - } - - onVisibleChanged: { - if (visible) { - dataContainer.activePopup.push(popUpName) - } else { - for (var i in dataContainer.activePopup) { - if (dataContainer.activePopup[i] === popUpName) { - dataContainer.activePopup.splice(i, 1) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/ContextPopup.qml b/src/components/qt_hmi/qml_model_qt4/popups/ContextPopup.qml deleted file mode 100644 index a1ef64144d..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/ContextPopup.qml +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file ContextPopup.qml - * @brief Popup view with system context. - * 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. - */ - -import QtQuick 1.1 - -PopUp { - function show() { - console.debug("enter") - if (!visible) { // must not increment counter if show() called for visible popup - visible = true; - dataContainer.popups++ - } - console.debug("exit") - } - - function hide() { - console.debug("enter") - console.debug(popUpName, "HIDE") - if (visible) { // must not decrement counter if hide() called for invisible popup - visible = false; - dataContainer.popups-- - } - console.debug("exit") - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/ExitAllApplicationsPopup.qml b/src/components/qt_hmi/qml_model_qt4/popups/ExitAllApplicationsPopup.qml deleted file mode 100644 index 17e5de50b7..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/ExitAllApplicationsPopup.qml +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @file ExitAllApplicationsPopup.qml - * @brief Popup "Exit all applications" - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../controls" - -PopUp { - function complete(reason){ - hide() - } - - Item { - ListModel { - id: reasonExit - - Component.onCompleted: { - for (var name in Common.ApplicationsCloseReason) { - append({name: name}); - } - } - } - } - - Column - { - anchors.centerIn: parent - Row { - Text { - text: "Select reason: " - color: "white" - } - - ComboBox { - id: reasonComboBox - model: reasonExit - } - z: 1000 - } - OvalButton { - text: "Exit" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - sdlBasicCommunication.onExitAllApplications(Common.ApplicationsCloseReason[reasonComboBox.currentText]) - hide() - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/InteractionPopup.qml b/src/components/qt_hmi/qml_model_qt4/popups/InteractionPopup.qml deleted file mode 100644 index 7a5c53501e..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/InteractionPopup.qml +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @file InteractionPopup.qml - * @brief Interaction popup view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -ContextPopup { - Text { - id: initialText - text: dataContainer.interactionModel.initialText - anchors.top: parent.top - anchors.topMargin: Constants.popupMargin - anchors.left: parent.left - anchors.leftMargin: Constants.popupMargin - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - ListView { - anchors.top: initialText.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.popupMargin - model: dataContainer.interactionModel.choice - delegate: OvalButton { - width: parent.width - text: name - icon: image - onClicked: { - complete(Common.Result.SUCCESS, {"choiceID": id}) - } - } - } - - Item { - Timer { - id: timer - onTriggered: { - complete(Common.Result.TIMED_OUT) - } - } - } - - function activate () { - console.debug("enter") - timer.interval = dataContainer.interactionModel.timeout - timer.start() - show() - console.debug("exit") - } - - function complete (reason, data) { - console.debug("enter") - switch (reason) { - case Common.Result.SUCCESS: - DBus.sendReply(dataContainer.interactionModel.async, data) - break - case Common.Result.ABORTED: - DBus.sendReply(dataContainer.interactionModel.async, { __retCode: Common.Result.ABORTED }) - break - case Common.Result.TIMED_OUT: - DBus.sendReply(dataContainer.interactionModel.async, { __retCode: Common.Result.TIMED_OUT }) - break - } - timer.stop() - hide() - console.debug("exit") - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/PerformAudioPassThruPopup.qml b/src/components/qt_hmi/qml_model_qt4/popups/PerformAudioPassThruPopup.qml deleted file mode 100644 index e65519d363..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/PerformAudioPassThruPopup.qml +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @file PerformAudioPassThruPopup.qml - * @brief Popup for audio pass thru - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../controls" - -ContextPopup { - property variant async - - function showAudioPassThru(){ - console.debug("entered") - dataContainer.uiAudioPassThru.running = true - show() - if (dataContainer.uiAudioPassThru.timeout) { - timer.start() - } - console.debug("exited") - } - - function complete(reason){ - console.debug("enter", reason) - timer.stop() - dataContainer.uiAudioPassThru.timeout = 0 - dataContainer.uiAudioPassThru.running = false - switch (reason) { - case Common.Result.ABORTED: - console.debug("exit with abort") - DBus.sendError(async, Common.Result.ABORTED) - break; - case Common.Result.SUCCESS: - console.debug("exit with success") - DBus.sendReply(async, {}) - break; - case Common.Result.RETRY: - console.debug("exit with retry") - DBus.sendError(async, Common.Result.RETRY) - break; - } - hide() - } - - - Column { - spacing: Constants.generalSpacing - anchors.centerIn: parent - Timer { - id: timer - interval: dataContainer.uiAudioPassThru.timeout - onTriggered: { - complete(Common.Result.SUCCESS) - } - } - - Text { - id: appNameText - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiAudioPassThru.appName - color: Constants.primaryColor - font.pixelSize: Constants.fontSize * 2 - } - - Row { - spacing: Constants.generalSpacing - Image { - source: "../res/controlButtons/vrImage.png" - } - - Column { - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiAudioPassThru.firstLine - color: Constants.audioPassThruTextColor - font.pixelSize: Constants.fontSize - } - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiAudioPassThru.secondLine - color: Constants.audioPassThruTextColor - font.pixelSize: Constants.fontSize - } - } - } - - - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: Constants.generalSpacing - - OvalButton { - text: "Retry" - fontSize: Constants.fontSize - onClicked: { - complete(Common.Result.RETRY) - } - } - - OvalButton { - text: "Done" - fontSize: Constants.fontSize - onClicked: { - complete(Common.Result.SUCCESS) - } - } - } - - OvalButton { - text: "Close" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - console.debug("enter") - complete(Common.Result.ABORTED) - console.debug("exit") - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/PopUp.qml b/src/components/qt_hmi/qml_model_qt4/popups/PopUp.qml deleted file mode 100644 index 07f8c98011..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/PopUp.qml +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @file PopUp.qml - * @brief General popup view. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -Item { - default property alias content: content.children - property int padding: Constants.popUpPadding - property string popUpName - - visible: false - - width: Constants.popupWidth - height: Constants.popupHeigth - - MouseArea { anchors.fill: parent } - - Rectangle { - width: parent.width - padding / 2 - height: parent.height - padding / 2 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - color: Constants.secondaryColor - border.width: 1 - border.color: Constants.popUpBorderColor - radius: padding - Rectangle { - id: content - width: parent.width - padding - height: parent.height - padding - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - color: Constants.transparentColor - } - } - - onVisibleChanged: { - if (popUpName) { - if (visible) { - dataContainer.activePopup.push(popUpName) - } else { - for (var i in dataContainer.activePopup) { - if (dataContainer.activePopup[i] === popUpName) { - dataContainer.activePopup.splice(i, 1) - } - } - } - } - } - - function show() { - console.debug("enter"); - visible = true; - console.debug("exit"); - } - - function hide() { - console.debug("enter"); - visible = false; - console.debug("exit"); - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/SliderPopup.qml b/src/components/qt_hmi/qml_model_qt4/popups/SliderPopup.qml deleted file mode 100644 index 6dcd222ed3..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/SliderPopup.qml +++ /dev/null @@ -1,214 +0,0 @@ -/** - * @file ExitAllApplicationsPopup.qml - * @brief Popup "Exit all applications" - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../controls" - -ContextPopup { - property variant async - property int position: 1 - /** - * Test Support Section - */ - property int resultCode: -1 - signal onReady - /** - * Test Support Section End - */ - - function showSlider(){ - console.debug("enter") - - dataContainer.uiSlider.running = true - dataContainer.applicationSavedContext = dataContainer.applicationContext - if(dataContainer.uiSlider.footer.length === 0 || dataContainer.uiSlider.position === 0 ) { - footerText.text = "" - } else { - footerText.text = dataContainer.uiSlider.footer.length === 1 ? dataContainer.uiSlider.footer[0] : dataContainer.uiSlider.footer[dataContainer.uiSlider.position - 1] - } - position = dataContainer.uiSlider.position - show() - timer.start() - onReady() - console.debug("exit") - } - - function complete(reason){ - console.debug("enter reason = ", reason) - timer.stop() - dataContainer.applicationContext = dataContainer.applicationSavedContext - dataContainer.uiSlider.running = false - switch(reason) { - case Common.Result.ABORTED: - console.debug("aborted position is", position) - resultCode = Common.Result.ABORTED - DBus.sendReply(async, {__retCode: resultCode, sliderPosition: position}) - break - case Common.Result.SUCCESS: - console.debug("send position", position) - resultCode = Common.Result.SUCCESS - dataContainer.uiSlider.position = position - DBus.sendReply(async, {sliderPosition:position}) - break - default: - break - } - hide() - position = 1 - console.debug("exit") - } - - - Column - { - spacing: Constants.generalSpacing - anchors.centerIn: parent - Timer { - id: timer - interval: dataContainer.uiSlider.timeout - onTriggered: { - console.debug("triggered") - complete(Common.Result.SUCCESS) - } - } - - Text { - id: appNameText - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiSlider.appName - color: Constants.primaryColor - font.pixelSize: Constants.fontSize * 2 - } - - Text { - id: headerText - width: borderRectangle.width - elide: Text.ElideRight - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiSlider.header - color: Constants.sliderTextColor - font.pixelSize: Constants.fontSize * 2 - } - - Rectangle { - id: borderRectangle - width: Constants.sliderBarWidth - height: Constants.sliderBarHeight - anchors.horizontalCenter: parent.horizontalCenter - border.color: Constants.sliderBarBorderColor - border.width: Constants.sliderBarBorderWidth - radius: Constants.sliderBarRadius - color: "black" - - Rectangle { - id: rectangle - color: Constants.sliderBarFillColor - height: parent.height - border.color: parent.border.color - border.width: parent.border.width - radius: parent.radius - - onVisibleChanged: { - var tickWidth = borderRectangle.width / dataContainer.uiSlider.numTicks - rectangle.width = dataContainer.uiSlider.position * tickWidth - } - } - - MouseArea{ - id: mouseArea - anchors.fill: parent - onClicked: { - onPositionChanged(mouse) - } - - onPositionChanged: { - if(mouseX <= 0){ - rectangle.width = borderRectangle.width / dataContainer.uiSlider.numTicks - position = 1 - } - - if(mouseX > borderRectangle.width) { - rectangle.width = borderRectangle.width - position = dataContainer.uiSlider.numTicks - } - - if(mouseX > 0 && mouseX < borderRectangle.width) { - var tickWidth = borderRectangle.width / dataContainer.uiSlider.numTicks - position = Math.ceil(mouseX / tickWidth) - rectangle.width = position * tickWidth - } - - if(dataContainer.uiSlider.footer.length > 1){ - footerText.text = dataContainer.uiSlider.footer[position - 1] - } - } - } - } - - Text { - id:footerText - width: borderRectangle.width - elide: Text.ElideRight - anchors.horizontalCenter: parent.horizontalCenter - text: "" - color: Constants.sliderTextColor - font.pixelSize: Constants.fontSize * 2 - } - - OvalButton { - text: "Close" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - console.debug("enter") - complete(Common.Result.ABORTED) - console.debug("exit") - } - } - } - - function getTimer() { - return timer - } - function getBackButton() { - return backButton - } - function getFooterText() { - return footerText - } - function getBorderRectangle() { - return borderRectangle - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/TBTClientStatePopUp.qml b/src/components/qt_hmi/qml_model_qt4/popups/TBTClientStatePopUp.qml deleted file mode 100644 index 9a833b19e7..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/TBTClientStatePopUp.qml +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @file TBTClientStatePopUp.qml - * @brief Popup view for TBT interface (list of states). - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -PopUp { - Item { - ListModel { - id: tbtState - - Component.onCompleted: { - for (var name in Common.TBTState) { - append({name: name}); - } - } - } - } - Text { - text: "TBT Client State" - verticalAlignment: Text.AlignVCenter - anchors.right: parent.right - anchors.left: parent.left - anchors.top: parent.top - color: Constants.primaryColor - } - ComboBox { - id: comboBox - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - model: tbtState - onCurrentTextChanged: { - console.log("Send signal onTBTClientState:", currentText); - sdlNavigation.onTBTClientState(Common.TBTState[currentText]); - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/TTSPopUp.qml b/src/components/qt_hmi/qml_model_qt4/popups/TTSPopUp.qml deleted file mode 100644 index ce64a6be89..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/TTSPopUp.qml +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file TTSPopUp.qml - * @brief Popup view for TTS - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -PopUp { - height: Constants.ttsPopUpHeight - width: Constants.ttsPopUpWidth - padding: Constants.ttsPopUpPadding - property variant async - - ScrollableText { - id: text - anchors.fill: parent - } - - resources: [ - Timer { - id: timer - interval: Constants.ttsSpeakTime - onTriggered: deactivate() - } - ] - - function activate(message) { - console.debug("Activate TTS popup:", message); - dataContainer.activeTTS = true; - text.text = message; - show(); - timer.restart(); - console.debug("Exit"); - } - - function deactivate() { - console.debug("Deactivate TTS popup"); - dataContainer.activeTTS = false; - text.text = ''; - timer.stop(); - hide(); - DBus.sendReply(async, {}); - async = null; - console.debug("Exit"); - } -} - diff --git a/src/components/qt_hmi/qml_model_qt4/popups/VRHelpPopup.qml b/src/components/qt_hmi/qml_model_qt4/popups/VRHelpPopup.qml deleted file mode 100644 index 8718c8cd69..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/VRHelpPopup.qml +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @file VRHelpPopup.qml - * @brief Popup view for VR help - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common - -PopUp { - Text { - id: title - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.popupMargin - text: "VR HELP" // default title - font.pixelSize: Constants.titleFontSize - color: Constants.primaryColor - } - - ScrollableListView { - anchors.top: title.bottom - anchors.bottom: closeButton.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.popupMargin - - model: dataContainer.vrHelp - - delegate: Row { - spacing: Constants.iconItemListSpacing - Icon { - source: model.icon - width: Constants.iconItemListSize - height: Constants.iconItemListSize - } - - Text { - text: model.text - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - } - } - } - - OvalButton { - id: closeButton - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.margins: Constants.popupMargin - width: Constants.ovalButtonWidth - text: "Close" - onClicked: complete() - } - - property alias title: title.text - - function complete(reason, data) { - hide() - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/VRPopUp.qml b/src/components/qt_hmi/qml_model_qt4/popups/VRPopUp.qml deleted file mode 100644 index 8a8be54be7..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/VRPopUp.qml +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @file VRPopUp.qml - * @brief Popup view for VR interface (list commands). - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../views" -import "../controls" - -PopUp { - Text { - id: title - anchors.left: parent.left - anchors.top: parent.top - height: voice.height - width: parent.width - voice.width - text: "Speak the command" - verticalAlignment: Text.AlignVCenter - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - Image { - id: voice - anchors.top: parent.top - anchors.right: parent.right - source: "../res/controlButtons/vrImage.png" - } - - ScrollableListView { - anchors.bottomMargin: Constants.popupMargin - anchors.rightMargin: Constants.popupMargin - anchors.leftMargin: Constants.popupMargin - anchors.top: voice.bottom - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.left: parent.left - - model: dataContainer.vrCommands - - delegate: OvalButton { - width: parent.width - text: command - onClicked: { - sdlVR.onCommand(cmdID, appID === 0 ? undefined : appID); - } - } - } - - function activate() { - dataContainer.activeVR = true; - sdlVR.started(); - show(); - } - - function complete(reason) { - dataContainer.activeVR = false; - sdlVR.stopped(); - hide(); - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/popups/VehicleInfoPopUp.qml b/src/components/qt_hmi/qml_model_qt4/popups/VehicleInfoPopUp.qml deleted file mode 100644 index f4582c28ca..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/popups/VehicleInfoPopUp.qml +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @file VIPopUp.qml - * @brief Pop up window with information about vehicle. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../controls" - -PopUp { - //TODO{ALeshin}: Redraw this window as ListView or Column, when we'll get requirements - Column { - anchors.fill: parent - Text { - id: viText - width: parent.width - height: 1/5 * parent.height - text: "Vehicle Information" - font.pixelSize: Constants.fontSize - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - color: Constants.primaryColor - } - - Row { - height: 1/5 * parent.height - width: parent.width - - Text { - width: 1/4 * parent.width - height: 1/5 * parent.height - anchors.verticalCenter: parent.verticalCenter - text: "PRNDL: " - font.pixelSize: Constants.fontSize - verticalAlignment: Text.AlignVCenter - color: Constants.primaryColor - } - - ComboBox { - anchors.verticalCenter: parent.verticalCenter - id: comboBox - model: prndlList - - onCurrentIndexChanged: { - console.debug("PRNDL:", currentIndex) - dataContainer.vehicleInfoModel.prndl = model.get(currentIndex).id - } - - textRole: "name" - ListModel { - id: prndlList - Component.onCompleted: { - append({ id: -1, name: "<NO DATA (prndl)>" }) - for (var name in Common.PRNDL) { - append({ id: Common.PRNDL[name], name: name }); - } - } - } - } - z: 1000 - } - - Text { - width: parent.width - height: 1/5 * parent.height - text: "ECU 1: " + dataContainer.vehicleInfoModel.ecuDIDData.data1 - font.pixelSize: Constants.fontSize - verticalAlignment: Text.AlignVCenter - color: Constants.primaryColor - } - - Text { - width: parent.width - height: 1/5 * parent.height - text: "ECU 2: " + dataContainer.vehicleInfoModel.ecuDIDData.data2 - font.pixelSize: Constants.fontSize - verticalAlignment: Text.AlignVCenter - color: Constants.primaryColor - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/qml_model.qmlproject b/src/components/qt_hmi/qml_model_qt4/qml_model.qmlproject deleted file mode 100644 index ea820e8019..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/qml_model.qmlproject +++ /dev/null @@ -1,20 +0,0 @@ -/* File generated by Qt Creator, version 2.7.0 */ - -import QmlProject 1.1 - -Project { - mainFile: "MainWindow.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "../res" - } - /* List of plugin directories passed to QML runtime */ - importPaths: [ "." ] -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/AMPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/AMPlayerView.qml deleted file mode 100644 index 4a29168881..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/AMPlayerView.qml +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file AMPlayerView.qml - * @brief AM player screen view. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common - -GeneralView { - category: Common.DeactivateReason.AUDIO - RadioPlayer { - id: amRadioPlayer - anchors.fill: parent - radioType: "AM" - radioName: "AM Radio" - - playerState: dataContainer.amPlayerState - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/ApplicationListView.qml b/src/components/qt_hmi/qml_model_qt4/views/ApplicationListView.qml deleted file mode 100644 index 19ecf4ca47..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/ApplicationListView.qml +++ /dev/null @@ -1,123 +0,0 @@ -/** - * @file ApplicationListView.qml - * @brief Application list view - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -GeneralView { - Column { - anchors.fill: parent - Item { - // top 1/4 of screen - width: parent.width - height: 1/4 * parent.height - - PagedFlickable { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - elementWidth: Constants.ovalButtonWidth - snapTo: elementWidth + spacing - spacing: (width - 4 * elementWidth) / 3 - - OvalButton { - text: "Find New Apps" - } - - OvalButton { - text: "Change device" - onReleased: contentLoader.go("./views/ChangeDeviceView.qml") - } - - OvalButton { - text: "911 Assist" - } - - OvalButton { - text: "Vehicle Health Report" - } - - OvalButton { - text: "Install applications/Up" - } - } - } - - Item { - height: parent.height / 2 - width: parent.width - - ScrollableListView { - id: applicationListView - anchors.fill: parent - model: dataContainer.applicationList - - delegate: Item { - width: parent.width - height: Math.max(applicationName.height, appIcon.height) - Image { - id: appIcon - source: icon - height: Constants.appListIconSize - width: height - } - ClickableText { - id: applicationName - text: appName - defaultColor: Constants.primaryColor - pressedColor: Constants.primaryColorPressed - font.pixelSize: Constants.appListFontSize - anchors.verticalCenter: parent.verticalCenter - anchors.left: appIcon.right - anchors.leftMargin: Constants.margin - onClicked: { - dataContainer.setCurrentApplication(appId) - dataContainer.currentApplication.isMediaApplication ? contentLoader.go("./views/SDLPlayerView.qml", dataContainer.currentApplication.appId) - : contentLoader.go("./views/SDLNonMediaView.qml", dataContainer.currentApplication.appId) - } - } - } - } - } - - Item { - // bottom 1/4 of screen - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/BTPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/BTPlayerView.qml deleted file mode 100644 index 0a5390e920..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/BTPlayerView.qml +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file BTPlayerView.qml - * @brief FM player screen view. - * 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. - */ -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: btPlayer - playerName: "BT Audio" - anchors.fill: parent - - playerState: dataContainer.btPlayerState - image: playerState.albumImage - - buttons: [ - OvalButton { - text: btPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/CDPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/CDPlayerView.qml deleted file mode 100644 index f582ff2f7e..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/CDPlayerView.qml +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file CDPlayerView.qml - * @brief CD player screen view. - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: cdPlayer - playerName: "CD" - anchors.fill: parent - image: playerState.albumImage - playerState: dataContainer.cdPlayerState - - buttons: [ - OvalButton { - text: cdPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/CarMenuGridView.qml b/src/components/qt_hmi/qml_model_qt4/views/CarMenuGridView.qml deleted file mode 100644 index 9b04b1bad7..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/CarMenuGridView.qml +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file CarMenuGridView.qml - * @brief Car menu screen view. - * 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. - */ -import QtQuick 1.1 -import "../models" -import "../controls" - -GridMenu { - id: menu - model: CarMenuModel { } - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - ClickableImage { - anchors.centerIn: parent - source: icon - onClicked: { - if(qml !== "") { - contentLoader.go(qml) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/ChangeDeviceView.qml b/src/components/qt_hmi/qml_model_qt4/views/ChangeDeviceView.qml deleted file mode 100644 index 643b074506..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/ChangeDeviceView.qml +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @file ChangeDeviceView.qml - * @brief Screen view with list of available devices. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - Text { - id: searchDeviceText - anchors.left: parent.left - anchors.top: parent.top - height: 1/4 * parent.height - width: parent.width - color: Constants.primaryColor - font.pixelSize: Constants.titleFontSize - text: "Devices available:" - verticalAlignment: Text.AlignVCenter - } - - ListView { - id: changeDeviceListView - anchors.left: parent.left - anchors.top: searchDeviceText.bottom - model: dataContainer.deviceList - width:parent.width - height:parent.height - searchDeviceText.height - - delegate: Text { - MouseArea { - anchors.fill: parent - onClicked: { - sdlBasicCommunication.onDeviceChosen({ name: name, id: devid }); - sdlBasicCommunication.onFindApplications({ name: name, id: devid }) - contentLoader.go("./views/ApplicationListView.qml") - } - } - text: name - color: Constants.primaryColor - font.pixelSize: Constants.titleFontSize - } - } - } - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent } - } - - Component.onCompleted: { - console.log("ChangeDeviceView Component.onCompleted enter"); - sdlBasicCommunication.onStartDeviceDiscovery(); - console.log("ChangeDeviceView Component.onCompleted exit"); - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/ClimateControlView.qml b/src/components/qt_hmi/qml_model_qt4/views/ClimateControlView.qml deleted file mode 100644 index 01c289b139..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/ClimateControlView.qml +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @file ClimateControlView.qml - * @brief Screen view of climat menu. - * 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. - */ - -import QtQuick 1.1 -import "../controls" - -GeneralView { - Item { - id: climatMenu - anchors.fill: parent - - Item { - height: parent.height - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - Column { - id: leftItem - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 1/4*parent.width - useThisToGetButtonSize.width - - Row { - ClimateControlBtn {name: "heated_seat"} - ClimateControlBtn {name: "heated_wheel"} - } - Row { - ClimateControlBtn {name: "AC"} - ClimateControlBtn {name: "headed_dash"} - } - } - - Column { - id: centralItem - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - ClimateControlBtn {id: useThisToGetButtonSize; name: "defrost"; state: "on"} - ClimateControlBtn {name: "face"; state: "on"} - ClimateControlBtn {name: "feet"} - } - - Row { - id: rightItem - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: 1/4*parent.width - useThisToGetButtonSize.width - - ClimateControlBtn { - anchors.verticalCenter: parent.verticalCenter - txt: "Dual" - state: "on" - } - - Column { - ClimateControlBtn { name: "heated_seat" } - ClimateControlBtn { name: "AC" } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/ContactsListView.qml b/src/components/qt_hmi/qml_model_qt4/views/ContactsListView.qml deleted file mode 100644 index a2b2be590b..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/ContactsListView.qml +++ /dev/null @@ -1,118 +0,0 @@ -/** - * @file ContactsListView.qml - * @brief Contact list screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -GeneralView { - function setCurrent(firstLetter){ - for(var i = 0; i < contactsListView.count; i ++) { - if (contactsListView.model.get(i).name[0].toUpperCase() === firstLetter) { - contactsListView.positionViewAtIndex(i, ListView.Beginning) - break; - } - } - } - Component.onCompleted: setCurrent(dataContainer.contactsFirstLetter) - - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - ScrollableListView { - id: contactsListView - anchors.fill: parent - clip: true - spacing: 1/2 * Constants.fontSize - model: ContactsListModel { } - - section.property: "name" - section.criteria: ViewSection.FirstCharacter - section.delegate: Text { - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - text: section.toUpperCase() - } - - delegate: Item { - anchors.left: parent.left - width: parent.width - Constants.scrollBarWidth - height: typeText.height - - Text { - id: contactName - anchors.left: parent.left - text: name - width: Constants.contactListNameFieldSize * parent.width - color: Constants.contactTextColor - font.pixelSize: Constants.fontSize - elide: Text.ElideRight - } - Text { - id: phoneText - anchors.left: contactName.right - width: Constants.contactListPhoneFieldSize * parent.width - text: phone - color: Constants.contactTextColor - font.pixelSize: Constants.fontSize - horizontalAlignment: Text.AlignHCenter - } - Text { - id: typeText - anchors.right: parent.right - width: Constants.contactListDescriptionFieldSize * parent.width - text: type - color: Constants.contactTextColor - font.pixelSize: Constants.fontSize - horizontalAlignment: Text.AlignHCenter - } - } - } - } - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/FMPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/FMPlayerView.qml deleted file mode 100644 index 5c3ca6a5a9..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/FMPlayerView.qml +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @file FMPlayerView.qml - * @brief FM player screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -GeneralView { - category: Common.DeactivateReason.AUDIO - RadioPlayer { - id: fmRadioPlayer - anchors.fill: parent - radioType: "FM" - radioName: "FM Radio" - - playerState: dataContainer.fmPlayerState - - property int hdButtonValue: 1 - - buttonHD: [ - Image { - id: hdButton - anchors.bottom: parent.bottom - anchors.left: parent.left - source: "../res/buttons/long_oval_btn.png" - property string textColor: Constants.primaryColor - - Row { - anchors.centerIn: parent - spacing: (hdButton.width - hdLogo.width - one.width - two.width - three.width - four.width) / 10 - - Image { - id: hdLogo - anchors.verticalCenter: parent.verticalCenter - source:"../res/hd_logo_on.png" - } - - Text { - id: one - anchors.verticalCenter: parent.verticalCenter - text: "1" - color: fmRadioPlayer.hdButtonValue === 1 ? "white" : hdButton.textColor - font.pixelSize: Constants.fontSize - } - - Text { - id: two - anchors.verticalCenter: parent.verticalCenter - text: "2" - color: fmRadioPlayer.hdButtonValue === 2 ? "white" : hdButton.textColor - font.pixelSize: Constants.fontSize - } - - Text { - id: three - anchors.verticalCenter: parent.verticalCenter - text: "3" - color: fmRadioPlayer.hdButtonValue === 3 ? "white" : hdButton.textColor - font.pixelSize: Constants.fontSize - } - - Text { - id: four - anchors.verticalCenter: parent.verticalCenter - text: "4" - color: fmRadioPlayer.hdButtonValue === 4 ? "white" : hdButton.textColor - font.pixelSize: Constants.fontSize - } - } - - MouseArea { - anchors.fill: parent - onPressed: { - hdLogo.source = "../res/hd_logo_off.png" - hdButton.source = "../res/buttons/long_oval_pressed_btn.png" - hdButton.textColor = Constants.secondaryColor - - } - onReleased: { - hdLogo.source = "../res/hd_logo_on.png" - hdButton.source = "../res/buttons/long_oval_btn.png" - hdButton.textColor = Constants.primaryColor - fmRadioPlayer.hdButtonValue === 4 ? fmRadioPlayer.hdButtonValue = 1 : fmRadioPlayer.hdButtonValue++ - } - } - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/GeneralView.qml b/src/components/qt_hmi/qml_model_qt4/views/GeneralView.qml deleted file mode 100644 index 40f809299d..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/GeneralView.qml +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file GeneralView.qml - * @brief Base view class. Defines properties and behavior common for all views - * 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. - */ - -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common - -Item { - /// HMI context view is related to - property int systemContext: Common.SystemContext.SYSCTXT_MAIN - /// True if view is in application context - property bool applicationContext: false - /// View category for AppDeactivated notification (reason) - property int category: Common.DeactivateReason.GENERAL -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/GridMenu.qml b/src/components/qt_hmi/qml_model_qt4/views/GridMenu.qml deleted file mode 100644 index 4cc2f4f615..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/GridMenu.qml +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file GridMenu.qml - * @brief Parent class for main menu. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -GeneralView { - id: main - property alias model: repeater.model - property alias delegate: repeater.delegate - property alias rows: grid.rows - property int columnsOnPage: Constants.menuColumnCount - - Flickable { - id: flicker - anchors.fill: parent - contentWidth: grid.width - flickableDirection: Flickable.HorizontalFlick - - Grid { - id: grid - anchors.centerIn: parent - rows: Constants.menuRowCount - columns: Math.ceil(model.count / rows) - flow: Grid.TopToBottom - Repeater { - id: repeater - } - } - - property int snapTo: width / parent.columnsOnPage - onMovementEnded: { - var rest = flicker.contentX % snapTo - var time = 0.25 - if (rest > flicker.snapTo / 2) { rest = rest - flicker.snapTo } - var vel = 2 * rest / time - flickDeceleration = Math.abs(vel) / time - flick(vel, 0) - flickDeceleration = 1500 - } - } - - Pager { - id: pager - space: 10 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: Constants.margin - - pages: Math.ceil(grid.columns / parent.columnsOnPage) - activePage: Internal.activePageChoose(flicker, pager.pages) - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/HardwareButtonsView.qml b/src/components/qt_hmi/qml_model_qt4/views/HardwareButtonsView.qml deleted file mode 100644 index 83f1ffcd01..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/HardwareButtonsView.qml +++ /dev/null @@ -1,173 +0,0 @@ -/** - * @file HardwareButtonsView.qml - * @brief Area of screen responsible for hardware buttons - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -Rectangle { - height: row.height + row.anchors.margins - anchors.left: parent.left - anchors.right: parent.right - color: Constants.panelColor - - signal buttonDown(string name) - signal buttonUp(string name) - - function pressButton(name) { - buttonDown(name) - } - - function longPressButton(name) { - console.log("long press " + name) - } - - function releaseButton(name) { - buttonUp(name) - } - - Row { - id: row - spacing: Constants.panelPadding - anchors.centerIn: parent - anchors.margins: Constants.panelPadding - - PowerSwitchButton {anchors.verticalCenter: parent.verticalCenter} - - MaskedButton { - name: "vr" - anchors.verticalCenter: parent.verticalCenter - onReleased: { - console.debug("Clicked VR button"); - if (!dataContainer.activeVR) { - vrPopUp.activate(); - } else { - vrPopUp.complete(); - } - } - } - - ArrowKeys {anchors.verticalCenter: parent.verticalCenter} - - Grid { - columns: 5 - rows: 2 - spacing: 5 - anchors.verticalCenter: parent.verticalCenter - Repeater { - model: 10 - delegate : Rectangle { - width: 40 - height: 40 - radius: 5 - gradient: Gradient { - GradientStop - { - position: 0.0; - color: "#2c2c2c" - Behavior on position { - NumberAnimation { duration: 80 } - } - } - - GradientStop - { - position: 1.0; - color: "black" - Behavior on position { - NumberAnimation { duration: 80 } - } - } - } - - Text { - text: (1 + index) % 10 - font.pixelSize: 30 - color: Constants.panelTextColor - anchors.centerIn: parent - } - - Timer { - id: timer - interval: Constants.presetButtonTimer - repeat: false - triggeredOnStart: false - } - - MouseArea { - id: mouseArea - anchors.fill: parent - property bool clickProcessed - onPressed: { - parent.gradient.stops[0].position = 1.0 - parent.gradient.stops[1].position = 0.0 - clickProcessed = false - timer.start() - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + index, Common.ButtonEventMode.BUTTONDOWN, undefined) - } - onReleased: { - parent.gradient.stops[0].position = 0.0 - parent.gradient.stops[1].position = 1.0 - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + index, Common.ButtonEventMode.BUTTONUP, undefined) - timer.stop() - if (!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + index, Common.ButtonPressMode.SHORT, undefined) - } - } - Connections { - target: timer - onTriggered: { - if(!mouseArea.clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + index, Common.ButtonPressMode.LONG, undefined) - mouseArea.clickProcessed = true - } - } - } - } - - Component.onCompleted: { - settingsContainer.buttonCapabilities.push( - { - name: Common.ButtonName.PRESET_0 + index, - upDownAvailable: true, - shortPressAvailable: true, - longPressAvailable: true - }); - } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/IPodPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/IPodPlayerView.qml deleted file mode 100644 index 4d9b8091d7..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/IPodPlayerView.qml +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file IPodPlayerView.qml - * @brief IPod player screen view. - * 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. - */ -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: ipodPlayer - playerName: "iPod" - anchors.fill: parent - image: playerState.albumImage - playerState: dataContainer.ipodPlayerState - - buttons: [ - OvalButton { - text: ipodPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/LineInPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/LineInPlayerView.qml deleted file mode 100644 index eca575d6b1..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/LineInPlayerView.qml +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file LineInPlayerView.qml - * @brief LineIn player screen view. - * 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. - */ -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: lineInPlayer - playerName: "LineIn" - anchors.fill: parent - image: playerState.albumImage - playerState: dataContainer.linePlayerState - - buttons: [ - OvalButton { - text: lineInPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/MainMenuView.qml b/src/components/qt_hmi/qml_model_qt4/views/MainMenuView.qml deleted file mode 100644 index 321a67831c..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/MainMenuView.qml +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file MainMenuView.qml - * @brief Main menu screen view. - * 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. - */ -import QtQuick 1.1 -import "../models" -import "../controls" - -GridMenu { - id: menu - model: MainMenuListModel { } - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - ClickableImage { - anchors.centerIn: parent - source: icon - onClicked: { - if(qml !== "") { - contentLoader.go(qml) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/MediaClockView.qml b/src/components/qt_hmi/qml_model_qt4/views/MediaClockView.qml deleted file mode 100644 index 183798eb49..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/MediaClockView.qml +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file MediaClockView.qml - * @brief Media clock view - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -Item { - property alias time: timeText.text - Text { - id: timeText - anchors.left: parent.left - width: 1/10 * parent.width - anchors.verticalCenter: parent.verticalCenter - horizontalAlignment: Text.AlignRight - color: "white" - text: (mediaPlayerView.playerType === "SDL") ? Internal.hmsTimeToString(dataContainer.currentApplication.mediaClock.startTime) - : "02:36" //TODO {Aleshin}: get track time for all players except SDL - font.pixelSize: 18 - } - - Row { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - height: parent.height - width: 2/3 * parent.width - - Rectangle { - anchors.verticalCenter: parent.verticalCenter - height: 2 - width: dataContainer.currentApplication.mediaClock.progress * parent.width - color: "white" - } - - Rectangle { - anchors.verticalCenter: parent.verticalCenter - height: 2 - width: (1 - dataContainer.currentApplication.mediaClock.progress) * parent.width - color: Constants.primaryColor - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/MediaPlayer.qml b/src/components/qt_hmi/qml_model_qt4/views/MediaPlayer.qml deleted file mode 100644 index 866f5399cb..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/MediaPlayer.qml +++ /dev/null @@ -1,325 +0,0 @@ -/** - * @file MediaPlayerView.qml - * @brief Parent for BT, IPod, CD players screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -Item { - id: mediaPlayerView - - property string playerName: "" - property string playerType: "" - - signal rewind - signal forward - signal play - signal pause - - // Holds players state(song name, play/pause state, track number etc). For all players except SDL. - property PlayerState playerState; - - property alias buttons: buttonsRow.content - property alias buttonsSpacing: buttonsRow.spacing - property alias image: image.source - - Item { - // row of oval buttons - id: ovalButtonsRow - width: parent.width - height: 1/5 * parent.height - anchors.left: parent.left - anchors.top: parent.top - - PagedFlickable { - id: buttonsRow - width: parent.width - spacing: (mediaPlayerView.playerType === "SDL") ? ((width - 4 * elementWidth) / 3) - : (width - 2 * elementWidth) - anchors.verticalCenter: parent.verticalCenter - snapTo: Constants.ovalButtonWidth + spacing - elementWidth: Constants.ovalButtonWidth - } - } - - Item { - id: spacingBetweenItems - width: parent.width - height: 1/10 * parent.height - anchors.left: parent.left - anchors.top: ovalButtonsRow.bottom - - Behavior on height { - NumberAnimation { - duration : Constants.animationDuration - } - } - } - - Column { - // Picture + text information + media clock - id: mediaContent - width: parent.width - height: 2/5 * parent.height - anchors.left: parent.left - anchors.top: spacingBetweenItems.bottom - - Row { - // picture + text info - width: parent.width - height: 3/4 * parent.height - spacing: Constants.margin - - Image { - id: image - height: parent.height - width: height - } - - Column { - // text info - id: textInfo - height: parent.height - width: parent.width - image.width - parent.spacing - spacing: (height - titleText.height - 3 * text.height) / 3 - - Text { - id: titleText - anchors.left: parent.left - anchors.right: parent.right - horizontalAlignment: dataContainer.currentApplication.hmiUITextAlignment - color: Constants.primaryColor - text: (mediaPlayerView.playerType === "SDL") ? dataContainer.currentApplication.hmiUIText.mainField1 - : playerState.trackName - font.pixelSize: Constants.titleFontSize - font.bold: true - } - - Text { - id: text - anchors.left: parent.left - anchors.right: parent.right - horizontalAlignment: dataContainer.currentApplication.hmiUITextAlignment - color: Constants.primaryColor - text: (mediaPlayerView.playerType === "SDL") ? dataContainer.currentApplication.hmiUIText.mainField2 - : playerState.albumName - font.pixelSize: Constants.fontSize - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - horizontalAlignment: Text.AlignHCenter - color: Constants.primaryColor - text: (mediaPlayerView.playerType === "SDL") ? dataContainer.currentApplication.hmiUIText.mediaTrack - : playerState.trackNumber - font.pixelSize: Constants.fontSize - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: "Time to destination: " + dataContainer.navigationModel.timeToDestination - font.pixelSize: Constants.fontSize - horizontalAlignment: dataContainer.hmiUITextAlignment - visible: mediaPlayerView.playerType === "SDL" && dataContainer.navigationModel.timeToDestination - } - } - } - - MediaClockView { - width: parent.width - height: parent.height * 1/4 - } - } - - Item { - id: spacingBetweenItems2 - width: parent.width - height: 1/10 * parent.height - anchors.left: parent.left - anchors.top: mediaContent.bottom - - Behavior on height { - NumberAnimation { - duration : Constants.animationDuration - } - } - } - - Row { - // Rewind, play, pause, forward buttons - id: playPauseRewindForward - width: parent.width - height: 1/5 * parent.height - statusBar.height - anchors.left: parent.left - anchors.leftMargin: (width - playPauseButton.width - prevButton.width - nextButton.width) / 2 - anchors.top: spacingBetweenItems2.bottom - - Image { - id: prevButton - anchors.verticalCenter: parent.verticalCenter - source: "../res/buttons/player_prev_btn.png" - MouseArea { - anchors.fill: parent - onPressed: { - prevButton.source = "../res/buttons/player_prev_pressed_btn.png" - } - onReleased: { - prevButton.source = "../res/buttons/player_prev_btn.png" - } - } - } - - PlayPauseButton { - id: playPauseButton - anchors.verticalCenter: parent.verticalCenter - state: (mediaPlayerView.playerType === "SDL") ? dataContainer.currentApplication.playPauseState : playerState.playPauseState - onClicked: { - (state == 'Play') ? play() : pause(); - var newState = state === "Play" ? "Pause" : "Play"; - (mediaPlayerView.playerType === "SDL") ? dataContainer.setApplicationProperties(dataContainer.currentApplication.appId, { playPauseState: newState } ) - : playerState.playPauseState = newState - } - } - - Image { - id: nextButton - anchors.verticalCenter: parent.verticalCenter - source: "../res/buttons/player_next_btn.png" - MouseArea { - anchors.fill: parent - onPressed: { - nextButton.source = "../res/buttons/player_next_pressed_btn.png" - } - onReleased: { - nextButton.source = "../res/buttons/player_next_btn.png" - } - } - } - } - - Item { - id: presetButtons - width: parent.width - height: 1/5 * parent.height - anchors.top: playPauseRewindForward.bottom - anchors.left: parent.left - - PresetRow { - id: presetsRow - anchors.top: parent.top - anchors.left: parent.left - presets: mediaPlayerView.playerType === "SDL" ? Internal.getArrayForPresetRow() : [] - width: parent.width - property bool clickProcessed - - Timer { - id: timer - interval: Constants.presetButtonTimer - repeat: false - triggeredOnStart: false - onTriggered: { - console.log("preset button hold") - presetsRow.clickProcessed = true - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + presetsRow.selectedIndex, Common.ButtonPressMode.LONG, undefined) - } - } - - onPresetButtonPressed: { - console.log("preset button pressed") - timer.start() - clickProcessed = false - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonEventMode.BUTTONDOWN, undefined) - } - - onPresetButtonReleased: { - console.log("preset button released") - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonEventMode.BUTTONUP, undefined) - timer.stop() - if (!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonPressMode.SHORT, undefined) - } - } - } - } - - StatusBar { - id: statusBar - anchors.left: parent.left - anchors.bottom: parent.bottom - } - - states: [ - State { - name: 'presetButtonsON' - when: (dataContainer.currentApplication.customPresets.count > 0) && (mediaPlayerView.playerType === "SDL") - PropertyChanges { - target: spacingBetweenItems - height: 1 - } - PropertyChanges { - target: spacingBetweenItems2 - height: 1 - } - PropertyChanges { - target: presetButtons - visible: true - enabled: true - } - }, - - State { - name: 'presetButtonsOFF' - when: (dataContainer.currentApplication.customPresets.count === 0) || (mediaPlayerView.playerType !== "SDL") - PropertyChanges { - target: spacingBetweenItems - height: 1/10 * mediaPlayerView.height - } - PropertyChanges { - target: spacingBetweenItems2 - height: 1/10 * mediaPlayerView.height - } - PropertyChanges { - target: presetButtons - visible: false - enabled: false - } - } - ] -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/MusicSourceView.qml b/src/components/qt_hmi/qml_model_qt4/views/MusicSourceView.qml deleted file mode 100644 index c9c30e200c..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/MusicSourceView.qml +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @file MusicSourceView.qml - * @brief Music source screen view. - * 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. - */ -import QtQuick 1.1 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - GridMenu { - id: menu - model: dataContainer.musicSourceModel - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: bottomPanel.top - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - OvalButton { - text: title - onReleased: contentLoader.go(qml, appId) - anchors.centerIn: parent - fontSize: Constants.fontSize - } - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} - - - diff --git a/src/components/qt_hmi/qml_model_qt4/views/NavigationInRouteGridView.qml b/src/components/qt_hmi/qml_model_qt4/views/NavigationInRouteGridView.qml deleted file mode 100644 index 6d5ad5027f..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/NavigationInRouteGridView.qml +++ /dev/null @@ -1,250 +0,0 @@ -/** - * @file NavigationInRouteGridView.qml - * @brief Navigation in route screen veiw. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - - -GeneralView { - Item { - id: navInRoute - anchors.fill: parent - - Image { - // 3/4 top screen - id: map - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - source: "../res/nav/map.png" - - Image { - id: compas - anchors.bottom: parent.bottom - anchors.bottomMargin: 1/4 * compas.width - anchors.left: parent.left - anchors.leftMargin: 1/4 * compas.width - source: "../res/nav/compass.png" - } - - Column { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: compas.horizontalCenter - spacing: 1/8 * parent.height - - // Zoom "+" button - Image { - id: zoomIn - source: "../res/buttons/zoom.png" - - Text { - id: zoomInBtn - anchors.centerIn: parent - text: "+" - color: Constants.releasedButtonTextColor - font.pixelSize: 30 - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/zoom_pressed.png" - zoomInBtn.color = Constants.pressedButtonTextColor - } - onReleased: { - parent.source = "../res/buttons/zoom.png" - zoomInBtn.color = Constants.releasedButtonTextColor - } - - onClicked: { - //Some behavior - } - } - } - - // Zoom "-" button - Image { - id: zoomOut - source: "../res/buttons/zoom.png" - - Text { - id: zoomOutBtn - anchors.centerIn: parent - text: "-" - color: "white" - font.pixelSize: 30 - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/zoom_pressed.png" - zoomOutBtn.color = Constants.pressedButtonTextColor - } - onReleased: { - parent.source = "../res/buttons/zoom.png" - zoomOutBtn.color = Constants.releasedButtonTextColor - } - - onClicked: { - //Some behavior - } - } - } - } // column - - // Options button - Image { - id: navOptions - anchors.top: parent.top - anchors.right: parent.right - source: "../res/nav/options.png" - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/nav/options_pressed.png" - } - onReleased: { - parent.source = "../res/nav/options.png" - } - onClicked: { - //Options screen - } - } - } - } //map - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - Image { - id: muteBtnImg - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 1/4 * muteBtnImg.width - source: "../res/nav/mute_off.png" - MouseArea { - anchors.fill: parent - onClicked: if (muteBtnImg.state === "off") { - muteBtnImg.state = "on" - muteBtnImg.source = "../res/nav/mute_off.png" - } - else { - muteBtnImg.source = "../res/nav/mute_on.png" - muteBtnImg.state = "off" - } - } - } - - Image { - id: turnArrow - anchors.verticalCenter: parent.verticalCenter - anchors.left: muteBtnImg.right - anchors.leftMargin: 1/20 * contentLoader.width - source: "../res/nav/turnArrow.png" - } - - Text { - id: street - anchors.verticalCenter: cancel.verticalCenter - anchors.left: turnArrow.right - anchors.leftMargin: 1/20 * contentLoader.width - text: "0.2 mi on Cherry Hill Rd." - color: "White" - font.pixelSize: 20 - } - - Text { - id: timeToDest - anchors.verticalCenter: cancel.verticalCenter - anchors.right: cancel.left - anchors.rightMargin: 1/20 * contentLoader.width - text: "2 hrs 27 min" - color: "White" - font.pixelSize: 20 - } - - Image { - id: cancel - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - - source: "../res/buttons/long_oval_btn.png" - - Image { - id: destIcon - anchors.verticalCenter: parent.verticalCenter - anchors.left: cancel.left - anchors.leftMargin: Constants.fontSize - source: "../res/nav/dest_icon.png" - } - - Text { - id: cancelText - anchors.centerIn: parent - text: "Cancel" - color: Constants.primaryColor - font.pixelSize: 20 - } - - MouseArea { - anchors.fill: parent - - onPressed: { - cancel.source = "../res/buttons/long_oval_pressed_btn.png" - destIcon.source = "../res/nav/dest_icon_black.png" - cancelText.color = Constants.pressedButtonTextColor - } - - onReleased: { - cancel.source = "../res/buttons/long_oval_btn.png" - destIcon.source = "../res/nav/dest_icon.png" - cancelText.color = Constants.primaryColor - } - - onClicked: { - contentLoader.go("./views/NavigationNoRouteGridView.qml") - } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/NavigationKeyboardView.qml b/src/components/qt_hmi/qml_model_qt4/views/NavigationKeyboardView.qml deleted file mode 100644 index 3ef73ee67d..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/NavigationKeyboardView.qml +++ /dev/null @@ -1,221 +0,0 @@ -/** - * @file NavigationKeyboardView.qml - * @brief Navigation keyboard screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - id: navKeyboard - anchors.fill: parent - - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - // Text line with input text - TextInput { - id: inputText - anchors.top:parent.top - anchors.left:parent.left - maximumLength: 30 - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - text: dataContainer.routeText - } - - // Keyboard - Column { - anchors.centerIn: parent - Row { - id: upperRow - property string qWERTY : "QWERTYUIOP" - anchors.horizontalCenter: parent.horizontalCenter - - Repeater { - model: 10 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: upperRow.qWERTY.charAt(index) - pixelSize: Constants.fontSize - - onClicked: { - dataContainer.routeText += upperRow.qWERTY.charAt(index) - } - } - } - } - Row { - id: middleRow - property string aSDFGH : "ASDFGHJKL" - anchors.horizontalCenter: parent.horizontalCenter - - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "123" - pixelSize: 15 - } - //-------------- - Repeater { - model: 9 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: middleRow.aSDFGH.charAt(index) - pixelSize: Constants.fontSize - - onClicked: { - dataContainer.routeText += middleRow.aSDFGH.charAt(index) - } - } - } - //-------------- - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - onIsPressedChanged: { - hoverImg.source = isPressed ? "../res/nav/delete_icon_black.png" : "../res/nav/delete_icon.png"; - } - Image { - id: hoverImg - anchors.centerIn: parent - source: "../res/nav/delete_icon.png" - } - - onClicked: { - dataContainer.routeText = dataContainer.routeText.substring(0,dataContainer.routeText.length - 1) - } - } - } - Row { - id: lowerRow - property string zXCVBN : "ZXCVBNM" - anchors.horizontalCenter: parent.horizontalCenter - - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "!@#" - pixelSize: 15 - } - //----------------- - Repeater { - model: 7 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: lowerRow.zXCVBN.charAt(index) - pixelSize: Constants.fontSize - - onClicked: { - dataContainer.routeText += lowerRow.zXCVBN.charAt(index) - } - } - } - //---------------- - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "Clear" - pixelSize: 12 - - onClicked: { - dataContainer.routeText = "" - } - } - //---------------- - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "Space" - pixelSize: 12 - - onClicked: { - dataContainer.routeText += " " - } - } - } - - } // column - - Image { - id: goBtn - anchors.right: parent.right - anchors.top: parent.top - source: "../res/buttons/short_oval_btn.png" - - Text { - id: goText - anchors.centerIn: parent - text: "Go" - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - } - - MouseArea { - anchors.fill: parent - - onPressed: { - goBtn.source = "../res/buttons/short_oval_btn_pressed.png" - goText.color = Constants.pressedButtonTextColor - } - - onReleased: { - goBtn.source = "../res/buttons/short_oval_btn.png" - goText.color = Constants.primaryColor - } - - onClicked: { - contentLoader.go("./views/NavigationInRouteGridView.qml") - } - } - } - } // 3/4 top screen - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/NavigationMenuView.qml b/src/components/qt_hmi/qml_model_qt4/views/NavigationMenuView.qml deleted file mode 100644 index 5ceffe0526..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/NavigationMenuView.qml +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @file NavigationMenuView.qml - * @brief Navigation menu screen view. - * 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. - */ - -import QtQuick 1.1 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - GridMenu { - id: menu - model: NavigationMenuModel {} - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: bottomPanel.top - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - OvalButton { - text: title - onReleased: contentLoader.go(qml) - anchors.centerIn: parent - fontSize: Constants.fontSize - } - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} - - diff --git a/src/components/qt_hmi/qml_model_qt4/views/NavigationNoRouteGridView.qml b/src/components/qt_hmi/qml_model_qt4/views/NavigationNoRouteGridView.qml deleted file mode 100644 index 312f076394..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/NavigationNoRouteGridView.qml +++ /dev/null @@ -1,205 +0,0 @@ -/** - * @file NavigationNoRouteGridView.qml - * @brief Navigation no route screen view. - * 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. - */ - -import QtQuick 1.1 -import "../models/Constants.js" as Constants - -GeneralView { - Item { - id: navNoRoute - anchors.fill: parent - - Image { - // 3/4 top screen - id: map - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - source: "../res/nav/map.png" - - Image { - id: compas - anchors.bottom: parent.bottom - anchors.bottomMargin: 1/4 * compas.width - anchors.left: parent.left - anchors.leftMargin: 1/4 * compas.width - source: "../res/nav/compass.png" - } - - Column { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: compas.horizontalCenter - spacing: 1/8 * parent.height - - // Zoom "+" button - Image { - id: zoomIn - source: "../res/buttons/zoom.png" - - Text { - id: zoomInBtn - anchors.centerIn: parent - text: "+" - color: "white" - font.pixelSize: Constants.fontSize - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/zoom_pressed.png" - zoomInBtn.color = Constants.pressedButtonTextColor - } - onReleased: { - parent.source = "../res/buttons/zoom.png" - zoomInBtn.color = Constants.releasedButtonTextColor - } - - onClicked: { - //Some behavior - } - } - } - - // Zoom "-" button - Image { - id: zoomOut - source: "../res/buttons/zoom.png" - - Text { - id: zoomOutBtn - anchors.centerIn: parent - text: "-" - color: "white" - font.pixelSize: Constants.fontSize - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/zoom_pressed.png" - zoomOutBtn.color = Constants.pressedButtonTextColor - } - onReleased: { - parent.source = "../res/buttons/zoom.png" - zoomOutBtn.color = Constants.releasedButtonTextColor - } - - onClicked: { - //Some behavior - } - } - } - } // column - - // Options button - Image { - id: navOptions - anchors.top: parent.top - anchors.right: parent.right - source: "../res/nav/options.png" - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/nav/options_pressed.png" - } - onReleased: { - parent.source = "../res/nav/options.png" - } - onClicked: { - //Options screen - } - } - } - } //map - - Item { - // 1/4 bottom screen - id: bottomPart - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - // Destination search button - Image { - id: destSearch - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - source: "../res/buttons/longest_oval_btn.png" - - Image { - id: destIcon - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 15 - source: "../res/nav/dest_icon.png" - } - - Text { - id: destText - anchors.verticalCenter: parent.verticalCenter - anchors.left: destIcon.right - anchors.leftMargin: 5 - text: "Destination" - color: Constants.primaryColor - font.pixelSize: 20 - } - - MouseArea { - anchors.fill: parent - - onPressed: { - destSearch.source = "../res/buttons/longest_oval_btn_pressed.png" - destIcon.source = "../res/nav/dest_icon_black.png" - destText.color = Constants.pressedButtonTextColor - } - - onReleased: { - destSearch.source = "../res/buttons/longest_oval_btn.png" - destIcon.source = "../res/nav/dest_icon.png" - destText.color = Constants.primaryColor - } - - onClicked: { - contentLoader.go("./views/NavigationMenuView.qml") - } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/PhoneKeyboardView.qml b/src/components/qt_hmi/qml_model_qt4/views/PhoneKeyboardView.qml deleted file mode 100644 index b328406d68..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/PhoneKeyboardView.qml +++ /dev/null @@ -1,171 +0,0 @@ -/** - * @file PhoneKeyboardView.qml - * @brief Phone keyboard screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -GeneralView{ - Component.onCompleted: phoneKeyboard.changeColorOfActiveButtons() - - Item { - function changeColorOfActiveButtons() { - for (var i = 0; i < contactsListModel.count; i++) { - activeButtons[contactsListModel.get(i).name[0].toUpperCase()] = true - } - } - - id: phoneKeyboard - anchors.fill: parent - - property variant activeButtons: { - "A": false, "B": false, "C": false, "D": false, "E": false, - "F": false, "G": false, "H": false, "I": false, "J": false, - "K": false, "L": false, "M": false, "N": false, "O": false, - "P": false, "Q": false, "R": false, "S": false, "T": false, - "U": false, "V": false, "W": false, "X": false, "Y": false, "Z": false - } - - ContactsListModel { - id: contactsListModel - } - - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - - Column { - anchors.centerIn: parent - - Row { - id: upperRow - property string contentLoader : "ABCDEFGHI" - anchors.horizontalCenter: parent.horizontalCenter - Repeater { - model: 9 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - textColorDefault: phoneKeyboard.activeButtons[upperRow.contentLoader.charAt(index)] - ? Constants.primaryColor : Constants.inactiveButtonTextColor - text: upperRow.contentLoader.charAt(index) - pixelSize: Constants.fontSize - onIsPressedChanged: { - if (!isPressed){ - if (phoneKeyboard.activeButtons[upperRow.contentLoader.charAt(index)]) { - dataContainer.contactsFirstLetter = text - contentLoader.go("./views/ContactsListView.qml") - } - } - } - } - } - } - - Row { - id: middleRow - property string contentLoader : "JKLMNOPQR" - anchors.horizontalCenter: parent.horizontalCenter - Repeater { - model: 9 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - textColorDefault: phoneKeyboard.activeButtons[middleRow.contentLoader.charAt(index)] - ? Constants.primaryColor : Constants.inactiveButtonTextColor - text: middleRow.contentLoader.charAt(index) - pixelSize: Constants.fontSize - onIsPressedChanged: { - if (!isPressed){ - if (phoneKeyboard.activeButtons[middleRow.contentLoader.charAt(index)]) { - dataContainer.contactsFirstLetter = text - contentLoader.go("./views/ContactsListView.qml") - } - } - } - } - } - } - - Row { - id: lowerRow - property string contentLoader : "STUVWXYZ" - anchors.horizontalCenter: parent.horizontalCenter - Repeater { - model: 8 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - textColorDefault: phoneKeyboard.activeButtons[lowerRow.contentLoader.charAt(index)] - ? Constants.primaryColor : Constants.inactiveButtonTextColor - text: lowerRow.contentLoader.charAt(index) - pixelSize: Constants.fontSize - onIsPressedChanged: { - if (!isPressed){ - if (phoneKeyboard.activeButtons[lowerRow.contentLoader.charAt(index)]) { - dataContainer.contactsFirstLetter = text - contentLoader.go("./views/ContactsListView.qml") - } - } - } - } - } - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "123" - pixelSize: 20 - } - } - } - } - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent} - } - } -} - - diff --git a/src/components/qt_hmi/qml_model_qt4/views/PhoneMenuGridView.qml b/src/components/qt_hmi/qml_model_qt4/views/PhoneMenuGridView.qml deleted file mode 100644 index 7d52b1223a..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/PhoneMenuGridView.qml +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file PhoneMenuGridView.qml - * @brief View for phone menu. - * 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. - */ - -import QtQuick 1.1 -import "../models" -import "../controls" - -GridMenu { - id: menu - model: PhoneMenuModel {} - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - ClickableImage { - anchors.centerIn: parent - source: icon - onClicked: { - if(qml !== "") { - contentLoader.go(qml) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/RadioPlayer.qml b/src/components/qt_hmi/qml_model_qt4/views/RadioPlayer.qml deleted file mode 100644 index 1df65d4235..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/RadioPlayer.qml +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @file RadioPlayerView.qml - * @brief Parent for AM, FM, Sirius players screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -Item { - id: radioPlayerView - - property string radioType: "" - property string radioName: "" - property alias buttonHD: bot.children - - property PlayerState playerState - - Item { - // top 3/4 screen - id: upperContent - anchors.top: parent.top - anchors.left: parent.left - height: parent.height * 3/4 - width: parent.width - - Item { - // top part for buttons - id: top - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: parent.height * 1/4 - - OvalButton { - text: radioName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - } - - OvalButton { - anchors.right: parent.right - anchors.top: parent.top - text: "Tune" - fontSize: Constants.fontSize - } - } - - Item { - // mid part for information about song - id: mid - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - width: parent.width - height: parent.height / 2 - - Column { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - - Row { - Text { - id: radioChannelNameText - color: Constants.primaryColor - text: playerState.presets[0] - font.pixelSize: 45 - } - Text { - anchors.bottom: radioChannelNameText.bottom - color: Constants.primaryColor - text: " " + radioType - font.pixelSize: 25 - } - } - - Text { - color: Constants.primaryColor - text: playerState.songName - font.pixelSize: 25 - font.bold: true - } - - Text { - color: Constants.primaryColor - text: playerState.albumName - font.pixelSize: 25 - } - } - } - - Item { - // bottom part for HD button (for FM radio) - id: bot - anchors.left: parent.left - anchors.bottom: parent. bottom - width: parent.width - height: parent.height * 1/4 - } - } - - Item { - // bottom 1/4 screen - id: lowerContent - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - // Line that divide screen in two parts - Rectangle { - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: 2 - color: Constants.primaryColor - } - - PresetRow { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - presets: playerState.presets - width: parent.width - onSelectedIndexChanged: { - radioChannelNameText.text = presets[selectedIndex]; - } - } - } -} - - diff --git a/src/components/qt_hmi/qml_model_qt4/views/SDLNavi.qml b/src/components/qt_hmi/qml_model_qt4/views/SDLNavi.qml deleted file mode 100644 index 620b0434c6..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/SDLNavi.qml +++ /dev/null @@ -1,223 +0,0 @@ -/** - * @file SDLNavi.qml - * @brief SDL navigation screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common - -GeneralView { - applicationContext: true - - Item { - anchors.fill: parent - id: wholeWindow - - Row { - // Top items - id: topItems - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: 1/6 * parent.height - spacing: Constants.sdlNaviSpacing - - Rectangle { - anchors.top: parent.top - width: 1/5 * parent.width - height: 4/5 * parent.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - - Text { - text: dataContainer.currentApplication.hmiUIText.mainField1 - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - Rectangle { - anchors.top: parent.top - width: 3/5 * parent.width - 2 * parent.spacing - height: parent.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - - Text { - text: dataContainer.currentApplication.hmiUIText.mainField2 - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - Rectangle { - id: rightRectOfTopItems - anchors.top: parent.top - width: 1/5 * parent.width - height: 4/5 * parent.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - Text { - text: dataContainer.currentApplication.hmiUIText.mainField3 ? dataContainer.currentApplication.hmiUIText.mainField3 : "field3" - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - } - - Column { - // "+", "-" button at left - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - width: 1/12 * parent.width - height: 2/10 * parent.height + spacing - spacing: Constants.sdlNaviSpacing - - GradientRectangle { - width: parent.width - height: 1/10 * wholeWindow.height - text: "+" - isCustomButton: true - customButtonID: 3 - } - GradientRectangle { - width: parent.width - height: 1/10 * wholeWindow.height - text: "-" - isCustomButton: true - customButtonID: 4 - } - } - - Column { - anchors.right: parent.right - anchors.top: topItems.bottom - width: 1/6 * parent.width - height: 2/10 * parent.height + spacing - spacing: Constants.sdlNaviSpacing - - Rectangle { - width: parent.width - height: 1/10 * wholeWindow.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - Text { - text: "" - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - Rectangle { - width: parent.width - height: 1/10 * wholeWindow.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - Text { - text: dataContainer.currentApplication.hmiUIText.mainField4 ? dataContainer.currentApplication.hmiUIText.mainField4 : "mainField4" - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - } - - Row { - // bottom items - id: bottomItems - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/6 * parent.height - spacing: Constants.sdlNaviSpacing - - GradientRectangle { - anchors.bottom: parent.bottom - width: 1/3 * parent.width - height: parent.height - text: "Menu" - isCustomButton: true - customButtonID: 1 - } - Rectangle { - anchors.bottom: parent.bottom - width: 1/3 * parent.width - 2 * parent.spacing - height: parent.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - Text { - text: "mainField5" - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - GradientRectangle { - anchors.bottom: parent.bottom - width: 1/3 * parent.width - height: parent.height - text: "Custom Button" - isCustomButton: true - customButtonID: 2 - } - } - - GradientRectangle { - anchors.right: parent.right - anchors.bottom: bottomItems.top - anchors.bottomMargin: Constants.sdlNaviSpacing - width: 1/6 * parent.width - height: 1/10 * parent.height - text: "Options" - fontSize: Constants.fontSize - onReleased: { - contentLoader.go("./views/SDLPlayerOptionsListView.qml", dataContainer.currentApplication.appId) - } - - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/SDLNonMediaView.qml b/src/components/qt_hmi/qml_model_qt4/views/SDLNonMediaView.qml deleted file mode 100644 index bebfe9585d..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/SDLNonMediaView.qml +++ /dev/null @@ -1,194 +0,0 @@ -/** - * @file SDLNonMediaView.qml - * @brief SDL non media screen view. - * 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. - */ - - -import QtQuick 1.1 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal -import "../hmi_api/Common.js" as Common - -GeneralView { - applicationContext: true - - Item { - id: upperContent - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - Item { - id: topButtonRow - // top 1/4 of screen - width: parent.width - height: 1/4 * parent.height - - PagedFlickable { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - elementWidth: Constants.ovalButtonWidth - spacing: (width - 4 * elementWidth) / 3 - snapTo: elementWidth + spacing - - OvalButton { - text: "Options" - onClicked: { contentLoader.go("./views/SDLPlayerOptionsListView.qml") } - } - - Repeater { - model: dataContainer.currentApplication.softButtons ? - dataContainer.currentApplication.softButtons.count : - 0 - delegate: - SoftButton { - appId: dataContainer.currentApplication.appId - button: dataContainer.currentApplication.softButtons.get(index) - } - } - } - } - - Column { - id: midContent - height: parent.height * 3/4 - width: parent.width - anchors.top: topButtonRow.bottom - anchors.left: parent.left - - Text { - id: deviceName - width: parent.width - height: 1/5 * parent.height - text: "Device: " + dataContainer.currentApplication.deviceName - verticalAlignment: Text.AlignVCenter - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - Row { - width: parent.width - height: 4/5 * parent.height - spacing: Constants.margin - - Image { - id: image - height: parent.height - width: height - source: dataContainer.currentApplication.hmiUIText.image - } - - Column { - height: parent.height - width: parent.width - image.width - parent.spacing - spacing: Constants.margin - - Text { - id: text1 - width: parent.width - verticalAlignment: Text.AlignVCenter - horizontalAlignment: dataContainer.hmiUITextAlignment - text: dataContainer.currentApplication.hmiUIText.mainField1 - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - Text { - width: parent.width - verticalAlignment: Text.AlignVCenter - horizontalAlignment: dataContainer.hmiUITextAlignment - text: dataContainer.currentApplication.hmiUIText.mainField2 - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - } - } - } - } - - Item { - // bottom 1/4 screen - id: lowerContent - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: parent.height * 1/4 - - PresetRow { - id: presetsRow - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - presets: Internal.getArrayForPresetRow() - width: parent.width - property bool clickProcessed - - Timer { - id: timer - interval: Constants.presetButtonTimer - repeat: false - triggeredOnStart: false - } - - onPresetButtonPressed: { - timer.start() - clickProcessed = false - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonEventMode.BUTTONDOWN, undefined) - } - - onPresetButtonReleased: { - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonEventMode.BUTTONUP, undefined) - timer.stop() - if (!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonPressMode.SHORT, undefined) - } - } - - Connections { - target: timer - onTriggered: { - if(!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonPressMode.LONG, undefined) - clickProcessed = true - } - } - } - } - } - - StatusBar { - anchors.left: parent.left - anchors.bottom: parent.bottom - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/SDLPlayerOptionsListView.qml b/src/components/qt_hmi/qml_model_qt4/views/SDLPlayerOptionsListView.qml deleted file mode 100644 index 076851b29a..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/SDLPlayerOptionsListView.qml +++ /dev/null @@ -1,120 +0,0 @@ -/** - * @file SDLPlayerOptionsListView.qml - * @brief SDL player options screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -GeneralView { - applicationContext: true - systemContext: Common.SystemContext.SYSCTXT_MENU - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - - ListView { - id: sdlPlayerOptionsListView - anchors.horizontalCenter: parent.horizontalCenter - width:parent.width - height:parent.height - - model: dataContainer.currentApplication.currentSubMenu - - delegate: Row { - spacing: Constants.iconItemListSpacing - Icon { - source: model.icon - width: Constants.iconItemListSize - height: Constants.iconItemListSize - - MouseArea { - anchors.fill: parent - enabled: model.icon.value !== undefined - - onPressed: text.press() - onReleased: text.release() - onCanceled: text.release() - onClicked: text.click() - } - } - - ClickableText { - id: text - text: name + (type === Internal.MenuItemType.MI_SUBMENU ? " >" : "") - width: sdlPlayerOptionsListView.width - x - elide: Text.ElideRight - defaultColor: type === Internal.MenuItemType.MI_PARENT ? - Constants.inactiveButtonTextColor : - Constants.primaryColor - pressedColor: type === Internal.MenuItemType.MI_PARENT ? - Constants.inactiveButtonTextColorPressed : - Constants.primaryColorPressed - font.pixelSize: Constants.titleFontSize - - function click() { - console.debug("enter") - switch (type) { - case Internal.MenuItemType.MI_NODE: - sdlUI.onCommand(model.id, dataContainer.currentApplication.appId) - contentLoader.back() - break; - case Internal.MenuItemType.MI_SUBMENU: - case Internal.MenuItemType.MI_PARENT: - dataContainer.currentApplication.currentSubMenu = subMenu - break; - } - console.debug("exit") - } - onClicked: click() - } - } - } - } - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/SDLPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/SDLPlayerView.qml deleted file mode 100644 index 0c1bd5b7e9..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/SDLPlayerView.qml +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file SDLPlayerView.qml - * @brief SDL player screen view. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -GeneralView { - applicationContext: true - MediaPlayer { - id: mediaPlayer - onPlay: { sdlButtons.onButtonPress(Common.ButtonName.OK, Common.ButtonPressMode.SHORT, undefined) } - onPause: { sdlButtons.onButtonPress(Common.ButtonName.OK, Common.ButtonPressMode.SHORT, undefined) } - playerName: "SDL music" - playerType: "SDL" - image: dataContainer.currentApplication.hmiUIText.image - anchors.fill: parent - - buttons: [ - OvalButton { - text: dataContainer.currentApplication.appName - onReleased: { contentLoader.go("./views/MusicSourceView.qml") } - }, - - OvalButton { - text: "SDL Menu" - onReleased: { contentLoader.go("./views/ApplicationListView.qml") } - }, - - OvalButton { - text: "Options" - onReleased: { contentLoader.go("./views/SDLPlayerOptionsListView.qml") } - }, - - Repeater { - model: dataContainer.currentApplication.softButtons ? - dataContainer.currentApplication.softButtons.count : - 0 - - delegate: SoftButton { - appId: dataContainer.currentApplication.appId - button: dataContainer.currentApplication.softButtons.get(index) - } - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/ScrollableMessageView.qml b/src/components/qt_hmi/qml_model_qt4/views/ScrollableMessageView.qml deleted file mode 100644 index f7111906de..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/ScrollableMessageView.qml +++ /dev/null @@ -1,216 +0,0 @@ -/** - * @file ScrollableMessageView.qml - * @brief Scrollable Message View . - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models" -import "../popups" - -GeneralView { - applicationContext: true - id: scrollableMessageView - - function complete(abort){ - console.debug("enter") - timer.stop() - dataContainer.scrollableMessageModel.running = false - - dataContainer.popups-- - dataContainer.applicationContext = dataContainer.applicationSavedContext - - if(abort) { - console.debug("send error") - DBus.sendError(dataContainer.scrollableMessageModel.async, Common.Result.ABORTED) - } else { - console.debug("send ok") - DBus.sendReply(dataContainer.scrollableMessageModel.async, {}) - } - - contentLoader.back() - console.debug("exit") - } - - - Connections { - target: contentLoader - onStatusChanged: { - if (status == Component.Ready) { - console.debug("enter") - console.debug("timeout in timer", timer.interval) - dataContainer.popups++ - dataContainer.applicationSavedContext = dataContainer.applicationContext - dataContainer.scrollableMessageModel.running = true - timer.start() - console.debug("exit") - } - } - } - - Rectangle { - anchors.fill: parent - color: Constants.secondaryColor - - Timer { - id: timer - interval: dataContainer.scrollableMessageModel.timeout - onTriggered: { - complete(false) - } - } - - Item { - // top 1/6 of screen - id: top - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: dataContainer.scrollableMessageModel.softButtons.count > 0 ? parent.height * 1/6 : 1 - - OvalButton { - //this button is used only to get item size for PagedFlickable - id: fakeButton - text: "defaultBtnSize"//remove this line when default size for btn will be introduced - visible:false - } - - PagedFlickable { - id: flickRow - width: top.width - spacing: (width - fakeButton.width * 4) / 3 - snapTo: fakeButton.width + spacing - elementWidth: fakeButton.width - - - ListView { - id: softButtons - width: model.count * fakeButton.width + (model.count - 1) * flickRow.spacing - height: fakeButton.height - spacing: flickRow.spacing - - orientation: ListView.Horizontal - interactive: false - model: dataContainer.scrollableMessageModel.softButtons - - delegate: SoftButton { - appId: dataContainer.currentApplication.appId - button: model - onKeepContext: timer.restart() - onDefaultAction: scrollableMessageView.complete(true) - } - } - } - } - - Item { - id: middle - anchors.top: top.bottom - anchors.left: parent.left - anchors.bottom: bottom.top - width: parent.width - - Flickable { - id:flickable - anchors.fill: middle - flickableDirection: Flickable.VerticalFlick - contentWidth: longMessageText.width - contentHeight: longMessageText.height - clip: true - - - Text { - id: longMessageText - wrapMode: Text.Wrap - width: middle.width - text: dataContainer.scrollableMessageModel.longMessageText - color: Constants.scrollableMessageTextColor - font.pixelSize: Constants.fontSize - - } - } - Rectangle { - id: scrollbar - anchors.right: flickable.right - y: flickable.visibleArea.yPosition * flickable.height - width: Constants.scrollableMessageScrollBarWidth - height: flickable.visibleArea.heightRatio * flickable.height - visible: !(flickable.visibleArea.heightRatio > 1) - color: Constants.scrollableMessageScrollBarColor - } - - } - - Item { - // 1/4 bottom screen - id: bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { - id:backButton - anchors.centerIn: parent - onClicked: { - console.debug("enter") - complete(true) - console.debug("exit") - } - } - } - } - /** - * Test Support Section - * - */ - function getTimer(){ - return timer - } - function getSoftButtonsListView(){ - return softButtons - } - function getScrollbar(){ - return scrollbar - } - function getTextArea(){ - return middle - } - function getBackButton(){ - return backButton - } - /** - * Test Support Section End - */ -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/SimulationView.qml b/src/components/qt_hmi/qml_model_qt4/views/SimulationView.qml deleted file mode 100644 index c30d83f019..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/SimulationView.qml +++ /dev/null @@ -1,284 +0,0 @@ -/** - * @file SimulationView.qml - * @brief Area of screen responsible for simulation actions - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../views" -import "../popups" -import "../models/Constants.js" as Constants - -Rectangle { - width: controlArea.width + controlArea.anchors.margins - anchors.top: parent.top - anchors.bottom: parent.bottom - color: Constants.panelColor - - Item { - id: showArea - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - height: parent.height - (controlArea.childrenRect.height + controlArea.anchors.margins) - - ExitAllApplicationsPopup { - id: exitAllApplicationsPopup - anchors.fill: parent - visible: false - } - - VehicleInfoPopUp { - id: viPopUp - anchors.fill: parent - } - - TBTClientStatePopUp { - id: tbtClientStatePopUp - anchors.fill: parent - visible: false - } - } - - Item { - id: controlArea - anchors.bottom: parent.bottom - anchors.margins: Constants.panelPadding - anchors.horizontalCenter: parent.horizontalCenter - width: table.width - - ListModel { - id: languagesList - - Component.onCompleted: { - for (var name in Common.Language) { - if (settingsContainer.sdlLanguagesList.indexOf(Common.Language[name]) != -1) { - append({name: name.replace('_', '-')}); - } - } - } - } - - Text { - id: label - text: "Languages" - color: Constants.panelTextColor - anchors.bottom: table.top - anchors.horizontalCenter: parent.horizontalCenter - } - - Grid { - id: table - spacing: 5 - columns: 2 - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: globalProperties.top - - Text { - text: "HMI UI" - color: Constants.panelTextColor - } - - Text { - text: "HMI TTS + VR" - color: Constants.panelTextColor - } - - ComboBox { - width: table.width / table.columns - table.spacing - model: languagesList - onCurrentIndexChanged: { - dataContainer.hmiUILanguage = settingsContainer.sdlLanguagesList[currentIndex]; - sdlUI.onLanguageChange(dataContainer.hmiUILanguage); - } - z: 1000 - } - - ComboBox { - width: table.width / table.columns - table.spacing - model: languagesList - onCurrentIndexChanged: { - dataContainer.hmiTTSVRLanguage = settingsContainer.sdlLanguagesList[currentIndex]; - sdlTTS.onLanguageChange(dataContainer.hmiTTSVRLanguage); - sdlVR.onLanguageChange(dataContainer.hmiTTSVRLanguage); - } - z: 1000 - } - - Text { - text: "Application UI" - color: Constants.panelTextColor - } - - Text { - text: "Application TTS + VR" - color: Constants.panelTextColor - } - - Text { - id: uiLanguageLabel - color: Constants.panelTextColor - text: " " - Connections { - target: dataContainer - onCurrentApplicationChanged: { - for (var s in Common.Language) { - if (Common.Language[s] === dataContainer.currentApplication.hmiDisplayLanguageDesired) { - uiLanguageLabel.text = s; - } - } - } - } - } - - Text { - id: ttsLanguageLabel - color: Constants.panelTextColor - text: " " - Connections { - target: dataContainer - onCurrentApplicationChanged: { - for (var s in Common.Language) { - if (Common.Language[s] === dataContainer.currentApplication.languageTTSVR) { - ttsLanguageLabel.text = s; - } - } - } - } - } - - PushButton { - id: vehicleInfo - label: "Vehicle info" - toggleMode: true - onPressed: { - viPopUp.show(); - } - onUnpressed: { - viPopUp.hide(); - } - } - - PushButton { - id: tbtClientState - label: "TBT Client state" - toggleMode: true - onPressed: { - tbtClientStatePopUp.show(); - } - onUnpressed: { - tbtClientStatePopUp.hide(); - } - } - - PushButton { - label: "Exit application" - onClicked: { - if (dataContainer.applicationContext) { - sdlBasicCommunication.onExitApplication(dataContainer.currentApplication.appId) - } - } - } - - PushButton { - id: exitAllAppsButton - label: "Exit all apps" - toggleMode: true - onPressed: { - exitAllApplicationsPopup.show() - - } - onUnpressed: { - exitAllApplicationsPopup.hide() - } - Connections { - target: exitAllApplicationsPopup - onVisibleChanged: { - if (!exitAllApplicationsPopup.visible) { - exitAllAppsButton.state = "unpressed" - } - } - } - } - - CheckBox { - color: Constants.panelTextColor - text: "Use URL" - } - - CheckBox { - color: Constants.panelTextColor - text: "DD" - - onClicked: { - if (checked) { - dataContainer.driverDistractionState = - Common.DriverDistractionState.DD_ON; - } else { - dataContainer.driverDistractionState = - Common.DriverDistractionState.DD_OFF; - } - } - } - } - - Rectangle { - id: globalProperties - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: listGlobalProperties.height + Constants.panelPadding - border.color: Constants.panelTextColor - border.width: 1 - color: Constants.panelColor - Column { - id: listGlobalProperties - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.panelPadding / 4 - Text { - text: "HELP_PROMPT: " + dataContainer.currentApplication.helpPrompt - color: Constants.panelTextColor - } - Text { - text: "TIMEOUT_PROMPT: " + dataContainer.currentApplication.timeoutPrompt - color: Constants.panelTextColor - } - Text { - text: "AUTOCOMPLETE_TEXT: " // TODO(ALeshin): Function didn' realized yet - color: Constants.panelTextColor - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/SiriusPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/SiriusPlayerView.qml deleted file mode 100644 index 14dd211303..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/SiriusPlayerView.qml +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file SiriusPlayerView.qml - * @brief Sirius player screen view. - * 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. - */ -import QtQuick 1.1 -import "../controls" - -GeneralView { - RadioPlayer { - id: siriusRadioPlayer - anchors.fill: parent - radioType: "" - radioName: "Sirius" - - playerState: dataContainer.siriusPlayerState - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/TurnByTurnView.qml b/src/components/qt_hmi/qml_model_qt4/views/TurnByTurnView.qml deleted file mode 100644 index 630113334e..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/TurnByTurnView.qml +++ /dev/null @@ -1,201 +0,0 @@ -/** - * @file TurnByTurnView.qml - * @brief View for TurnByTurn. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models" - -GeneralView { - applicationContext: true - - Item { - id: turnByTurnView - anchors.fill: parent - - Item { - // top 3/4 of screen - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: parent.height * 3/4 - - Item { - // row of oval buttons - id: ovalButtonsRow - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - PagedFlickable { - id: buttonsRow - width: parent.width - spacing: (width - 4 * elementWidth) / 3 - anchors.verticalCenter: parent.verticalCenter - snapTo: Constants.ovalButtonWidth + spacing - elementWidth: Constants.ovalButtonWidth - - OvalButton { - id: turnListButton - text: "TurnList" - onClicked: { - console.log("Go to TurnListView"); - contentLoader.go("./views/TurnListView.qml"); - } - } - - Repeater { - model: dataContainer.navigationModel.softButtons ? - dataContainer.navigationModel.softButtons.count : - 0 - delegate: - SoftButton { - appId: dataContainer.navigationModel.appId - button: dataContainer.navigationModel.softButtons.get(index) - } - } - } - } - - Column { - // Picture + text information + media clock - id: mediaContent - width: parent.width - height: 3/4 * parent.height - anchors.left: parent.left - anchors.top: ovalButtonsRow.bottom - - Row { - // picture + text info - width: parent.width - height: 3/4 * parent.height - spacing: Constants.margin - - Image { - id: image - height: parent.height - width: height - source: dataContainer.navigationModel.turnIcon - } - - Column { - // text info - id: textInfo - height: parent.height - width: parent.width - image.width - parent.spacing - spacing: (height - 5 * navText1.height) / 4 - - Text { - id: navText1 - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: dataContainer.navigationModel.text1 - font.pixelSize: Constants.fontSize - visible: dataContainer.navigationModel.text1 - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: dataContainer.navigationModel.text2 - font.pixelSize: Constants.fontSize - visible: dataContainer.navigationModel.text2 - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: "Total distance: " + dataContainer.navigationModel.totalDistance - font.pixelSize: Constants.fontSize - visible: dataContainer.navigationModel.totalDistance - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: "Time to destination: " + dataContainer.navigationModel.timeToDestination - font.pixelSize: Constants.fontSize - visible: dataContainer.navigationModel.timeToDestination - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: "ETA: " + dataContainer.navigationModel.eta - font.pixelSize: Constants.fontSize - visible: dataContainer.navigationModel.eta - } - } - } - - Row { - anchors.horizontalCenter: parent.horizontalCenter - height: 1/4 * parent.height - width: 2/3 * parent.width - - Rectangle { - id: coveredDistance - anchors.verticalCenter: parent.verticalCenter - height: Constants.distanceBarHeight - width: dataContainer.navigationModel.distanceToManeuver / dataContainer.navigationModel.distanceToManeuverScale * parent.width - color: "white" - } - - Rectangle { - anchors.verticalCenter: parent.verticalCenter - height: Constants.distanceBarHeight - width: parent.width - coveredDistance.width - color: Constants.primaryColor - } - } - } - } - } - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - BackButton { anchors.centerIn: parent } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/TurnListView.qml b/src/components/qt_hmi/qml_model_qt4/views/TurnListView.qml deleted file mode 100644 index 91ff02ea02..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/TurnListView.qml +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @file TurnListView.qml - * @brief View for TurnByTurn list. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common - -GeneralView { - applicationContext: true - - Item { - anchors.left: parent.left - anchors.top: parent.top - width: parent.width - height: 3/4 * parent.height - - Item { - id: sotfButtons - width: parent.width - height: 1/4 * parent.height - - PagedFlickable { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - elementWidth: Constants.ovalButtonWidth - snapTo: elementWidth + spacing - spacing: (width - 4 * elementWidth) / 3 - - Repeater { - model: dataContainer.currentApplication.turnListSoftButtons ? - dataContainer.currentApplication.turnListSoftButtons.count : - 0 - delegate: - SoftButton { - appId: dataContainer.currentApplication.appId - button: dataContainer.currentApplication.turnListSoftButtons.get(index) - } - } - } - } - - ScrollableListView { - id: scrollableList - anchors.top: sotfButtons.bottom - anchors.left: parent.left - width: parent.width - height: 3/4 * parent.height - - model: dataContainer.currentApplication.turnList - - delegate: - ListItem { - width: scrollableList.width - height: Constants.iconItemListSize - text: dataContainer.currentApplication.turnList.get(index).navigationText.fieldText - fontSize: Constants.fontSize - icon: dataContainer.currentApplication.turnList.get(index).turnIcon - } - } - } - - Item { - // 1/4 bottom screen - id: back - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - BackButton { anchors.centerIn: parent } - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/UsbPlayerView.qml b/src/components/qt_hmi/qml_model_qt4/views/UsbPlayerView.qml deleted file mode 100644 index 4b17b55c10..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/UsbPlayerView.qml +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file UsbPlayerView.qml - * @brief USB player screen view. - * 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. - */ -import QtQuick 1.1 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: usbPlayer - playerName: "USB" - anchors.fill: parent - playerState: dataContainer.usbPlayerState - image: playerState.albumImage - - buttons: [ - OvalButton { - text: usbPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt4/views/WarningInfo.qml b/src/components/qt_hmi/qml_model_qt4/views/WarningInfo.qml deleted file mode 100644 index e096cb80d1..0000000000 --- a/src/components/qt_hmi/qml_model_qt4/views/WarningInfo.qml +++ /dev/null @@ -1,135 +0,0 @@ -/** - * @file WarningInfo.qml - * @brief Screen with warning information. - * 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. - */ - -import QtQuick 1.1 -import "../controls" -import "../models/Constants.js" as Constants - -Rectangle { - id: warningInfo - anchors.fill: parent - color: Constants.secondaryColor - Text { - anchors.top: parent.top - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - text: "WARNING!" - color: Constants.warningColor - font.pixelSize: Constants.titleFontSize - font.bold: true - style: Text.Raised - styleColor: "gray" - } - - Text { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.margin - height: 1/2 * parent.height - width: parent.width - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - - text: "This application is intended to be used as a demonstrative aid only, " - + "while the vehicle is parked. Don't use it while driving. <br /><br />" - + "Use extreme caution when using any device that takes your attention off the road. " - + "Ford recommends against the use of any hand-held device while driving and that you comply " - + "with all applicable laws. Your primary responsibility is the safe operation of the vehicle." - color: "white" - font.pixelSize: 25 - font.bold: true - } - - function showOkButton() { - okButtonAnimation.start() - } - - Item { - id: ok - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - opacity: 0 - - SequentialAnimation - { - id: okButtonAnimation - // Decrease this value while debugging - PauseAnimation { duration: Constants.warningScreenDuration } - NumberAnimation { - target: ok - duration: Constants.animationDuration - property: "opacity" - from: 0; to: 1; - } - } - - Image { - id: okButton - anchors.centerIn: parent - source: "../res/buttons/longest_oval_btn.png" - - Text { - id: text - anchors.centerIn: parent - text: "OK" - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/longest_oval_btn_pressed.png" - text.color = Constants.secondaryColor - } - onReleased: { - parent.source = "../res/buttons/longest_oval_btn.png" - text.color = Constants.primaryColor - } - onClicked: { - console.log("WarningInfo OkButton - on clicked enter"); - warningInfo.visible = false - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/CMakeLists.txt b/src/components/qt_hmi/qml_model_qt5/CMakeLists.txt deleted file mode 100644 index e6eeb9e525..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/CMakeLists.txt +++ /dev/null @@ -1,87 +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. - -cmake_minimum_required(VERSION 2.8.11) - -set(components_dir ${CMAKE_CURRENT_SOURCE_DIR}/../..) -set(dbus_dir ${components_dir}/dbus) -set(codegen_dir ${dbus_dir}/codegen) -set(codegen ${codegen_dir}/make_qml_dbus_qml.py) -set(parser ${codegen_dir}/ford_xml_parser.py) -set(interfaces_dir ${components_dir}/interfaces) -set(api_xml ${interfaces_dir}/QT_HMI_API.xml) -set(proxy_dir ${CMAKE_CURRENT_BINARY_DIR}/hmi_api) -set(qml_dirs hmi_api controls models popups views) -set(qml_files MainWindow.qml) - -add_custom_target(qml_auto ALL - COMMAND python ${codegen} --infile ${api_xml} --version ${qt_version} --outdir ${proxy_dir} - DEPENDS ${api_xml} ${codegen} ${parser} - COMMENT "Generating files: - ${proxy_dir}/BasicCommunicationProxy.qml - ${proxy_dir}/ButtonsProxy.qml - ${proxy_dir}/NavigationProxy.qml - ${proxy_dir}/TTSProxy.qml - ${proxy_dir}/UIProxy.qml - ${proxy_dir}/VehicleInfoProxy.qml - ${proxy_dir}/VRProxy.qml - from: - ${api_xml} ..." -) - -add_custom_target(qml_copy_resources ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/../res ${CMAKE_CURRENT_BINARY_DIR}/res - COMMENT "Copying resources") - -if(NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") - foreach(qml_dir ${qml_dirs}) - add_custom_target(qml_copy_${qml_dir} ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${qml_dir} ${CMAKE_CURRENT_BINARY_DIR}/${qml_dir} - COMMENT "Copying directory ${qml_dir}") - endforeach(qml_dir) - - add_dependencies(qml_auto qml_copy_hmi_api) - - foreach(qml_file ${qml_files}) - add_custom_target(qml_copy_${qml_file} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${qml_file} ${CMAKE_CURRENT_BINARY_DIR}/${qml_file} - COMMENT "Copying file ${qml_file}") - endforeach(qml_file) -endif() - -install(DIRECTORY - ${CMAKE_CURRENT_BINARY_DIR}/controls - ${CMAKE_CURRENT_BINARY_DIR}/hmi_api - ${CMAKE_CURRENT_BINARY_DIR}/models - ${CMAKE_CURRENT_BINARY_DIR}/popups - ${CMAKE_CURRENT_BINARY_DIR}/res - ${CMAKE_CURRENT_BINARY_DIR}/views - DESTINATION bin/hmi) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/MainWindow.qml DESTINATION bin/hmi) diff --git a/src/components/qt_hmi/qml_model_qt5/MainWindow.qml b/src/components/qt_hmi/qml_model_qt5/MainWindow.qml deleted file mode 100644 index 59fed45707..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/MainWindow.qml +++ /dev/null @@ -1,462 +0,0 @@ -/** - * @file MainWindow.qml - * @brief Implementation of main window. - * 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. - */ - -import QtQuick 2.0 -import QtMultimedia 5.0 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import com.ford.sdl.hmi.named_pipe_notifier 1.0 -import "./controls" -import "./views" -import "./hmi_api" as HmiApi -import "./models" -import "./popups" -import "hmi_api/Common.js" as Common -import "./models/Constants.js" as Constants -import "models/Internal.js" as Internal - -Rectangle { - width: 1280 - height: 768 - property string startQml: "./views/ApplicationListView.qml" - property int minWidth: Constants.mainScreenMinWidth - property int minHeight: Constants.mainScreenMiHeight - color: Constants.secondaryColor - - DataStorage { - id: dataContainer - - onSystemContextChanged: { - sdlUI.onSystemContext(systemContext, currentApplication.appId) - } - - // Please note that applicationContext is changed only after setting currentApplication - onApplicationContextChanged: { - if (applicationContext) { - sdlBasicCommunication.onAppActivated(currentApplication.appId) - } else { - sdlBasicCommunication.onAppDeactivated(currentApplication.appId, contentLoader.item.category) - } - } - } - - Audio { - id: beep - source: "res/initial.wav" - } - - Audio { - id: stream - - property real bufferProgress: 0.0 - } - - SettingsStorage { - id: settingsContainer - } - - Item { - id: mainScreen - anchors.top: parent. top - anchors.left: parent.left - width: (parent.width - simulationScreen.width < minWidth) ? - minWidth : parent.width - simulationScreen.width - height: (parent.height - hardwareScreen.height < minHeight) ? - minHeight : parent.height - hardwareScreen.height - clip: true - visible: false - - Item { - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - height: parent.height * 0.10 - width: parent.width - HeaderMenu {} - } - - Item { - height: parent.height * 0.90 - width: parent.width - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - - Video { - id: player - anchors.fill: parent - visible: { - var naviString = new RegExp("SDLNavi\.qml") - return naviString.test(contentLoader.source); - } - - NamedPipeNotifier { - id: notifier - onReadyRead: { - player.source = name - player.play() - } - } - - Component.onCompleted: { - notifier.start() - } - onStopped: { - notifier.start() - - } - function startStream(url) { - notifier.name = url - notifier.start() - } - } - - Loader { - id: contentLoader - height: parent.height - Constants.margin - width: parent.width - 2 * Constants.margin - asynchronous: true - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - anchors.leftMargin: Constants.margin - anchors.rightMargin: Constants.margin - anchors.bottomMargin: Constants.margin - - - source:startQml - property var viewTransitionStack : [] - - function reset() { - viewTransitionStack = [] - } - - property string currentLocation - function go(path, appId) { - console.debug("enter:", path, ", appId:", appId) - if (path) { - if (currentLocation !== path) { - viewTransitionStack.push({ uri: source.toString(), applicationContext: false }) - if (appId) { - dataContainer.setCurrentApplication(appId) - } - item.leaveScreen() - currentLocation = path - source = path - } - } - console.debug("exit") - } - - function back() { - if (viewTransitionStack.length) { - item.leaveScreen() - source = viewTransitionStack.pop().uri - } - currentLocation = "" - } - - onStatusChanged: { - if (status == Component.Ready) { - if (!dataContainer.activeAlert) { - dataContainer.applicationContext = item.applicationContext - } - else { - dataContainer.applicationSavedContext = item.applicationContext - } - if (viewTransitionStack && viewTransitionStack.length) { - viewTransitionStack[viewTransitionStack.length - 1].applicationContext = item.applicationContext - } - dataContainer.setSystemContext() - } - } - } - } - - WarningInfo { id: warningInfo } - - VRHelpPopup { - id: vrHelpPopup - popUpName: "UI.VrHelp" - anchors.centerIn: parent - visible: false - } - - InteractionPopup { - id: interactionPopup - popUpName: "UI.PerformInteraction" - anchors.centerIn: parent - visible: false - } - - SliderPopup { - id: sliderPopup - popUpName: "UI.Slider" - anchors.centerIn: parent - visible: false - } - - PerformAudioPassThruPopup { - id: performAudioPassThruPopup - popUpName: "UI.PerformAudioPassThru" - anchors.centerIn: parent - visible: false - } - - AlertWindow { - id: alertWindow - popUpName: "UI.Alert" - objectName: "AlertWindow" - anchors.fill: parent - visible: false - } - - UserActionPopUp { - id: userActionPopUp - popUpName: "ActionPopUp" - objectName: "ActionPopUp" - anchors.fill: parent - visible: false - } - - OnAppPermissionConsentPopUp { - id: onAppPermissionConsentPopUp - popUpName: "onAppPermissionConsent" - objectName: "onAppPermissionConsent" - anchors.fill: parent - visible: false - } - } - - Item { - id: simulationScreen - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: mainScreen.right - width: simulationPanel.width - clip: true - SimulationView { - id: simulationPanel - - VRPopUp { - id: vrPopUp - visible: false - anchors.fill: parent - } - - TTSPopUp { - id: ttsPopUp - anchors.top: parent.top - anchors.right: parent.right - visible: false - } - } - } - - Item { - id: hardwareScreen - anchors.top: mainScreen.bottom - anchors.left: parent.left - anchors.right: simulationScreen.left - height: hardwarePanel.height - clip: true - HardwareButtonsView { id: hardwarePanel } - } - - HMIAdapter { - HmiApi.ButtonsProxy { - id: sdlButtons - objectName: "Buttons" - } - HmiApi.BasicCommunicationProxy { - id: sdlBasicCommunication - objectName: "BasicCommunication" - } - HmiApi.VRProxy { - id: sdlVR - objectName: "VR" - } - HmiApi.TTSProxy { - id: sdlTTS - objectName: "TTS" - } - HmiApi.NavigationProxy { - id: sdlNavigation - objectName: "Navigation" - } - HmiApi.VehicleInfoProxy { - id: sdlVehicleInfo - objectName: "VehicleInfo" - } - HmiApi.UIProxy { - id: sdlUI - objectName: "UI" - } - - HmiApi.SDLProxy { - id: sdlSDL - objectName: "SDL" - } - } - - SDLAdapter { - id: sdlProxy - - onOnResumeAudioSource: { - - } - - onOnFileRemoved: { - - } - - onOnAppRegistered: { - console.debug("enter onAppRegistered") - var appTypeToAdd = 0 - if (application.appType !== undefined) { - for (var index in application.appType) { - if (application.appType[index] > 31) { - return { __retCode: Common.Result.GENERIC_ERROR, __message: "Apptype value > 31" } - } - appTypeToAdd |= 1 << application.appType[index] - } - } - - dataContainer.addApplication( - { - appName: application.appName, - ngnMediaScreenAppName: application.ngnMediaScreenAppName, - icon: application.icon, - deviceName: application.deviceName, - appId: application.appID, - hmiDisplayLanguageDesired: application.hmiDisplayLanguageDesired, - isMediaApplication: application.isMediaApplication, - appType: appTypeToAdd, - hmiUIText: { }, - mediaClock: { - "updateMode": Internal.MediaClockUpdateMode.MCU_COUNTUP, - "runningMode": Internal.MediaClockRunningMode.MCR_STOPPED, - "startTime": -1, - "endTime": -1, - "startTimeForProgress": -1 - } - }); - console.debug("exit onAppRegistered") - } - - onOnAppUnregistered: { - console.debug("enter onAppUnregistered") - if ((dataContainer.currentApplication.appId === appID)) { - if (dataContainer.applicationContext) { - contentLoader.go("views/ApplicationListView.qml"); - } - if (contentLoader.viewTransitionStack.filter(function(x) { return x.applicationContext })) { - contentLoader.reset(); - } - dataContainer.currentApplication.reset() - } - dataContainer.removeApplication(appID); - console.debug("exit onAppUnregistered") - } - - onPlayTone: { - beep.play() - } - - onOnSDLClose: { - - } - - onOnPutFile: { - console.log("OnPutFile: ", offset, length, fileSize, FileName, - syncFileName, fileType, persistentFile); - } - - onOnRecordStart: { - - } - - onOnAppPermissionChanged: { - - } - - - onOnSDLConsentNeeded: { - - } - - onOnStatusUpdate: { - console.log("enter onStatusUpdate") - settingsContainer.updateStatus(status); - } - } - - Component.onCompleted: { - dataContainer.hmiVRAvailable = true - dataContainer.hmiTTSAvailable = true - dataContainer.hmiNavigationAvailable = true - dataContainer.hmiVehicleInfoAvailable = true - dataContainer.hmiUIAvailable = true - - sdlBasicCommunication.onReady() - } - - /* - * Test Support Section - * - */ - function getSlider(){ - return sliderPopup - } - - function getDataStorage(){ - return dataContainer - } - - function getUIProxy(){ - return sdlUI - } - - function getMainScreen(){ - return mainScreen - } - - function getContentLoader(){ - return contentLoader - } - - function getWarningInfo(){ - return warningInfo - } - /* - * Test Support Section End - */ -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/ArrowKeys.qml b/src/components/qt_hmi/qml_model_qt5/controls/ArrowKeys.qml deleted file mode 100644 index 58cba17707..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/ArrowKeys.qml +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @file ArrowKeys.qml - * @brief Keys with arrow for cursor movement. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common - -Item { - width: buttonOk.width - height: buttonOk.height - - HardwareButton { - id: arrowUp - buttonId: Common.ButtonName.TUNEUP - name: "Up" - } - HardwareButton { - id: arrowDown - buttonId: Common.ButtonName.TUNEDOWN - name: "Down" - } - HardwareButton { - id: arrowLeft - buttonId: Common.ButtonName.SEEKLEFT - name: "Left" - } - HardwareButton { - id: arrowRight - buttonId: Common.ButtonName.SEEKRIGHT - name: "Right" - } - HardwareButton { - id: buttonOk - buttonId: Common.ButtonName.OK - name: "Ok" - longPressAvailable: false - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/BackButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/BackButton.qml deleted file mode 100644 index 5d82f15592..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/BackButton.qml +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file BackButton.qml - * @brief Button "Back" that return to previous menu. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -OvalButton { - text: "Back" - onClicked: { contentLoader.back() } - fontSize: Constants.fontSize - opacity: 0 - - NumberAnimation on opacity { - to: 1; - duration: Constants.animationDuration - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/CircleButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/CircleButton.qml deleted file mode 100644 index f0755b3980..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/CircleButton.qml +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @file CircleButton.qml - * @brief Parent class for circle button. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Image { - id: circleBtn - source: imgOff - property alias text: btnText.text - property alias pixelSize: btnText.font.pixelSize - property string dest: "" - property bool isPressed: false - property string imgOff: "../res/buttons/round_btn.png" - property string imgOn: "../res/buttons/round_pressed_btn.png" - property string textColorOnPressed: Constants.secondaryColor - property string textColorDefault: Constants.primaryColor - - signal clicked() - function wasClicked() - { - clicked() - } - - Text { - anchors.centerIn: parent - id: btnText - color: textColorDefault - } - - MouseArea { - anchors.fill: parent - onPressed: { - console.log("CircleButton onPressed enter"); - source = imgOn - btnText.color = textColorOnPressed - isPressed = true - console.log("CircleButton onPressed exit"); - } - onReleased: { - console.log("CircleButton onReleased enter"); - source = imgOff - btnText.color = textColorDefault - isPressed = false - console.log("CircleButton onReleased exit"); - } - onClicked: { - console.log("CircleButton onClicked enter"); - if(dest !== ""){ - contentLoader.go(dest) - } - circleBtn.wasClicked() - console.log("CircleButton onClicked enter"); - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/ClickableImage.qml b/src/components/qt_hmi/qml_model_qt5/controls/ClickableImage.qml deleted file mode 100644 index dc1231570a..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/ClickableImage.qml +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file ClickableImage.qml - * @brief Clickable image item - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Image { - signal pressed () - signal released () - signal canceled () - signal clicked() - - MouseArea { - anchors.fill: parent - - onPressed: { - parent.scale = Constants.pressedIconScale - parent.pressed() - } - - onReleased: { - parent.scale = 1 - parent.released() - } - - onCanceled: { - parent.scale = 1 - parent.canceled() - } - - onClicked: { - parent.clicked() - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/ClickableText.qml b/src/components/qt_hmi/qml_model_qt5/controls/ClickableText.qml deleted file mode 100644 index c56e3dc13d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/ClickableText.qml +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file ClickableText.qml - * @brief Clickable text item - * 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. - */ - -import QtQuick 2.0 - -Text { - property string defaultColor - property string pressedColor - signal pressed () - signal released () - signal canceled () - signal clicked () - - color: defaultColor - - MouseArea { - anchors.fill: parent - - onPressed: { - press() - parent.pressed() - } - - onReleased: { - release() - parent.released() - } - - onCanceled: { - release() - parent.canceled() - } - - onClicked: { - parent.clicked() - } - } - - function press () { - color = pressedColor - } - - function release () { - color = defaultColor - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/ClimateControlBtn.qml b/src/components/qt_hmi/qml_model_qt5/controls/ClimateControlBtn.qml deleted file mode 100644 index 9211ac1baf..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/ClimateControlBtn.qml +++ /dev/null @@ -1,93 +0,0 @@ -/** - * @file ClimateControlBtn.qml - * @brief Round button, which is used at climat menu. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Item -{ - id: climateControlBtn - width: climateBtnImg.width - height: climateBtnImg.height - property string name: "" - property string txt: "" - state: "off" - - Image { - id: climateBtnImg - source: climateControlBtn.state === "off" ? "../res/climate/climate_round_off_btn.png" : "../res/climate/climate_round_on_btn.png" - - Image { - id: hoverImg - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - property string st: climateControlBtn.state === "off" ? "_off" : "_on" - source: climateControlBtn.name === "" ? "": "../res/climate/" + climateControlBtn.name + st + ".png" - } - - Text { - id: hoverText - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - text: climateControlBtn.txt - font.pixelSize: Constants.fontSize - color: climateControlBtn.state === "off" ? Constants.primaryColor : Constants.secondaryColor - } - - MouseArea { - anchors.fill: parent - onClicked: { - if(climateControlBtn.state === "on") { - climateControlBtn.state = "off" - climateBtnImg.source = "../res/climate/climate_round_off_btn.png" - if(climateControlBtn.txt != "") { - hoverText.color = Constants.primaryColor - } - if(climateControlBtn.name != "") { - hoverImg.source = "../res/climate/" + climateControlBtn.name + "_off.png" - } - } else { - climateControlBtn.state = "on" - climateBtnImg.source = "../res/climate/climate_round_on_btn.png" - if(climateControlBtn.txt != "") { - hoverText.color = Constants.secondaryColor - } - if(climateControlBtn.name != "") { - hoverImg.source = "../res/climate/" + climateControlBtn.name + "_on.png" - } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/GradientRectangle.qml b/src/components/qt_hmi/qml_model_qt5/controls/GradientRectangle.qml deleted file mode 100644 index 3695070dfd..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/GradientRectangle.qml +++ /dev/null @@ -1,125 +0,0 @@ -/** - * @file GradientRectangle.qml - * @brief Rectangle with gradient. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common - -Rectangle { - property string firstColor: "grey" - property string secondColor: "#2E2E2E" - property alias fontSize: text.font.pixelSize - property alias text: text.text - property int customButtonID - property bool isCustomButton: false - property bool clickProcessed - signal pressed() - signal released() - - radius: 5 - border.color: "#D3D3D3" - - Text { - id: text - anchors.fill: parent - font.pixelSize: Constants.titleFontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - elide: Text.ElideRight - } - - MouseArea { - anchors.fill: parent - - onPressed: { - firstColor = "#2E2E2E" - secondColor = "grey" - parent.pressed() - } - onReleased: { - firstColor = "grey" - secondColor = "#2E2E2E" - parent.released() - } - } - - Timer { - id: timer - interval: Constants.customButtonTimer - repeat: false - triggeredOnStart: false - } - - onPressed: { - if (isCustomButton) { - timer.start() - clickProcessed = false - sdlButtons.onButtonEvent(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonEventMode.BUTTONDOWN, customButtonID) - } - } - - onReleased: { - if (isCustomButton) { - sdlButtons.onButtonEvent(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonEventMode.BUTTONUP, customButtonID) - timer.stop() - if (!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonPressMode.SHORT, customButtonID) - } - } - } - - Connections { - target: timer - onTriggered: { - if (isCustomButton) { - if(!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonPressMode.LONG, customButtonID) - clickProcessed = true - } - } - } - } - - gradient: Gradient { - GradientStop { - position: 0.1 - color: firstColor - } - GradientStop { - position: 0.5 - color: secondColor - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/GridItem.qml b/src/components/qt_hmi/qml_model_qt5/controls/GridItem.qml deleted file mode 100644 index 39e1f0d7c4..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/GridItem.qml +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file GridItem.qml - * @brief Item with animation for GridMenu - * 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. - */ -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Item { - id: item - opacity: 0 - SequentialAnimation { - id: animation - PauseAnimation {duration: index * 100 } - NumberAnimation { - target: item - duration: Constants.animationDuration - property: "opacity" - from: 0; to: 1; - } - } - Component.onCompleted: { - animation.start() - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/HardwareButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/HardwareButton.qml deleted file mode 100644 index 47f034082e..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/HardwareButton.qml +++ /dev/null @@ -1,108 +0,0 @@ -/** - * @file HardwareButton.qml - * @brief Parent class for hardware button. - * 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. - */ - -import QtQuick 2.0 -import com.ford.sdl.hmi.hw_buttons 1.0 -import "../hmi_api/Common.js" as Common - -MaskedContainer { - property string name - property int buttonId: Common.ButtonName.CUSTOM_BUTTON - property bool upDownAvailable: true - property bool shortPressAvailable: true - property bool longPressAvailable: true - - signal hold - - Image { - source: "../res/controlButtons/" + name + "Button.png" - } - Image { - id: pressedImg - source: "../res/controlButtons/" + name + "Button_pressed.png" - visible: false - Behavior on opacity { - NumberAnimation { duration: 80 } - } - } - Timer { - id: timer - interval: 2000 - repeat: false - triggeredOnStart: false - } - property bool clickProcessed - onPressed: { - clickProcessed = false - pressedImg.visible = true - timer.start() - if (upDownAvailable) { - sdlButtons.onButtonEvent(buttonId, Common.ButtonEventMode.BUTTONDOWN, undefined) - } - } - - onReleased: { - if (upDownAvailable) { - sdlButtons.onButtonEvent(buttonId, Common.ButtonEventMode.BUTTONUP, undefined) - } - timer.stop() - if (!clickProcessed && shortPressAvailable) { - sdlButtons.onButtonPress(buttonId, Common.ButtonPressMode.SHORT, undefined) - } - pressedImg.visible = false - } - - Connections { - target: timer - onTriggered: { - if(!clickProcessed && longPressAvailable) { - sdlButtons.onButtonPress(buttonId, Common.ButtonPressMode.LONG, undefined) - clickProcessed = true - hold() - } - } - } - - Component.onCompleted: { - if (buttonId !== Common.ButtonName.CUSTOM_BUTTON) { - settingsContainer.buttonCapabilities.push( - { - name: buttonId, - upDownAvailable: upDownAvailable, - shortPressAvailable: shortPressAvailable, - longPressAvailable: longPressAvailable - }); - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/HeaderMenu.qml b/src/components/qt_hmi/qml_model_qt5/controls/HeaderMenu.qml deleted file mode 100644 index 26cfe9abe0..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/HeaderMenu.qml +++ /dev/null @@ -1,133 +0,0 @@ -/** - * @file HeaderMenu.qml - * @brief Header menu view. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Item { - id: headerMenu - anchors.fill: parent - Text { - anchors.leftMargin: Constants.margin - anchors.topMargin: Constants.margin - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - text: "75°" - } - - Item { - width: menuText.width - height: parent.height - anchors.topMargin: Constants.margin - anchors.horizontalCenter: headerMenu.horizontalCenter - signal clicked () - - ClickableText { - id: menuLogo - anchors.horizontalCenter: menuText.horizontalCenter - anchors.bottom: parent.verticalCenter - text: "≡" - defaultColor: Constants.primaryColor - pressedColor: Constants.primaryColorPressed - font.pixelSize: Constants.fontSize - - onClicked: parent.clicked() - onPressed: menuText.press() - onReleased: menuText.release() - onCanceled: menuText.release() - } - - ClickableText { - id: menuText - anchors.top: parent.verticalCenter - text: "MENU"; - defaultColor: Constants.primaryColor - pressedColor: Constants.primaryColorPressed - font.pixelSize: Constants.fontSize - - onClicked: parent.clicked() - onPressed: menuLogo.press() - onReleased: menuLogo.release() - onCanceled: menuLogo.release() - } - - onClicked: { - contentLoader.go("./views/MainMenuView.qml") - } - } - - Row { - id: clock - height: childrenRect.height - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.rightMargin: Constants.margin - anchors.topMargin: Constants.margin - property date date: new Date() - - Timer { - running: true - repeat: true - interval: 1000 - onTriggered: { - clock.date = new Date(); - } - } - - Text { - text: Qt.formatTime(clock.date, "hh"); - color: Constants.primaryColor - font.pixelSize: Constants.fontSize; - } - - Item { - width: 10 - height: parent.height - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: clock.date.getSeconds() % 2 ? ":" : "" - color: Constants.primaryColor - font.pixelSize: Constants.fontSize; - } - } - - Text { - text: Qt.formatTime(clock.date, "mm"); - color: Constants.primaryColor - font.pixelSize: Constants.fontSize; - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/Icon.qml b/src/components/qt_hmi/qml_model_qt5/controls/Icon.qml deleted file mode 100644 index 2aa7019428..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/Icon.qml +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @file Navigation.qml - * @brief Icon. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common - -Item { - property var source - - Image { - anchors.fill: parent - source: url(parent.source) - - function image(turnIcon) { - if (turnIcon && turnIcon.imageType === Common.ImageType.STATIC) { - return turnIcon.value; - } else { - return ""; - } - } - - function url(turnIcon) { - if (turnIcon && turnIcon.imageType === Common.ImageType.DYNAMIC) { - return turnIcon.value; - } else { - return ""; - } - } - } - - function reset () { - source = undefined - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/ListItem.qml b/src/components/qt_hmi/qml_model_qt5/controls/ListItem.qml deleted file mode 100644 index 6373237241..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/ListItem.qml +++ /dev/null @@ -1,70 +0,0 @@ -/** - * @file Entry.qml - * @brief Entry with icon and text for list. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Rectangle { - id: main - color: Constants.transparentColor - - property alias text: label.text - property alias fontSize: label.font.pixelSize - property alias icon: image.source - - Icon { - id: image - width: Constants.iconItemListSize - height: Constants.iconItemListSize - anchors.left: parent.left - anchors.leftMargin: Constants.generalSpacing - anchors.verticalCenter: parent.verticalCenter - visible: source ? true : false - } - Text { - id: label - anchors.verticalCenter: parent.verticalCenter - height: image.height - width: parent.width - image.width - z: 50 - verticalAlignment: Text.AlignVCenter - font.pixelSize: Constants.fontSize - text: "Name Entry" - anchors.left: image.right - anchors.leftMargin: Constants.generalSpacing - anchors.verticalCenterOffset: 0 - visible: text !== "" - color: Constants.primaryColor - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/MaskedButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/MaskedButton.qml deleted file mode 100644 index a7f91dd397..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/MaskedButton.qml +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @file MaskedButton.qml - * @brief Masked button. - * 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. - */ - -import QtQuick 2.0 -import com.ford.sdl.hmi.hw_buttons 1.0 - -MaskedContainer { - property string name - - Image { - id: icon - source: "../res/controlButtons/" + name + "Button.png" - } - - onPressed: { - state = "pressed"; - } - - onReleased: { - state = ""; - } - - states: [ - State { - name: "pressed" - PropertyChanges { - target: icon - source: "../res/controlButtons/" + name + "Button_pressed.png" - } - } - - ] -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/MultiTouchArea.qml b/src/components/qt_hmi/qml_model_qt5/controls/MultiTouchArea.qml deleted file mode 100644 index 32626d292d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/MultiTouchArea.qml +++ /dev/null @@ -1,103 +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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common - -MultiPointTouchArea { - property date created - - minimumTouchPoints: 1 - maximumTouchPoints: 10 - - MouseArea { - anchors.fill: parent - - function mouseTouchEvent() { - var now = new Date() - var touchEvents = [ - { - id: 0, - ts: [now.valueOf() - created.valueOf()], - c: [{x: mouseX, y: mouseY}] - } - ] - return touchEvents - } - - onPressed: { - sdlUI.onTouchEvent(Common.TouchType.BEGIN, mouseTouchEvent()) - } - onReleased: { - sdlUI.onTouchEvent(Common.TouchType.END, mouseTouchEvent()) - } - onCanceled: { - sdlUI.onTouchEvent(Common.TouchType.END, mouseTouchEvent()) - } - onPositionChanged: { - sdlUI.onTouchEvent(Common.TouchType.MOVE, mouseTouchEvent()) - } - } - - function touchEvents() { - var now = new Date() - var touchEvents = [] - for (var i = 0; i < touchPoints.length; ++i) { - touchEvents.push( - { -// pointId is guaranteed to be unique but is not guaranteed to fit in range -// perhaps we will have to edit protocol xml - id: touchPoints[i].pointId, - ts: [now.valueOf() - created.valueOf()], - c: [{x: touchPoints[i].x, y: touchPoints[i].y}] - } - ) - } - return touchEvents - } - - onPressed: { - sdlUI.onTouchEvent(Common.TouchType.BEGIN, touchEvents()) - } - onReleased: { - sdlUI.onTouchEvent(Common.TouchType.END, touchEvents()) - } - onCanceled: { - sdlUI.onTouchEvent(Common.TouchType.END, touchEvents()) - } - onUpdated: { - sdlUI.onTouchEvent(Common.TouchType.MOVE, touchEvents()) - } - Component.onCompleted: { - created = new Date() - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/OvalButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/OvalButton.qml deleted file mode 100644 index 6d68a9096b..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/OvalButton.qml +++ /dev/null @@ -1,246 +0,0 @@ -/** - * @file OvalButton.qml - * @brief Oval button with flexible width. - * 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. - */ - -import QtQuick 2.0 -import QtGraphicalEffects 1.0 -import "../models/Constants.js" as Constants - -// Don't change constants. It break button -// TODO (dchmerev@luxoft.com): make this comment more clear -// todo (ykazakov): eliminate this problem and remove all such comments - -Item { - id: main - width: dynamic ? field.width + 2 * left.width : Constants.ovalButtonWidth - height: Constants.ovalButtonHeight - - signal clicked; - signal pressed; - signal released; - signal pressAndHold; - property alias text: label.text - property alias fontSize: label.font.pixelSize - property alias icon: image.source - property bool highlighted: false - property bool dynamic: false - property bool disabled: false - - function hue() { - var ret = 0; - if (disabled) { - ret = Constants.disabledButtonHue; - } else if (highlighted) { - ret = Constants.highlightedButtonHue; - } - return ret; - } - - function saturation() { - var ret = 0; - if (disabled) { - ret = Constants.disabledButtonSaturation; - } else if (highlighted) { - ret = Constants.highlightedButtonSaturation; - } - return ret; - } - - function lightness() { - var ret = 0; - if (disabled) { - ret = Constants.disabledButtonLightness; - } else if (highlighted) { - ret = Constants.highlightedButtonLightness; - } - return ret; - } - - Item { - id: buttonBorderImage - visible: false - anchors.fill: parent - Image { - id: left - width: 31 - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.top: parent.top - source: "../res/buttons/oval_btn_left.png" - } - - Image { - id: right - width: 31 - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - source: "../res/buttons/oval_btn_right.png" - } - - Image { - id: top - height: 10 - anchors.right: parent.right - anchors.rightMargin: 31 - anchors.left: parent.left - anchors.leftMargin: 31 - anchors.top: parent.top - fillMode: Image.TileHorizontally - source: "../res/buttons/oval_btn_top.png" - } - - Image { - id: bottom - height: 11 - anchors.right: parent.right - anchors.rightMargin: 31 - anchors.left: parent.left - anchors.leftMargin: 31 - anchors.bottom: parent.bottom - fillMode: Image.TileHorizontally - source: "../res/buttons/oval_btn_bottom.png" - } - } - - HueSaturation { - anchors.fill: buttonBorderImage - source: buttonBorderImage - hue: main.hue() - saturation: main.saturation() - lightness: main.lightness() - } - - Rectangle { - id: background - color: Constants.transparentColor - anchors.fill: parent - anchors.rightMargin: 31 - anchors.leftMargin: 31 - anchors.bottomMargin: 10 - anchors.topMargin: 10 - visible: false - } - - HueSaturation { - anchors.fill: background - source: background - hue: main.hue() - saturation: main.saturation() - lightness: main.lightness() - } - - MouseArea { - id: mousearea - anchors.rightMargin: 15 - anchors.leftMargin: 15 - anchors.bottomMargin: 11 - anchors.topMargin: 10 - anchors.fill: parent - enabled: !parent.disabled - onPressed: { - parent.state = "pressed"; - parent.pressed(); - } - onReleased: { - parent.state = ""; - parent.released(); - } - onClicked: { - parent.clicked(); - } - onPressAndHold: { - parent.pressAndHold(); - } - onCanceled: { - parent.state = ""; - } - } - - Item { - id: field - anchors.fill: background - - Icon { - id: image - width: Constants.iconButtonSize - height: Constants.iconButtonSize - anchors.verticalCenter: parent.verticalCenter - visible: source ? true : false - } - Text { - id: label - width: image.visible ? parent.width - image.width : parent.width - color: Constants.primaryColor - anchors.centerIn: parent - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: Constants.ovalButtonFontSize - visible: false - elide: Text.ElideRight - } - HueSaturation { - anchors.fill: label - source: label - hue: main.hue() - saturation: main.saturation() - lightness: main.lightness() - visible: label.text !== "" - } - } - - states: [ - State { - name: "pressed" - PropertyChanges { - target: left - source: "../res/buttons/oval_btn_pressed_left.png" - } - - PropertyChanges { - target: right - source: "../res/buttons/oval_btn_pressed_right.png" - } - - PropertyChanges { - target: background - color: Constants.primaryColor - } - - PropertyChanges { - target: label - color: Constants.secondaryColor - } - } - ] -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/PagedFlickable.qml b/src/components/qt_hmi/qml_model_qt5/controls/PagedFlickable.qml deleted file mode 100644 index 5b150d560d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/PagedFlickable.qml +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file PagedFlickable.qml - * @brief Animated row. - * 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. - */ - -import QtQuick 2.0 - -Item -{ - id: flickablePage - height: container.height + pager.height - default property alias content: containerRow.children - property alias spacing: containerRow.spacing - property int elementWidth - property int snapTo - property int count: 0 - - Flickable { - id: container - anchors.bottom: parent.bottom - maximumFlickVelocity: 1500 - contentWidth: containerRow.width - height: containerRow.height - width: parent.width - interactive: contentWidth > width - - onMovementEnded: { - var rest = contentX % snapTo - var t = 0.25 - if (rest > parent.snapTo / 2) { - rest = rest - parent.snapTo - } - var vel = 2 * rest / t - flickDeceleration = Math.abs(vel) / t - flick(vel, 0) - flickDeceleration = 1500 - } - Row { - id: containerRow - anchors.verticalCenter: parent.verticalCenter - } - } - - Pager { - id: pager - space: 7 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - - pages: { - if ( (container.contentWidth % container.width) >= (flickablePage.elementWidth / 2 + flickablePage.spacing)) { - return Math.ceil(container.contentWidth / container.width) - } - else { - return Math.floor(container.contentWidth / container.width) - } - } - - activePage: { - if (container.contentX <= 0) { - return 0 - } - else if ( (container.contentWidth - container.contentX) < container.width) { - return pages -1 - } - else { - if ( (container.contentX % container.width) >= (flickablePage.elementWidth / 2 + flickablePage.spacing)) { - return Math.ceil(container.contentX / container.width) - } - else if ( (container.contentX % container.width) > 0) { - return Math.floor(container.contentX / container.width) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/Pager.qml b/src/components/qt_hmi/qml_model_qt5/controls/Pager.qml deleted file mode 100644 index 53d99436ce..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/Pager.qml +++ /dev/null @@ -1,53 +0,0 @@ -/** - * @file Pager.qml - * @brief Bubbles that indicate about page switch. - * 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. - */ - -import QtQuick 2.0 - -Row { - id: pager - property int pages - property int activePage: 0 - property int space - property int itemsInRowOnScreen: 3 - - spacing: space - visible: pages !== 1 - - Repeater { - model: pages - Image { - source: index === activePage ? "../res/white_ball.png" : "../res/blue_ball.png" - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/PlayPauseButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/PlayPauseButton.qml deleted file mode 100644 index bb1cb38388..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/PlayPauseButton.qml +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file PlayPauseButton.qml - * @brief Behavior of Play/Pause button. - * 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. - */ - -import QtQuick 2.0 - -Image { - id: playPauseButton - property string sourceOnPressed: "" - property string sourceOnReleased: "" - - signal clicked - - MouseArea { - anchors.fill: parent - onPressed: { - playPauseButton.source = playPauseButton.sourceOnPressed - } - onReleased: { - playPauseButton.source = playPauseButton.sourceOnReleased - } - onClicked: { - playPauseButton.clicked() - } - } - states: [ - State { - name: "Play" - PropertyChanges { - target: playPauseButton - source: "../res/buttons/player_play_btn.png" - sourceOnPressed: "../res/buttons/player_play_pressed_btn.png" - sourceOnReleased: "../res/buttons/player_pause_btn.png" - } - }, - - State { - name: "Pause" - PropertyChanges { - target: playPauseButton - source: "../res/buttons/player_pause_btn.png" - sourceOnPressed: "../res/buttons/player_pause_pressed_btn.png" - sourceOnReleased: "../res/buttons/player_play_btn.png" - } - } - ] -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/PowerSwitchButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/PowerSwitchButton.qml deleted file mode 100644 index 95a751c39b..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/PowerSwitchButton.qml +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @file PowerSwitchBtn.qml - * @brief On/Off button. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Rectangle { - id: powerSwitchBtn - state: "Turn ON" - width: 120 - height: 80 - radius: 5 - property bool pressed; - - gradient: Gradient { - GradientStop { position: pressed ? 1.0 : 0.0; color: "#2c2c2c" } - GradientStop { position: pressed ? 0.0 : 1.0; color: "black" } - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.pressed = true - } - onReleased: { - parent.pressed = false - parent.state = parent.state === "Turn ON" ? "Turn OFF" : "Turn ON" - btnText.text = parent.state - if (parent.state === "Turn OFF") { - contentLoader.reset() - mainScreen.visible = true - warningInfo.showOkButton() - } - } - } - - Text { - id: btnText - color: "red" - text: parent.state - anchors.centerIn: parent - font.pixelSize: Constants.powerButtonFornSize - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/PresetRow.qml b/src/components/qt_hmi/qml_model_qt5/controls/PresetRow.qml deleted file mode 100644 index 32e74d71bb..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/PresetRow.qml +++ /dev/null @@ -1,106 +0,0 @@ -/** - * @file PresetRow.qml - * @brief Animated row with radio stations. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Item { - id: presetRow - height: childrenRect.height - property variant presets: [] - property int selectedIndex: 0 - signal presetSelected - signal presetButtonPressed() - signal presetButtonReleased() - signal presetButtonClicked() - signal presetButtonHold() - - Image { - id: circleButton - source: "../res/buttons/preset_pressed_btn.png" - visible: false - enabled: false - } - - PagedFlickable { - width: parent.width - spacing: (width - (circleButton.width * 4)) / 3 - snapTo: spacing + circleButton.width - elementWidth: circleButton.width - - Repeater { - model: presetRow.presets.length - delegate: - Column { - width: circleButton.width - Image { - anchors.horizontalCenter: parent.horizontalCenter - source: presetRow.selectedIndex === index ? "../res/buttons/preset_pressed_btn.png" : "../res/buttons/preset_btn.png" - MouseArea { - anchors.fill: parent - onPressed: { - presetRow.selectedIndex = index; - presetButtonPressed() - } - onReleased: { - presetRow.selectedIndex = index; - presetButtonReleased() - } - onClicked: { - presetRow.selectedIndex = index - presetButtonClicked() - } - onPressAndHold: { - presetRow.selectedIndex = index; - presetButtonHold() - } - } - Text { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - text: index + 1 - font.pixelSize: Constants.fontSize - color: presetRow.selectedIndex === index ? Constants.secondaryColor : Constants.primaryColor - } - } - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: presetRow.presets[index] - font.pixelSize: Constants.fontSize - color: "white" - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/PushButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/PushButton.qml deleted file mode 100644 index f83370a207..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/PushButton.qml +++ /dev/null @@ -1,136 +0,0 @@ -/** - * @file PushButton.qml - * @brief Simple button - * 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. - */ - -import QtQuick 2.0 - -Rectangle { - id: toggleButton - width: 160 - height: 40 - radius: 2 - border.width: 2 - border.color: "#000000" - gradient: grUnpressed - - property alias label : label.text - - signal pressed() - signal unpressed() - signal clicked() - - property bool toggleMode: false - - state: "unpressed" - onStateChanged: { - if (state == "pressed") { - pressed(); - } else { - unpressed(); - } - } - - Text { - id: label - color: "white" - text: "PushButton" - font.pixelSize: 18 - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - anchors.horizontalCenter: parent.horizontalCenter - anchors.fill: parent - } - MouseArea { - id: mouseArea - - anchors.fill: parent - onPressed: { - if (toggleMode) { - if (parent.state == "unpressed") { - parent.state = "pressed" - } else { - parent.state = "unpressed" - } - } else { - parent.state = "pressed" - } - } - onReleased: { - if (!toggleMode) { - parent.state = "unpressed" - if (mouse.isClick) { - parent.clicked() - } - } - } - } - - states: [ - State { - name: "pressed" - PropertyChanges { - target: toggleButton - gradient: grPressed - } - }, - State { - name: "unpressed" - PropertyChanges { - target: toggleButton - gradient: grUnpressed - } - } - ] - - Gradient { - id: grUnpressed - - GradientStop { position: 0.0; color: "#2c2c2c" } - GradientStop { position: 1.0; color: "#0c0c0c" } - } - - Gradient { - id: grPressed - - GradientStop { position: 0.0; color: "black" } - GradientStop { position: 1.0; color: "black" } - } - - transitions: [ - Transition { - from: "unpressed" - to: "pressed" - reversible: true - } - ] -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/ScrollableListView.qml b/src/components/qt_hmi/qml_model_qt5/controls/ScrollableListView.qml deleted file mode 100644 index a63960d16d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/ScrollableListView.qml +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file ScrollableListView.qml - * @brief ListView with scrollbar on the right - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -ListView { - clip: true - - Rectangle { - visible: parent.height < parent.contentHeight - anchors.right: parent.right - y: parent.visibleArea.yPosition * parent.height - width: Constants.scrollBarWidth - height: parent.visibleArea.heightRatio * parent.height - color: Constants.primaryColor - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/SoftButton.js b/src/components/qt_hmi/qml_model_qt5/controls/SoftButton.js deleted file mode 100644 index 227f638366..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/SoftButton.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file SoftButton.js - * @brief Soft button view constants - * 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. - */ -.pragma library - -var Action = { - doOnClicked: 0, - doOnReleased: 1 -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/SoftButton.qml b/src/components/qt_hmi/qml_model_qt5/controls/SoftButton.qml deleted file mode 100644 index b1b7f71799..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/SoftButton.qml +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @file SoftButton.qml - * @brief Soft button view - * 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. - */ -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common -import "SoftButton.js" as SoftButton - -OvalButton { - property var button - property int appId - visible: !!button - - signal defaultAction; - signal stealFocus; - signal keepContext; - - property int actionOrder: SoftButton.Action.doOnClicked - - highlighted: button ? button.isHighlighted : false - onPressed: { - actionOrder = SoftButton.Action.doOnClicked - sdlButtons.onButtonEvent(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonEventMode.BUTTONDOWN, button.softButtonID, appId) - } - - onReleased: { - if (actionOrder === SoftButton.Action.doOnReleased) { - switch (button.systemAction) { - case Common.SystemAction.DEFAULT_ACTION: - defaultAction(); - break; - case Common.SystemAction.STEAL_FOCUS: - stealFocus(); - break; - case Common.SystemAction.KEEP_CONTEXT: - keepContext(); - break; - } - } - - sdlButtons.onButtonEvent(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonEventMode.BUTTONUP, button.softButtonID, appId) - } - - onClicked: { - sdlButtons.onButtonPress(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonPressMode.SHORT, button.softButtonID, appId); - switch (button.systemAction) { - case Common.SystemAction.DEFAULT_ACTION: - defaultAction(); - break; - case Common.SystemAction.STEAL_FOCUS: - stealFocus(); - break; - case Common.SystemAction.KEEP_CONTEXT: - keepContext(); - break; - } - } - - onPressAndHold: { - actionOrder = SoftButton.Action.doOnReleased; // action should be triggered on release - sdlButtons.onButtonPress(Common.ButtonName.CUSTOM_BUTTON, Common.ButtonPressMode.LONG, button.softButtonID, appId); - } - - onButtonChanged: { - icon = button && button.type !== Common.SoftButtonType.SBT_TEXT ? button.image : undefined; - text = button && button.type !== Common.SoftButtonType.SBT_IMAGE ? button.text : "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/controls/StatusBar.qml b/src/components/qt_hmi/qml_model_qt5/controls/StatusBar.qml deleted file mode 100644 index c06ebc45e4..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/controls/StatusBar.qml +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file StatusBar.qml - * @brief Status bar that contains text string. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Text { - text: dataContainer.currentApplication.hmiUIText.statusBar - color: Constants.primaryColor - font.pixelSize: Constants.statusBarFontSize -} diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/Async.js b/src/components/qt_hmi/qml_model_qt5/hmi_api/Async.js deleted file mode 100644 index ebc5bfa3ca..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/Async.js +++ /dev/null @@ -1,7 +0,0 @@ -.pragma library - -var async_uid = 1; - -function AsyncCall() { - this.__async_uid = async_uid++; -} diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/BasicCommunication.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/BasicCommunication.qml deleted file mode 100644 index ba066e628b..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/BasicCommunication.qml +++ /dev/null @@ -1,187 +0,0 @@ -/** - * @file BasicCommunication.qml - * @brief Implement of interface Basic Communication. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common - -Item { - function updateDeviceList (deviceList) { - var deviceListLog = ""; - deviceList.forEach(function (device) { - deviceListLog += "{name: '" + device.name + "', " + - "id: '" + device.id + "'},"; - }); - console.log("Message Received - {method: 'BasicCommunication.UpdateDeviceList', params:{ " + - "deviceList: [" + deviceListLog + "]" + - "}}") - - deviceList.forEach(function (device) { - var exist = false; - for (var i = 0; i < dataContainer.deviceList.count; ++i) { - exist = device.id === dataContainer.deviceList[i].devid; - } - if (!exist) { - dataContainer.deviceList.append({ name: device.name, - devid: device.id, - allowed: false}) - } - }); - - for (var i = 0; i < dataContainer.deviceList.count; ++i) { - deviceList.forEach(function (device) { - var exist = dataContainer.deviceList[i].id === device.id; - if (!exist) { - dataContainer.deviceList.remove(i); - } - }); - } - } - - function updateAppList (applications) { - var applicationsLog = "", - appTypeLog = ""; - if (applications) { - for (var i = 0; i < applications.length; i++) { - appTypeLog = ""; - - for (var j = 0; j < applications[i].appType.length; i++) { - appTypeLog += "'" + applications[i].appType + "', " - } - - applicationsLog += "{name: '" + applications[i].name + "', " + - "appName: '" + applications[i].appName + "', " + - "ngnMediaScreenAppName: '" + applications[i].ngnMediaScreenAppName + "', " + - "icon: '" + applications[i].icon + "', " + - "deviceName: '" + applications[i].deviceName + "', " + - "appID: " + applications[i].appID + ", " + - "hmiDisplayLanguageDesired: '" + applications[i].hmiDisplayLanguageDesired + "', " + - "isMediaApplication: " + applications[i].isMediaApplication + ", " + - "appType: [" + applications[i].deviceName + "]" + - "},"; - } - } - console.log("Message Received - {method: 'BasicCommunication.UpdateAppList', params:{ " + - "applications: [" + applicationsLog + "]" + - "}}") - - - dataContainer.applicationList.clear(); - for(var i = 0; i < applications.length; i++) { - dataContainer.applicationList.append({ - appName: applications[i].appName, - ngnMediaScreenAppName: applications[i].ngnMediaScreenAppName, - icon: applications[i].icon, - deviceName: applications[i].deviceName, - appId: applications[i].appID, - hmiDisplayLanguageDesired: applications[i].hmiDisplayLanguageDesired, - isMediaApplication: applications[i].isMediaApplication, - appType: applications[i].appType - }); - } - } - - function getResumeResult (appID) { - return dataContainer.getResumeResult(appID) - } - - function allowDeviceToConnect (device) { - console.log("Message Received - {method: 'BasicCommunication.AllowDeviceToConnect', params:{ " + - "device: {name: '" + device.name + "', " + - "id: '" + device.id + "'}," + - "}}") - return { - allow: true - } - } - - function mixingAudioSupported() { - console.log("Message Received - {method: 'BasicCommunication.MixingAudioSupported'}") - return { - attenuatedSupport: true - } - } - - function allowAllApps() { - console.log("Message Received - {method: 'BasicCommunication.AllowAllApps'}") - return { - allowed: true - } - } - - function allowApp(app, appPermissions) { - console.log("Message Received - {method: 'BasicCommunication.AllowApp'}") - return { - allowed: true - } - } - - function activateApp(appID, priority, level) { - console.log("Message Received - {method: 'BasicCommunication.ActivateApp', params:{ " + - "appID: " + appID + - "}}") - contentLoader.go("views/SDLPlayerView.qml", appID); - } - - function policyUpdate(file, timeout, retry) { - console.log("enter policyUpdate"); - settingsContainer.filePTSnapshot = file; - settingsContainer.timeoutPTExchange = timeout; - settingsContainer.retriesPTExchange = retry; - var service = 7; // service type for Ford specific policy - RequestToSDL.SDL_GetURLS(service, settingsContainer.startPTExchange); - console.log("exit policyUpdate"); - } - - function systemRequest(requestType, fileName, appID) { - console.log("enter systemRequest", requestType, fileName, appID); - - console.log(requestType, Common.RequestType.PROPRIETARY, Common.RequestType.HTTP); - - switch (requestType) { - case Common.RequestType.PROPRIETARY: { - settingsContainer.stopPTExchange(fileName); - break; - } - case Common.RequestType.HTTP: { - if (fileName === "IVSU") { - settingsContainer.updateIVSU(appID); - } else { - settingsContainer.decrypt(fileName, appID); - } - break; - } - } - console.log("exit systemRequest"); - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/Buttons.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/Buttons.qml deleted file mode 100644 index b8b3da5932..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/Buttons.qml +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file Buttons.qml - * @brief Implement of interface Buttons. - * 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. - */ - -import QtQuick 2.0 - -Item -{ - function getCapabilities() { - console.log("Message Received - {method: 'Buttons.GetCapabilities'}") - return { - capabilities: settingsContainer.buttonCapabilities, - presetBankCapabilities: { - onScreenPresetsAvailable: true - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/Navigation.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/Navigation.qml deleted file mode 100644 index bab54220b1..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/Navigation.qml +++ /dev/null @@ -1,246 +0,0 @@ -/** - * @file Navigation.qml - * @brief Navigation. - * 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. - */ - -import QtQuick 2.0 -import "Common.js" as Common - -Item { - function isReady () { - console.log("Message Received - {method: 'Navigation.IsReady'}") - return { - available: dataContainer.hmiNavigationAvailable - } - } - - function showConstantTBT(navigationTexts, turnIcon, nextTurnIcon, distanceToManeuver, - distanceToManeuverScale, maneuverComplete, - softButtons, appID) { - console.debug("enter") - var navigationTextsLog = "", - softButtonsLog = "", - turnIconLogs = "", - nextTurnIconLogs = ""; - if (navigationTexts) { - for (var i = 0; i < navigationTexts.length; i++) { - navigationTextsLog += "{fieldName: '" + navigationTexts[i].fieldName + "', " + - "fieldText: '" + navigationTexts[i].fieldText + "'},"; - } - } - if (softButtons) { - for (var i = 0; i < softButtons.length; i++) { - softButtonsLog += "{type: '" + softButtons[i].type + "', " + - "text: " + softButtons[i].text + "', "; - softButtons[i].image ? softButtonsLog += "image: " + "{value: '" + softButtons[i].image.value + "', imageType: " + softButtons[i].image.imageType + "}, " : softButtonsLog += ""; - softButtonsLog += "isHighlighted: " + softButtons[i].isHighlighted + "', " + - "softButtonID: " + softButtons[i].softButtonID + "', " + - "systemAction: " + softButtons[i].systemAction + - "},"; - } - } - if (turnIcon) { - turnIconLogs = "{value: '" + turnIcon.value + "', imageType: " + turnIcon.imageType + "}"; - } - if (nextTurnIcon) { - nextTurnIconLogs = "{value: '" + nextTurnIcon.value + "', imageType: " + nextTurnIcon.imageType + "}"; - } - console.log("Message Received - {method: 'Navigation.ShowConstantTBT', params:{ " + - "navigationTexts: [" + navigationTextsLog + "], " + - "turnIcon: " + turnIconLogs + ", " + - "nextTurnIcon: " + nextTurnIconLogs + ", " + - "distanceToManeuver: " + distanceToManeuver + ", " + - "distanceToManeuverScale: " + distanceToManeuverScale + ", " + - "maneuverComplete: " + maneuverComplete + ", " + - "softButtons: [" + softButtonsLog + "], " + - "appID: " + appID + - "}}") - - var app = dataContainer.getApplication(appID) - var dataToUpdate = {} - - navigationTexts.forEach(fillTexts, dataToUpdate) - if (turnIcon !== undefined) { dataToUpdate.turnIcon = turnIcon } - if (nextTurnIcon !== undefined) { dataToUpdate.nextTurnIcon = nextTurnIcon } - if (distanceToManeuver !== undefined) { - dataToUpdate.distanceToManeuver = distanceToManeuver - } else { - DBus.sendReply( {__retCode: Common.Result.INVALID_DATA, __message: "distanceToManeuver absence"} ) - } - if (distanceToManeuverScale !== undefined) { - dataToUpdate.distanceToManeuverScale = distanceToManeuverScale - } else { - DBus.sendReply( {__retCode: Common.Result.INVALID_DATA, __message: "distanceToManeuverScale absence"} ) - } - if (maneuverComplete !== undefined) { - dataToUpdate.maneuverComplete = maneuverComplete - } - if (softButtons !== undefined) { - app.navigationSoftButtons.clear() - softButtons.forEach(function(x) { app.navigationSoftButtons.append(x); }); - } - if (appID !== undefined) { - dataToUpdate.appID = appID - } else { - dBus.sendReply( {__retCode: Common.Result.INVALID_DATA, __message: "appID absence"} ) - } - - dataContainer.setApplicationProperties(appID, { navigationModel : dataToUpdate } ) - contentLoader.go("./views/TurnByTurnView.qml", appID) - } - - function alertManeuver(softButtons) { - console.debug("enter") - var softButtonsLog = ""; - - if (softButtons) { - for (var i = 0; i < softButtons.length; i++) { - softButtonsLog += "{type: '" + softButtons[i].type + "', " + - "text: " + softButtons[i].text + "', "; - softButtons[i].image ? softButtonsLog += "image: " + "{value: '" + softButtons[i].image.value + "', imageType: " + softButtons[i].image.imageType + "}, " : softButtonsLog += ""; - softButtonsLog += "isHighlighted: " + softButtons[i].isHighlighted + "', " + - "softButtonID: " + softButtons[i].softButtonID + "', " + - "systemAction: " + softButtons[i].systemAction + - "},"; - } - } - console.log("Message Received - {method: 'Navigation.AlertManeuver', params:{ " + - "softButtons: [" + softButtonsLog + "]" + - "}}") - - console.debug("exit") - return { __retCode: Common.Result.SUCCESS } - } - - function updateTurnList(turnList, softButtons, appID) { - console.debug("enter") - var turnListLog = "", - softButtonsLog = ""; - if (turnList) { - for (var i = 0; i < turnList.length; i++) { - turnList[i].navigationText ? turnListLog += "{navigationText: {fieldName: '" + turnList[i].navigationText.fieldName + "', fieldText: '" + turnList[i].navigationText.fieldText + "'}," : turnListLog += "{"; - turnList[i].turnIcon ? turnListLog += "turnIcon: " + "{value: '" + turnList[i].turnIcon.value + "', imageType: " + turnList[i].turnIcon.imageType + "}}, " : turnListLog += "},"; - } - } - if (softButtons) { - softButtonsLog += "{type: '" + softButtons[0].type + "', " + - "text: '" + softButtons[0].text + "', "; - softButtons[0].image ? softButtonsLog += "image: " + "{value: '" + softButtons[0].image.value + "', imageType: " + softButtons[0].image.imageType + "}, " : softButtonsLog += ""; - softButtonsLog += "isHighlighted: " + softButtons[0].isHighlighted + "', " + - "softButtonID: " + softButtons[0].softButtonID + "', " + - "systemAction: " + softButtons[0].systemAction + - "},"; - } - console.log("Message Received - {method: 'Navigation.UpdateTurnList', params:{ " + - "softButtons: [" + softButtonsLog + "], " + - "turnList: [" + turnListLog + "], " + - "appID: " + appID + - "}}") - if (turnList !== undefined) { - dataContainer.getApplication(appID).turnList.clear(); - turnList.forEach(fillTurnList, dataContainer.getApplication(appID).turnList); - } - if (softButtons !== undefined) { - dataContainer.getApplication(appID).turnListSoftButtons.clear(); - softButtons.forEach(fillSoftButtons, dataContainer.getApplication(appID).turnListSoftButtons); - } - dataContainer.navigationModel.appId = appID; - console.debug("exit") - } - - function fillTexts(element, index, array) { - switch (element.fieldName) { - case Common.TextFieldName.navigationText1: - this.text1 = element.fieldText; - break; - case Common.TextFieldName.navigationText2: - this.text2 = element.fieldText; - break; - case Common.TextFieldName.ETA: - this.eta = element.fieldText; - break; - case Common.TextFieldName.totalDistance: - this.totalDistance = element.fieldText; - break; - case Common.TextFieldName.timeToDestination: - this.timeToDestination = element.fieldText; - break; - } - } - - function startStream(url, appID) { - console.debug("enter") - player.startStream(url) - console.debug("exit") - } - - function stopStream(appID) { - console.debug("enter") - player.stop() - console.debug("exit") - } - - function startAudioStream(url, appID) { - console.log("Message Received - {method: 'Navigation.StartAudioStream', params:{ " + - "url: '" + url + "'" + - "appID: " + appID + - "}}") - stream.source = url; - stream.play(); - } - - function stopAudioStream(appID) { - console.log("Message Received - {method: 'Navigation.StopAudioStream', params:{ " + - "appID: " + appID + - "}}") - stream.stop(); - } - - function fillSoftButtons(element, index, array) { - this.append({ - type: element.type, - text: element.text, - image: element.image, - isHighlighted: element.isHighlighted, - buttonId: element.softButtonID, - systemAction: element.systemAction - }); - } - - function fillTurnList(element, index, array) { - this.append({ - navigationText: element.navigationText, - turnIcon: element.turnIcon - }); - console.debug(element.navigationText) - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/SDL.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/SDL.qml deleted file mode 100644 index c16e1d7750..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/SDL.qml +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -import QtQuick 2.0 -import "Common.js" as Common -import "Async.js" as Async - -Item { -} diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/TTS.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/TTS.qml deleted file mode 100644 index 7884b31097..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/TTS.qml +++ /dev/null @@ -1,203 +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. - */ - -import QtQuick 2.0 -import "Common.js" as Common -import "Async.js" as Async - -Item { - function ttsChunksToString(ttsChunks){ - return ttsChunks.map(function(str) { return str.text }).join('\n') - } - - function isReady() { - console.log("Message Received - {method: 'TTS.IsReady'}") - return { - available: dataContainer.hmiTTSAvailable - } - } - - function speak(ttsChunks, appID) { - // appID unused - console.debug('enter:', ttsChunks, appID); - var ttsChunksLog = ""; - if (ttsChunks) { - for (var i = 0; i < ttsChunks.length; i++) { - ttsChunksLog += "{type: " + ttsChunks[i].type + ", " + - "text: '" + ttsChunks[i].text + "'}, "; - } - } - console.log("Message Received - {method: 'TTS.Speak', params:{ " + - "ttsChunks: [" + ttsChunksLog + "], " + - "appID: " + appID + "', " + - "}}") - if (ttsPopUp.async) { - console.log('speak send abort'); - throw Common.Result.ABORTED; - } - var message = ttsChunksToString(ttsChunks); - ttsPopUp.activate(message); - ttsPopUp.async = new Async.AsyncCall(); - console.debug('exit'); - return ttsPopUp.async; - } - - function stopSpeaking() { - console.debug("enter"); - console.log("Message Received - {method: 'TTS.StopSpeaking'}") - ttsPopUp.deactivate(); - console.debug("exit"); - } - - function getLanguage() { - console.log("Message Received - {method: 'TTS.GetLanguage'}") - return { - language: dataContainer.hmiTTSVRLanguage - } - } - - function getSupportedLanguages() { - console.log("Message Received - {method: 'TTS.GetSupportedLanguages'}") - return { - languages: settingsContainer.sdlLanguagesList - } - } - - function getCapabilities() { - console.log("Message Received - {method: 'TTS.GetCapabilities'}") - return { - speechCapabilities: [ - Common.SpeechCapabilities.SC_TEXT, - Common.SpeechCapabilities.PRE_RECORDED - ], - prerecordedSpeechCapabilities: [ - Common.PrerecordedSpeech.HELP_JINGLE, - Common.PrerecordedSpeech.INITIAL_JINGLE, - Common.PrerecordedSpeech.LISTEN_JINGLE, - Common.PrerecordedSpeech.POSITIVE_JINGLE, - Common.PrerecordedSpeech.NEGATIVE_JINGLE - ] - } - } - - function performInteraction(helpPrompt, initialPrompt, timeoutPrompt, timeout) { - console.debug("enter"); - var helpttsChunksLog = "", - initialttsChunkLog = "", - timeoutttsChunkLog = ""; - - if (helpPrompt) { - for (var i = 0; i < helpPrompt.length; i++) { - helpttsChunksLog += "{type: " + helpPrompt[i].type + ", " + - "text: '" + helpPrompt[i].text + "'}, "; - } - } - if (initialPrompt) { - for (var i = 0; i < initialPrompt.length; i++) { - initialttsChunkLog += "{type: " + initialPrompt[i].type + ", " + - "text: '" + initialPrompt[i].text + "'}, "; - } - } - if (timeoutPrompt) { - for (var i = 0; i < timeoutPrompt.length; i++) { - timeoutttsChunkLog += "{type: " + timeoutPrompt[i].type + ", " + - "text: '" + timeoutPrompt[i].text + "'}, "; - } - } - console.log("Message Received - {method: 'TTS.PerformInteraction', params:{ " + - "helpPrompt: [" + helpttsChunksLog + "], " + - "initialPrompt: [" + initialttsChunkLog + "], " + - "timeoutPrompt: [" + timeoutttsChunkLog + "], " + - "timeout: " + timeout + - "}}") - ttsPopUp.performInteraction(ttsChunksToString(helpPrompt), - ttsChunksToString(initialPrompt), - ttsChunksToString(timeoutPrompt), - timeout) - console.debug("exit"); - } - - function changeRegistration(language, appID) { - console.debug("enter:", language, appID); - console.log("Message Received - {method: 'TTS.ChangeRegistration', params:{ " + - "language: " + language + ", " + - "appID: " + appID + - "}}") - dataContainer.changeRegistrationTTSVR(language, appID); - console.debug("exit"); - } - - function setGlobalProperties(helpPrompt, timeoutPrompt, appID) { - var helpPromptLog = "", - timeoutPromptLog = ""; - if (helpPrompt) { - for (var i = 0; i < helpPrompt.length; i++) { - helpPromptLog += "{type: " + helpPrompt[i].type + ", " + - "text: '" + helpPrompt[i].text + "'}, "; - } - } - if (timeoutPrompt) { - for (var i = 0; i < timeoutPrompt.length; i++) { - timeoutPromptLog += "{type: " + timeoutPrompt[i].type + ", " + - "text: '" + timeoutPrompt[i].text + "'}, "; - } - } - console.log("Message Received - {method: 'TTS.SetGlobalProperties', params:{ " + - "appID:" + appID + ", " + - "helpPrompt: [" + helpPromptLog + "], " + - "timeoutPrompt: [" + timeoutPromptLog + "]" + - "}}") - - var newHelpPropmt = helpPrompt ? - helpPrompt.map( - function (structure) { - return structure.text - } - ).join(", ") : - dataContainer.currentApplication.helpPrompt - - var newTimeoutPrompt = timeoutPrompt ? - timeoutPrompt.map( - function (structure) { - return structure.text - } - ).join(", ") : - dataContainer.currentApplication.timeoutPrompt - - dataContainer.setApplicationProperties(dataContainer.currentApplication.appId, { - helpPrompt: newHelpPropmt, - timeoutPrompt: newTimeoutPrompt - }) - console.debug("exit") - } -} - diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/UI.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/UI.qml deleted file mode 100644 index 659b7842c6..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/UI.qml +++ /dev/null @@ -1,730 +0,0 @@ -/** - * @file UI.qml - * @brief UI interface implementation. - * 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. - */ - -import QtQuick 2.0 -import "Common.js" as Common -import "Async.js" as Async -import "../models/Internal.js" as Internal - -Item { - function filter (strings, fields) { - console.debug("enter") -// substrings for each allowed field - var fieldSubstrings = {} -// this cycle concatenates allowed lines sorting them by field - for (var stringIndex = 0; stringIndex < strings.length; ++stringIndex) { - for (var fieldIndex = 0; fieldIndex < fields.length; ++fieldIndex) { - var fieldName = strings[stringIndex].fieldName - if (fieldName === fields[fieldIndex]) { - if (fieldSubstrings[fieldName] !== undefined) { - fieldSubstrings[fieldName] += "\n"; - fieldSubstrings[fieldName] += strings[stringIndex].fieldText - } - else { - fieldSubstrings[fieldName] = strings[stringIndex].fieldText - } - } - } - } - console.debug("exit") - return fieldSubstrings - } - - function alert (alertStrings, duration, softButtons, progressIndicator, alertType, appID) { - var softButtonsLog = "", - alertStringsLog = ""; - if (alertStrings) { - for (var i = 0; i < alertStrings.length; i++) { - alertStringsLog += "{fieldName: '" + alertStrings[i].fieldName + "', " + - "fieldText: '" + alertStrings[i].fieldText + "'},"; - } - } - if (softButtons) { - for (var i = 0; i < softButtons.length; i++) { - softButtonsLog += "{type: '" + softButtons[i].type + "', " + - "text: " + softButtons[i].text + "', "; - softButtons[i].image ? softButtonsLog += "image: " + "{value: '" + softButtons[i].image.value + "', imageType: " + softButtons[i].image.imageType + "}, " : softButtonsLog += ""; - softButtonsLog += "isHighlighted: " + softButtons[i].isHighlighted + "', " + - "softButtonID: " + softButtons[i].softButtonID + "', " + - "systemAction: " + softButtons[i].systemAction + - "},"; - } - } - console.log("Message Received - {method: 'UI.Alert', params:{ " + - "alertStrings: [" + alertStringsLog + "]," + - "duration: " + duration + "', " + - "softButtons: [" + softButtonsLog + "]," + - "progressIndicator: " + progressIndicator + "', " + - "appID: " + appID + "', " + - "}}") - var fieldSubstrings = alertStrings - .sort(function(a, b) { return a.fieldName - b.fieldName }) // sorting by fieldName - .map(function(val) { return val.fieldText }); // mapping to array of strings - - var tryAgainTime = alertWindow.alert(fieldSubstrings, duration, softButtons, progressIndicator, alertType, appID) - if (tryAgainTime === undefined) { - alertWindow.async = new Async.AsyncCall(); - return alertWindow.async; - } - else { - return { - "__retCode": Common.Result.REJECTED, - "tryAgainTime": tryAgainTime - } - } - } - - function show (showStrings, alignment, graphic, secondaryGraphic, softButtons, customPresets, appID) { - var softButtonsLog = "", - showStringsLog = "", - customPresetsLog = "", - graphiLog = "", - secondaryGraphicLog = ""; - if (showStrings) { - for (var i = 0; i < showStrings.length; i++) { - showStringsLog += "{fieldName: '" + showStrings[i].fieldName + "', " + - "fieldText: '" + showStrings[i].fieldText + "'},"; - } - } - if (customPresets) { - for (var i = 0; i < customPresets.length; i++) { - customPresetsLog += "'" + customPresets[i] + "', "; - } - } - if (softButtons) { - for (var i = 0; i < softButtons.length; i++) { - softButtonsLog += "{type: '" + softButtons[i].type + "', " + - "text: " + softButtons[i].text + "', "; - softButtons[i].image ? softButtonsLog += "image: " + "{value: '" + softButtons[i].image.value + "', imageType: " + softButtons[i].image.imageType + "}, " : softButtonsLog += ""; - softButtonsLog += "isHighlighted: " + softButtons[i].isHighlighted + "', " + - "softButtonID: " + softButtons[i].softButtonID + "', " + - "systemAction: " + softButtons[i].systemAction + - "},"; - } - } - if (graphic) { - graphiLog = "{value: '" + graphic.value + "', imageType: " + graphic.imageType + "}"; - } - if (secondaryGraphic) { - secondaryGraphicLog = "{value: '" + secondaryGraphic.value + "', imageType: " + secondaryGraphic.imageType + "}"; - } - - console.log("Message Received - {method: 'UI.Show', params:{ " + - "showStrings: [" + showStringsLog + "], " + - "alignment: " + alignment + "', " + - "graphic: " + graphiLog + ", " + - "secondaryGraphic: " + secondaryGraphicLog+ ", " + - "softButtons: [" + softButtonsLog + "], " + - "customPresets: [" + customPresetsLog + "], " + - "appID: " + appID + - "}}") - var app = dataContainer.getApplication(appID); - - app.softButtons.clear() - if (softButtons) { - softButtons.forEach(function(x) { app.softButtons.append(x); }); - } - - app.customPresets.clear() - if (customPresets) { - customPresets.forEach( function(x) { app.customPresets.append( {text: x} ); } ) - } - - var textAlignment - switch (alignment) { - case Common.TextAlignment.LEFT_ALIGNED: - textAlignment = Text.AlignLeft - break; - case Common.TextAlignment.RIGHT_ALIGNED: - textAlignment = Text.AlignRight - break; - case Common.TextAlignment.CENTERED: - textAlignment = Text.AlignHCenter - break; - default: - textAlignment = Text.AlignHCenter - break; - } - - // with this array we grab only the lines we need - var showFields = [ - Common.TextFieldName.mainField1, - Common.TextFieldName.mainField2, - Common.TextFieldName.mainField3, - Common.TextFieldName.mainField4, - Common.TextFieldName.statusBar, - Common.TextFieldName.mediaClock, - Common.TextFieldName.mediaTrack - ] - var fieldSubstrings = filter(showStrings, showFields) - var showData = { hmiUIText: {} } - if (fieldSubstrings[Common.TextFieldName.mainField1] !== undefined) { showData.hmiUIText.mainField1 = fieldSubstrings[Common.TextFieldName.mainField1]; } - if (fieldSubstrings[Common.TextFieldName.mainField2] !== undefined) { showData.hmiUIText.mainField2 = fieldSubstrings[Common.TextFieldName.mainField2]; } - if (fieldSubstrings[Common.TextFieldName.mainField3] !== undefined) { showData.hmiUIText.mainField3 = fieldSubstrings[Common.TextFieldName.mainField3]; } - if (fieldSubstrings[Common.TextFieldName.mainField4] !== undefined) { showData.hmiUIText.mainField4 = fieldSubstrings[Common.TextFieldName.mainField4]; } - if (fieldSubstrings[Common.TextFieldName.statusBar] !== undefined) { showData.hmiUIText.statusBar = fieldSubstrings[Common.TextFieldName.statusBar]; } - if (fieldSubstrings[Common.TextFieldName.mediaTrack] !== undefined) { showData.hmiUIText.mediaTrack = fieldSubstrings[Common.TextFieldName.mediaTrack]; } - if (graphic) { showData.hmiUIText.image = graphic.value; } - if (secondaryGraphic) { showData.hmiUIText.secondaryImage = secondaryGraphic.value; } - if (textAlignment) { showData.hmiUITextAlignment = textAlignment; } - if (fieldSubstrings[Common.TextFieldName.mediaClock]) { - showData.mediaClock = { - "updateMode": Internal.MediaClockUpdateMode.MCU_COUNTUP, - "runningMode": Internal.MediaClockRunningMode.MCR_STOPPED, - "magic": Internal.stringToHmsTime(fieldSubstrings[Common.TextFieldName.mediaClock]), - "startTime": Internal.stringToHmsTime(fieldSubstrings[Common.TextFieldName.mediaClock]), - "startTimeForProgress": -1 - } - } - - dataContainer.setApplicationProperties(appID, showData); - console.debug("exit") - } - - function addCommand (cmdID, menuParams, cmdIcon, appID) { - var cmdIconLogs = "", - menuParamsLogs = ""; - - if (cmdIcon) { - cmdIconLogs = "{value: '" + cmdIcon.value + "', imageType: " + cmdIcon.imageType + "}"; - } - if (menuParams) { - menuParamsLogs = "{parentID: " + menuParams.parentID + ", position: " + menuParams.position + "}"; - } - console.log("Message Received - {method: 'UI.AddCommand', params:{ " + - "appID: " + appID + ", " + - "cmdID: " + cmdID + ", " + - "cmdIcon: " + cmdIconLogs + ", " + - "menuParams: " + menuParamsLogs + - "}}") - dataContainer.addCommand(cmdID, menuParams, cmdIcon, appID) - } - - function deleteCommand (cmdID, appID) { - console.log("Message Received - {method: 'UI.DeleteCommand', params:{ " + - "appID: " + appID + ", " + - "cmdID: " + cmdID + - "}}") - dataContainer.deleteCommand(cmdID, appID) - } - - function addSubMenu (menuID, menuParams, appID) { - var menuParamsLogs = ""; - - if (menuParams) { - menuParamsLogs = "{parentID: " + menuParams.parentID + ", position: " + menuParams.position + "}"; - } - console.log("Message Received - {method: 'UI.AddSubMenu', params:{ " + - "appID: " + appID + ", " + - "menuID: " + menuID + ", " + - "menuParams: " + menuParamsLogs + - "}}") - dataContainer.addSubMenu(menuID, menuParams, appID) - } - - function deleteSubMenu (menuID, appID) { - console.log("Message Received - {method: 'UI.DeleteSubMenu', params:{ " + - "appID:" + appID + ", " + - "menuID: " + menuID + - "}}") - dataContainer.deleteSubMenu(menuID, appID) - } - - function performInteraction (initialText, choiceSet, vrHelpTitle, vrHelp, timeout, interactionLayout, appID) { - console.debug("enter") - var choiseLog = "", - vrHelpLog = "", - initialTextLog = ""; - if (choiceSet) { - for (var i = 0; i < choiceSet.length; i++) { - choiseLog += "{choiceID: " + choiceSet[i].choiceID + ", " + - "menuName: '" + choiceSet[i].menuName + "', " + - "image: {value: '" + choiceSet[i].image.value + "', imageType: " + choiceSet[i].image.imageType + "}, " + - "secondaryText: '" + choiceSet[i].secondaryText + "', " + - "tertiaryText: '" + choiceSet[i].tertiaryText + "', " + - "secondaryImage: {value: '" + choiceSet[i].image.value + "', imageType: " + choiceSet[i].image.imageType + "}},"; - } - } - if (vrHelp) { - for (var i = 0; i < vrHelp.length; i++) { - var vrHelpImageLog = ""; - if (vrHelp[i].image) { - vrHelpImageLog = "{value: '" + vrHelp[i].image.value + "', imageType: " + vrHelp[i].image.imageType + "}"; - } - - vrHelpLog += "{text: '" + vrHelp[i].text + "', " + - "image: " + vrHelpImageLog + ", " + - "position: " + vrHelp[i].position + - "},"; - } - } - if (initialText) { - initialTextLog = "{fieldName: " + initialText.fieldName + ", fieldText: '" + initialText.fieldText + "'}"; - } - - console.log("Message Received - {method: 'UI.PerformInteraction', params:{ " + - "appID:" + appID + ", " + - "initialText: " + initialTextLog + ", " + - "choiceSet: [" + choiseLog + "], " + - "vrHelpTitle: '" + vrHelpTitle + "', " + - "vrHelp: [" + vrHelpLog + "], " + - "timeout: " + timeout + ", " + - "interactionLayout: " + interactionLayout + - "}}") - var async = interactionPopup.performInteraction(initialText, choiceSet, vrHelpTitle, vrHelp, timeout, interactionLayout, appID) - console.debug("exit") - return async - } - - function setMediaClockTimer (startTime, endTime, updateMode, appID) { - var startTimeLog = "", - endTimeLog = ""; - if (startTime) { - startTimeLog = "hours: " + startTime.hours + ", minutes: " + startTime.minutes + ", seconds: " + startTime.seconds; - } - if (endTime) { - endTimeLog = "hours: " + endTime.hours + ", minutes: " + endTime.minutes + ", seconds: " + endTime.seconds; - } - - console.log("Message Received - {method: 'UI.SetMediaClockTimer', params:{ " + - "startTime: {" + startTimeLog + "}, " + - "endTime: {" + endTimeLog + "}, " + - "updateMode: " + updateMode + ", " + - "appID: " + appID + - "}}") - var app = dataContainer.getApplication(appID) - var newStartTime - var newEndTime - var newUpdateMode - var newRunningMode - var newStartTimeForProgress - var resultCode - var sendErrorResponce = false - - switch (updateMode) { - case Common.ClockUpdateMode.COUNTUP: - if (startTime === undefined) { - resultCode = Common.Result.INVALID_DATA - sendErrorResponce = true - break - } - newStartTime = Internal.hmsTime(startTime.hours, startTime.minutes, startTime.seconds) - newEndTime = endTime ? Internal.hmsTime(endTime.hours, - endTime.minutes, - endTime.seconds) - : dataContainer.currentApplication.mediaClock.upperTimeLimit - - newUpdateMode = Internal.MediaClockUpdateMode.MCU_COUNTUP - newRunningMode = Internal.MediaClockRunningMode.MCR_RUNNING - newStartTimeForProgress = Internal.hmsTime(startTime.hours, startTime.minutes, startTime.seconds) - resultCode = Common.Result.SUCCESS - break - - case Common.ClockUpdateMode.COUNTDOWN: - if (startTime === undefined) { - resultCode = Common.Result.INVALID_DATA - sendErrorResponce = true - break - } - newStartTime = Internal.hmsTime(startTime.hours, startTime.minutes, startTime.seconds) - newEndTime = endTime ? Internal.hmsTime(endTime.hours, endTime.minutes, endTime.seconds) : 0 - newUpdateMode = Internal.MediaClockUpdateMode.MCU_COUNTDOWN - newRunningMode = Internal.MediaClockRunningMode.MCR_RUNNING - newStartTimeForProgress = Internal.hmsTime(startTime.hours, startTime.minutes, startTime.seconds) - resultCode = Common.Result.SUCCESS - break - - case Common.ClockUpdateMode.PAUSE: - // Already paused or cleared - if ((app.mediaClock.runningMode === Internal.MediaClockRunningMode.MCR_STOPPED) - || (app.mediaClock.startTime === -1 && app.mediaClock.endTime === -1)) { - resultCode = Common.Result.IGNORED - sendErrorResponce = true - break - } - newStartTime = app.mediaClock.startTime - newEndTime = app.mediaClock.endTime - newRunningMode = Internal.MediaClockRunningMode.MCR_STOPPED - newUpdateMode = app.mediaClock.updateMode - newStartTimeForProgress = app.mediaClock.startTimeForProgress - resultCode = Common.Result.SUCCESS - break - - case Common.ClockUpdateMode.RESUME: - // Already resumed or cleared - if ((app.mediaClock.runningMode === Internal.MediaClockRunningMode.MCR_RUNNING) - || (app.mediaClock.startTime === app.mediaClock.endTime)) { - resultCode = Common.Result.IGNORED - sendErrorResponce = true - break - } - newStartTime = app.mediaClock.startTime - newEndTime = app.mediaClock.endTime - newRunningMode = Internal.MediaClockRunningMode.MCR_RUNNING - newStartTimeForProgress = app.mediaClock.startTimeForProgress - newUpdateMode = app.mediaClock.updateMode - resultCode = Common.Result.SUCCESS - break - - case Common.ClockUpdateMode.CLEAR: - newStartTime = -1 - newEndTime = -1 - newRunningMode = Internal.MediaClockRunningMode.MCR_STOPPED - newUpdateMode = app.mediaClock.updateMode - newStartTimeForProgress = -1 - resultCode = Common.Result.SUCCESS - break - } - - if (sendErrorResponce) { - console.debug("exit with result code: ", resultCode) - return { __retCode: resultCode } - } - - dataContainer.setApplicationProperties(appID, { - "mediaClock": { - "updateMode": newUpdateMode, - "runningMode": newRunningMode, - "startTime": newStartTime, - "endTime": newEndTime, - "startTimeForProgress": newStartTimeForProgress - } - }) - - console.debug("exit") - return { __retCode: resultCode } - } - - function setGlobalProperties (vrHelpTitle, vrHelp, menuTitle, menuIcon, keyboardProperties, appID) { - console.debug("enter") - var vrHelpLog = "", - menuIconLog = "", - keyboardPropertiesLog = ""; - if (vrHelp) { - for (var i = 0; i < vrHelp.length; i++) { - var vrHelpImageLog = ""; - if (vrHelp[i].image) { - vrHelpImageLog = "{value: '" + vrHelp[i].image.value + "', imageType: " + vrHelp[i].image.imageType + "}"; - } - vrHelpLog += "{text: '" + vrHelp[i].text + "', " + - "image: " + vrHelpImageLog + ", " + - "position: " + vrHelp[i].position + - "},"; - } - } - if (menuIcon) { - menuIconLog = "{value: '" + menuIcon.value + "', imageType: " + menuIcon.imageType + "}"; - } - if (keyboardProperties) { - keyboardPropertiesLog = "{language: '" + keyboardProperties.language + "', keyboardLayout: '" + keyboardProperties.language + - "', sendDynamicEntry: '" + keyboardProperties.sendDynamicEntry + "', keypressMode: '" + keyboardProperties.keypressMode + - "', limitedCharacterList: '" + keyboardProperties.limitedCharacterList + "', autoCompleteText: '" + keyboardProperties.autoCompleteText + "'}"; - } - - console.log("Message Received - {method: 'UI.SetGlobalProperties', params:{ " + - "appID:" + appID + ", " + - "vrHelpTitle: '" + vrHelpTitle + "', " + - "vrHelp: [" + vrHelpLog + "], " + - "menuTitle: '" + menuTitle + "', " + - "menuIcon: " + menuIconLog + ", " + - "keyboardProperties: " + keyboardPropertiesLog + - "}}") - var app = dataContainer.getApplication(appID) - var dataToUpdate = {} - - if (vrHelpTitle !== undefined) { - dataToUpdate.vrHelpTitle = vrHelpTitle - } else if ( (vrHelp !== undefined) && (vrHelp.length >= 1) ) { - return { __retCode: Common.Result.REJECTED, __message: "vrHelpTitle - undefined, vrHelpItem - provided" } - } - - if (vrHelp !== undefined) { - var checkSequentialPosition = vrHelp[0].position - for (var index = 0; index < vrHelp.length; index++) { - if (vrHelp[index].position !== checkSequentialPosition) { - return { __retCode: Common.Result.REJECTED, __message: "Nonsequential positions of VrHelpItems" } - } - checkSequentialPosition++ - } - - if (app.vrHelpItems.count !== 0) { - app.vrHelpItems.clear() - } - vrHelp.forEach( Internal.appendVrHelpItem, app.vrHelpItems ) - } else { - if (vrHelpTitle !== undefined) { - return { __retCode: Common.Result.REJECTED, __message: "vrHelpItems - undefined, vrHelpTitle - provided" } - } - } - if (menuTitle !== undefined) { - dataToUpdate.menuTitle = menuTitle - } - if (menuIcon !== undefined) { - dataToUpdate.menuIcon = menuIcon - } - dataContainer.setApplicationProperties(appID, dataToUpdate) - console.debug("exit") - } - - function isReady () { - console.log("Message Received - {method: 'UI.IsReady'}") - return { - available: dataContainer.hmiUIAvailable - } - } - - function getLanguage () { - console.log("Message Received - {method: 'UI.GetLanguage'}") - return { - language: dataContainer.hmiUILanguage - } - } - - function getSupportedLanguages () { - console.log("Message Received - {method: 'UI.GetSupportedLanguages'}") - return { - languages: settingsContainer.sdlLanguagesList - } - } - - function changeRegistration (language, appID) { - console.log("Message Received - {method: 'UI.ChangeRegistration', params:{ " + - "language: " + language + ", " + - "appID: " + appID + - "}}") - dataContainer.changeRegistrationUI(language, appID) - } - - function setAppIcon (syncFileName, appID) { - var syncFileNameLog = ""; - if (syncFileName) { - syncFileNameLog = "{value: '" + syncFileName.value + "', imageType: " + syncFileName.imageType + "}"; - } - - console.log("Message Received - {method: 'UI.SetAppIcon', params:{ " + - "syncFileName: " + syncFileNameLog + ", " + - "appID: " + appID + - "}}") - dataContainer.setApplicationProperties(appID, { icon: syncFileName.value }) - } - - function slider (numTicks, position, sliderHeader, sliderFooter, timeout, appID) { - console.log("Message Received - {method: 'UI.Slider', params:{ " + - "numTicks: " + numTicks + "', " + - "position: " + position + "', " + - "sliderHeader: '" + sliderHeader + "', " + - "sliderFooter: [" + sliderFooter + "], " + - "timeout: " + timeout + ", " + - "appID: " + appID + - "}}") - if (dataContainer.uiSlider.running) { - console.debug("aborted") - return {__retCode: Common.Result.ABORTED, sliderPosition: position} - } - - dataContainer.uiSlider.appName = dataContainer.getApplication(appID).appName - dataContainer.uiSlider.header = sliderHeader - dataContainer.uiSlider.footer = sliderFooter - dataContainer.uiSlider.numTicks = numTicks - dataContainer.uiSlider.position = position - dataContainer.uiSlider.timeout = timeout - - if (timeout !== 0) { - sliderPopup.showSlider() - sliderPopup.async = new Async.AsyncCall(); - console.debug("exit") - return sliderPopup.async; - } else { - console.debug("exit") - return { sliderPosition: position } - } - } - - function scrollableMessage (messageText, timeout, softButtons, appID) { - var softButtonsLog = "", - messageTextLog = ""; - if (softButtons) { - for (var i = 0; i < softButtons.length; i++) { - softButtonsLog += "{type: '" + softButtons[i].type + "', " + - "text: " + softButtons[i].text + "', "; - softButtons[i].image ? softButtonsLog += "image: " + "{value: '" + softButtons[i].image.value + "', imageType: " + softButtons[i].image.imageType + "}, " : softButtonsLog += ""; - softButtonsLog += "isHighlighted: " + softButtons[i].isHighlighted + "', " + - "softButtonID: " + softButtons[i].softButtonID + "', " + - "systemAction: " + softButtons[i].systemAction + - "},"; - } - } - if (messageText) { - messageTextLog = "{fieldName: " + messageText.fieldName + ", fieldText: '" + messageText.fieldText + "'}"; - } - - console.log("Message Received - {method: 'UI.ScrollableMessage', params:{ " + - "messageText: " + messageTextLog + ", " + - "timeout: " + timeout + "', " + - "softButtons: [" + softButtonsLog + "]," + - "appID: " + appID + "', " + - "}}") - // TODO{ALeshin}: Also check HMILevel, when it will be available. It should be FULL otherwise - REJECTED - if (contentLoader.item.systemContext !== Common.SystemContext.SYSCTXT_MAIN) { - return { __retCode: Common.Result.REJECTED, __message: "System Context isn't MAIN" } - } - if(dataContainer.scrollableMessageModel.running){ - //send error response if scrollable message already running - return { __retCode: Common.Result.ABORTED, __message: "ScrollableMessage already running" } - } - - dataContainer.scrollableMessageModel.longMessageText = messageText.fieldText - if (timeout === 0) { - return { __retCode: Common.Result.SUCCESS, __message: "Timeout = 0" } - } else { - dataContainer.scrollableMessageModel.timeout = timeout - } - - dataContainer.scrollableMessageModel.softButtons.clear(); - if (softButtons !== undefined) { - softButtons.forEach(fillSoftButtons, dataContainer.scrollableMessageModel.softButtons); - } - dataContainer.scrollableMessageModel.appId = appID - dataContainer.scrollableMessageModel.async = new Async.AsyncCall() - contentLoader.go("./views/ScrollableMessageView.qml") - console.debug("exit") - return dataContainer.scrollableMessageModel.async - } - - function getCapabilities() { - console.log("Message Received - {method: 'UI.GetCapabilities'}") - return { - "audioPassThruCapabilities": { - "samplingRate": Common.SamplingRate.RATE_44KHZ, - "bitsPerSample": Common.BitsPerSample.RATE_8_BIT, - "audioType": Common.AudioType.PCM - }, - "displayCapabilities": settingsContainer.displayCapabilities, - "hmiZoneCapabilities": Common.HmiZoneCapabilities.FRONT, - "softButtonCapabilities": settingsContainer.softButtonCapabilities - } - } - - function performAudioPassThru (appID, audioPassThruDisplayTexts, timeout) { - var displayTextsLog = ""; - if (audioPassThruDisplayTexts) { - for (var i = 0; i < audioPassThruDisplayTexts.length; i++) { - displayTextsLog += "{fieldName: '" + audioPassThruDisplayTexts[i].fieldName + "', " + - "fieldText: " + audioPassThruDisplayTexts[i].fieldText + "'},"; - } - } - console.log("Message Received - {method: 'UI.PerformAudioPassThru', params:{ " + - "audioPassThruDisplayTexts: [" + displayTextsLog + "], " + - "maxDuration: " + timeout + - "}}") - - if (dataContainer.uiAudioPassThru.running) { - console.debug("aborted") - throw Common.Result.ABORTED - } - - dataContainer.uiAudioPassThru.appName = dataContainer.getApplication(appID).appName - dataContainer.uiAudioPassThru.timeout = timeout - if (audioPassThruDisplayTexts.length === 2) { - dataContainer.uiAudioPassThru.firstLine = audioPassThruDisplayTexts[0].fieldText - dataContainer.uiAudioPassThru.secondLine = audioPassThruDisplayTexts[1].fieldText - } - performAudioPassThruPopup.async = new Async.AsyncCall(); - performAudioPassThruPopup.showAudioPassThru() - console.debug("exit") - return performAudioPassThruPopup.async; - } - - function endAudioPassThru () { - console.debug("enter") - console.log("Message Received - {method: 'UI.EndAudioPassThru'}") - - if (!dataContainer.uiAudioPassThru.running) { - console.debug("rejected") - throw Common.Result.REJECTED - } - DBus.sendReply({__retCode: Common.Result.SUCCESS}) - performAudioPassThruPopup.complete(Common.Result.SUCCESS) - console.debug("exit") - } - - function closePopUp (methodName) { - console.debug("enter") - console.log("Message Received - {method: 'UI.ClosePopUp', params:{ " + - "methodName: " + methodName + - "}}") - var popUpToClose - - if (dataContainer.activePopup.length === 0) { - return { __retCode: Common.Result.ABORT, __message: "No active PopUps"} - } - - if (methodName !== undefined) { - popUpToClose = methodName - } else { - popUpToClose = dataContainer.activePopup[dataContain.activePopUp.length - 1] - } - - switch (popUpToClose) { - case "UI.PerformInteraction": - interactionPopup.complete(Common.Result.SUCCESS) - break - case "UI.Slider": - sliderPopup.complete(Common.Result.SUCCESS) - break - case "UI.PerformAudioPassThru": - performAudioPassThruPopup.complete(Common.Result.SUCCESS) - break - case "UI.Alert": - alertWindow.complete(Common.Result.SUCCESS) - break - case "UI.VrHelp": - vrHelpPopup.complete(Common.Result.SUCCESS) - break - } - console.debug("exit") - } - - function fillSoftButtons(element, index, array) { - this.append({ - type: element.type, - text: element.text, - image: element.image, - isHighlighted: element.isHighlighted, - softButtonID: element.softButtonID, - systemAction: element.systemAction - }); - } - -} diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/VR.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/VR.qml deleted file mode 100644 index 8158b3271e..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/VR.qml +++ /dev/null @@ -1,170 +0,0 @@ -/** - * @file VR.qml - * @brief Implement of interface VR. - * 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. - */ - -import QtQuick 2.0 -import "Common.js" as Common -Item { - function isReady() { - console.log("Message Received - {method: 'VR.IsReady'}") - return { - available: dataContainer.hmiVRAvailable - } - } - - function addCommand(cmdID, vrCommands, type, grammarID, appID) { - var vrCommandsLog = ""; - if (vrCommands) { - for (var i = 0; i < vrCommands.length; i++) { - vrCommandsLog += "'" + vrCommands[i] + "', "; - } - } - console.log("Message Received - {method: 'VR.AddCommand', params:{ " + - "vrCommands: [" + vrCommandsLog + "], " + - "cmdID: " + cmdID + ", " + - "appID: " + appID + ", " + - "type: " + type + ", " + - "grammarID: " + grammarID + - "}}") - for (var i = 0; i < vrCommands.length; ++i) { - if (type === Common.VRCommandType.Command) { - dataContainer.vrCommands.append({ - cmdID: cmdID, - command: vrCommands[i], - appID: appID === undefined ? 0 : appID, - type: type, - grammarID: grammarID, - }); - } - else { - dataContainer.choicesVrCommands.append({ - cmdID: cmdID, - command: vrCommands[i], - appID: appID === undefined ? 0 : appID, - type: type, - grammarID: grammarID, - }); - } - } - console.log("exit") - } - - function deleteCommand(cmdID, appID) { - console.log("Message Received - {method: 'VR.DeleteCommand', params:{ " + - "appID: " + appID + ", " + - "cmdID: " + cmdID + - "}}") - for (var i = 0; i < dataContainer.vrCommands.count; ) { - if ((dataContainer.vrCommands.get(i).cmdID === cmdID) && - ((appID === undefined) || (dataContainer.vrCommands.get(i).appID === appID))) { - dataContainer.vrCommands.remove(i); - continue; - } - ++i; - } - console.log("exit") - } - - function getLanguage() { - console.log("Message Received - {method: 'VR.GetLanguage'}") - return { - language: dataContainer.hmiTTSVRLanguage - } - } - - function getSupportedLanguages() { - console.log("Message Received - {method: 'VR.GetSupportedLanguages'}") - return { - languages: settingsContainer.sdlLanguagesList - } - } - - function getCapabilities() { - console.log("Message Received - {method: 'UI.GetCapabilities'}") - return { - vrCapabilities: [ Common.VrCapabilities.VR_TEXT ] - } - } - - function changeRegistration(language, appID) { - console.debug("enter"); - console.log("Message Received - {method: 'VR.ChangeRegistration', params:{ " + - "language: " + language + ", " + - "appID: " + appID + - "}}") - dataContainer.changeRegistrationTTSVR(language, appID); - console.debug("exit"); - } - function ttsChunksToString(ttsChunks){ - return ttsChunks.map(function(str) { return str.text }).join('\n') - } - function performInteraction(helpPrompt, initialPrompt, timeoutPrompt, timeout, grammarID) { - console.debug("enter"); - var helpttsChunksLog = "", - initialttsChunkLog = "", - timeoutttsChunkLog = "", - grammarIDLog =""; - - if (helpPrompt) { - for (var i = 0; i < helpPrompt.length; i++) { - helpttsChunksLog += "{type: " + helpPrompt[i].type + ", " + - "text: '" + helpPrompt[i].text + "'}, "; - } - } - if (initialPrompt) { - for (var i = 0; i < initialPrompt.length; i++) { - initialttsChunkLog += "{type: " + initialPrompt[i].type + ", " + - "text: '" + initialPrompt[i].text + "'}, "; - } - } - if (timeoutPrompt) { - for (var i = 0; i < timeoutPrompt.length; i++) { - timeoutttsChunkLog += "{type: " + timeoutPrompt[i].type + ", " + - "text: '" + timeoutPrompt[i].text + "'}, "; - } - } - console.log("Message Received - {method: 'TTS.PerformInteraction', params:{ " + - "helpPrompt: [" + helpttsChunksLog + "], " + - "initialPrompt: [" + initialttsChunkLog + "], " + - "timeoutPrompt: [" + timeoutttsChunkLog + "], " + - "timeout: " + timeout + - "}}") - - ttsPopUp.performInteraction(ttsChunksToString(helpPrompt), - ttsChunksToString(initialPrompt), - ttsChunksToString(timeoutPrompt), - timeout) - interactionPopup.grammarID = grammarID - console.debug("exit"); - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/hmi_api/VehicleInfo.qml b/src/components/qt_hmi/qml_model_qt5/hmi_api/VehicleInfo.qml deleted file mode 100644 index e564860517..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/hmi_api/VehicleInfo.qml +++ /dev/null @@ -1,764 +0,0 @@ -/** - * @file VehicleInfo.qml - * @brief Vehicle information interface realisation. - * 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. - */ - -import QtQuick 2.0 -import "Common.js" as Common - -Item { - function isReady () { - console.log("Message Received - {method: 'VehicleInfo.IsReady'}") - return { - available: dataContainer.hmiVehicleInfoAvailable - } - } - - function getVehicleType() { - console.log("Message Received - {method: 'VehicleInfo.GetVehicleType'}") - return { - "vehicleType": { - "make": "Ford", - "model": "Fiesta", - "modelYear": "2013", - "trim": "SE" - } - } - } - - function getGpsData(appID) { - console.debug("enter") - console.debug("exit") - return { gps: dataContainer.vehicleInfoModel.gps } - } - - function getSpeed(appID) { - console.debug("enter") - console.debug("exit") - return { speed: dataContainer.vehicleInfoModel.speed } - } - - function getRpm(appID) { - console.debug("enter") - console.debug("exit") - return { - rpm: dataContainer.vehicleInfoModel.rpm, - __retCode: Common.Result.DATA_NOT_AVAILABLE - } - } - - function getFuelLevel(appID) { - console.debug("enter") - console.debug("exit") - return { fuelLevel: dataContainer.vehicleInfoModel.fuelLevel } - } - - function getFuelLevelState(appID) { - console.debug("enter") - console.debug("exit") - return { fuelLevel_State: dataContainer.vehicleInfoModel.fuelLevel_State } - } - - function getInstantFuelConsumption(appID) { - console.debug("enter") - console.debug("exit") - return { instantFuelConsumption: dataContainer.vehicleInfoModel.instantFuelConsumption } - } - - function getExternalTemperature(appID) { - console.debug("enter") - console.debug("exit") - return { externalTemperature: dataContainer.vehicleInfoModel.externalTemperature } - } - - function getVin(appID) { - console.debug("enter") - console.debug("exit") - return { vin: dataContainer.vehicleInfoModel.vin } - } - - function getPrndl(appID) { - console.debug("enter") - if (dataContainer.vehicleInfoModel.prndl === -1) { // Test value, to check response - console.debug("exit") - return { - prndl: dataContainer.vehicleInfoModel.prndl, - __retCode: Common.Result.DATA_NOT_AVAILABLE - } - } - console.debug("exit") - return { prndl: dataContainer.vehicleInfoModel.prndl } - } - - function getTirePressure(appID) { - console.debug("enter") - console.debug("exit") - return { tirePressure: dataContainer.vehicleInfoModel.tirePressure } - } - - function getOdometer(appID) { - console.debug("enter") - console.debug("exit") - return { - odometer: dataContainer.vehicleInfoModel.odometer, - __retCode: Common.Result.DATA_NOT_AVAILABLE - } - } - - function getBeltStatus(appID) { - console.debug("enter") - console.debug("exit") - return { beltStatus: dataContainer.vehicleInfoModel.beltStatus } - } - - function getBodyInformation(appID) { - console.debug("enter") - console.debug("exit") - return { bodyInformation: dataContainer.vehicleInfoModel.bodyInformation } - } - - function getDeviceStatus(appID) { - console.debug("enter") - console.debug("exit") - return { deviceStatus: dataContainer.vehicleInfoModel.deviceStatus } - } - - function getDriverBraking(appID) { - console.debug("enter") - console.debug("exit") - return { driverBraking: dataContainer.vehicleInfoModel.driverBraking } - } - - function getWiperStatus(appID) { - console.debug("enter") - console.debug("exit") - return { wiperStatus: dataContainer.vehicleInfoModel.wiperStatus } - } - - function getHeadLampStatus(appID) { - console.debug("enter") - console.debug("exit") - return { headLampStatus: dataContainer.vehicleInfoModel.headLampStatus } - } - - function getEngineTorque(appID) { - console.debug("enter") - console.debug("exit") - return { engineTorque: dataContainer.vehicleInfoModel.engineTorque } - } - - function getAccPedalPosition(appID) { - console.debug("enter") - console.debug("exit") - return { accPedalPosition: dataContainer.vehicleInfoModel.accPedalPosition } - } - - function getSteeringWheelAngle(appID) { - console.debug("enter") - console.debug("exit") - return { steeringWheelAngle: dataContainer.vehicleInfoModel.steeringWheelAngle } - } - - function getECallInfo(appID) { - console.debug("enter") - console.debug("exit") - return { eCallInfo: dataContainer.vehicleInfoModel.eCallInfo } - } - - function getAirbagStatus(appID) { - console.debug("enter") - console.debug("exit") - return { airbagStatus: dataContainer.vehicleInfoModel.airbagStatus } - } - - function getEmergencyEvent(appID) { - console.debug("enter") - console.debug("exit") - return { emergencyEvent: dataContainer.vehicleInfoModel.emergencyEvent } - } - - function getClusterModeStatus(appID) { - console.debug("enter") - console.debug("exit") - return { clusterModeStatus: dataContainer.vehicleInfoModel.clusterModeStatus } - } - - function getMyKey(appID) { - console.debug("enter") - console.debug("exit") - return { myKey: dataContainer.vehicleInfoModel.myKey } - } - - function getDTCs(ecuName, dtcMask, appID) { - console.log("Message Received - {method: 'VehicleInfo.GetDTCs', params:{ " + - "ecuName: " + ecuName + ", " + - "dtcMask: " + dtcMask + ", " + - "appID: " + appID + - "}}") - var ecuHeader = 2 - var dtc = [] - - for (var i = 0; i < 3; i++) { - dtc.push("line" + i) - } - return {ecuHeader: ecuHeader, dtc: dtc} - } - - function readDID(ecuName, didLocation, appID) { - console.debug("Enter") - console.log("Message Received - {method: 'VehicleInfo.ReadDID', params:{ " + - "ecuName: " + ecuName + ", " + - "didLocation: " + didLocation + ", " + - "appID: " + appID + - "}}") - //TODO{ALeshin}: refactoring of this function, when we'll have Vehicle Info module - var didResult = [] - - for (var i = 0; i < didLocation.length; i++) { - if (i < 10) { - didResult[i] = {} - didResult[i].resultCode = Common.VehicleDataResultCode.VDRC_SUCCESS - didResult[i].didLocation = didLocation[i] - didResult[i].data = '0' - } - else { - didResult[i] = {} - didResult[i].resultCode = Common.VehicleDataResultCode.VDRC_DATA_NOT_AVAILABLE - didResult[i].didLocation = didLocation[i] - didResult[i].data = '0' - } - } - console.debug("Exit") - return {didResult: didResult} - } - - function subscribeGps(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onGpsChanged.disconnect(model.sendGpsChange) - model.onGpsChanged.connect(model.sendGpsChange) - console.debug("exit") - return {gps: - { dataType: Common.VehicleDataType.VEHICLEDATA_GPS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS} } - } - function unsubscribeGps(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onGpsChanged.disconnect(model.sendGpsChange) - console.debug("exit") - return {gps: - { dataType: Common.VehicleDataType.VEHICLEDATA_GPS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS} } - - } - - function subscribeSpeed(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onSpeedChanged.disconnect(model.sendSpeedChange) - model.onSpeedChanged.connect(model.sendSpeedChange) - console.debug("exit") - return { speed: - { dataType: Common.VehicleDataType.VEHICLEDATA_SPEED, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeSpeed(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onSpeedChanged.disconnect(model.sendSpeedChange) - console.debug("exit") - return { speed: - { dataType: Common.VehicleDataType.VEHICLEDATA_SPEED, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeRpm(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onRpmChanged.disconnect(model.sendRpmChange) - model.onRpmChanged.connect(model.sendRpmChange) - console.debug("exit") - return { rpm: - { dataType: Common.VehicleDataType.VEHICLEDATA_RPM, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeRpm(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onRpmChanged.disconnect(model.sendRpmChange) - console.debug("exit") - return { rpm: - { dataType: Common.VehicleDataType.VEHICLEDATA_RPM, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeFuelLevel(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onFuelLevelChanged.disconnect(model.sendFuelLevelChange) - model.onFuelLevelChanged.connect(model.sendFuelLevelChange) - console.debug("exit") - return { fuelLevel: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELLEVEL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeFuelLevel(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onFuelLevelChanged.disconnect(model.sendFuelLevelChange) - console.debug("exit") - return { fuelLevel: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELLEVEL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeFuelLevel_State(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onFuelLevel_StateChanged.disconnect(model.sendFuelLevel_StateChange) - model.onFuelLevel_StateChanged.connect(model.sendFuelLevel_StateChange) - console.debug("exit") - return { fuelLevel_State: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeFuelLevel_State(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onFuelLevel_StateChanged.disconnect(model.sendFuelLevel_StateChange) - console.debug("exit") - return { fuelLevel_State: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELLEVEL_STATE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeInstantFuelConsumption(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onInstantFuelConsumptionChanged.disconnect(model.sendInstantFuelConsumptionChange) - model.onInstantFuelConsumptionChanged.connect(model.sendInstantFuelConsumptionChange) - console.debug("exit") - return { instantFuelConsumption: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELCONSUMPTION, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeInstantFuelConsumption(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onInstantFuelConsumptionChanged.disconnect(model.sendInstantFuelConsumptionChange) - console.debug("exit") - return { instantFuelConsumption: - { dataType: Common.VehicleDataType.VEHICLEDATA_FUELCONSUMPTION, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeExternalTemperature(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onExternalTemperatureChanged.disconnect(model.sendExternalTemperatureChange) - model.onExternalTemperatureChanged.connect(model.sendExternalTemperatureChange) - console.debug("exit") - return { externalTemperature: - { dataType: Common.VehicleDataType.VEHICLEDATA_EXTERNTEMP, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeExternalTemperature(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onExternalTemperatureChanged.disconnect(model.sendExternalTemperatureChange) - console.debug("exit") - return { externalTemperature: - { dataType: Common.VehicleDataType.VEHICLEDATA_EXTERNTEMP, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribePrndl(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onPrndlChanged.disconnect(model.sendPrndlChange) - model.onPrndlChanged.connect(model.sendPrndlChange) - console.debug("exit") - return { prndl: - { dataType: Common.VehicleDataType.VEHICLEDATA_PRNDL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribePrndl(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onPrndlChanged.disconnect(model.sendPrndlChange) - console.debug("exit") - return { prndl: - { dataType: Common.VehicleDataType.VEHICLEDATA_PRNDL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeVin(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onVinChanged.disconnect(model.sendVinChange) - model.onVinChanged.connect(model.sendVinChange) - console.debug("exit") - return { vin: - { dataType: Common.VehicleDataType.VEHICLEDATA_VIN, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeVin(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onVinChanged.disconnect(model.sendVinChange) - console.debug("exit") - return { vin: - { dataType: Common.VehicleDataType.VEHICLEDATA_VIN, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeTirePressure(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onTirePressureChanged.disconnect(model.sendTirePressureChange) - model.onTirePressureChanged.connect(model.sendTirePressureChange) - console.debug("exit") - return { tirePressure: - { dataType: Common.VehicleDataType.VEHICLEDATA_TIREPRESSURE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeTirePressure(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onTirePressureChanged.disconnect(model.sendTirePressureChange) - console.debug("exit") - return { tirePressure: - { dataType: Common.VehicleDataType.VEHICLEDATA_TIREPRESSURE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeOdometer(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onOdometerChanged.disconnect(model.sendOdometerChange) - model.onOdometerChanged.connect(model.sendOdometerChange) - console.debug("exit") - return { odometer: - { dataType: Common.VehicleDataType.VEHICLEDATA_ODOMETER, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeOdometer(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onOdometerChanged.disconnect(model.sendOdometerChange) - console.debug("exit") - return { odometer: - { dataType: Common.VehicleDataType.VEHICLEDATA_ODOMETER, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeBeltStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onBeltStatusChanged.disconnect(model.sendBeltStatusChange) - model.onBeltStatusChanged.connect(model.sendBeltStatusChange) - console.debug("exit") - return { beltStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_BELTSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeBeltStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onBeltStatusChanged.disconnect(model.sendBeltStatusChange) - console.debug("exit") - return { beltStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_BELTSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeBodyInformation(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onBodyInformationChanged.disconnect(model.sendBodyInformationChange) - model.onBodyInformationChanged.connect(model.sendBodyInformationChange) - console.debug("exit") - return { bodyInformation: - { dataType: Common.VehicleDataType.VEHICLEDATA_BODYINFO, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeBodyInformation(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onBodyInformationChanged.disconnect(model.sendBodyInformationChange) - console.debug("exit") - return { bodyInformation: - { dataType: Common.VehicleDataType.VEHICLEDATA_BODYINFO, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeDeviceStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onDeviceStatusChanged.disconnect(model.sendDeviceStatusChange) - model.onDeviceStatusChanged.connect(model.sendDeviceStatusChange) - console.debug("exit") - return { deviceStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_DEVICESTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeDeviceStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onDeviceStatusChanged.disconnect(model.sendDeviceStatusChange) - console.debug("exit") - return { deviceStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_DEVICESTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeDriverBraking(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onDriverBrakingChanged.disconnect(model.sendDriverBrakingChange) - model.onDriverBrakingChanged.connect(model.sendDriverBrakingChange) - console.debug("exit") - return { driverBraking: - { dataType: Common.VehicleDataType.VEHICLEDATA_BRAKING, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeDriverBraking(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onDriverBrakingChanged.disconnect(model.sendDriverBrakingChange) - console.debug("exit") - return { driverBraking: - { dataType: Common.VehicleDataType.VEHICLEDATA_BRAKING, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeWiperStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onWiperStatusChanged.disconnect(model.sendWiperStatusChange) - model.onWiperStatusChanged.connect(model.sendWiperStatusChange) - console.debug("exit") - return { wiperStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_WIPERSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeWiperStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onWiperStatusChanged.disconnect(model.sendWiperStatusChange) - console.debug("exit") - return { wiperStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_WIPERSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeHeadLampStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onHeadLampStatusChanged.disconnect(model.sendHeadLampStatusChange) - model.onHeadLampStatusChanged.connect(model.sendHeadLampStatusChange) - console.debug("exit") - return { headLampStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeHeadLampStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onHeadLampStatusChanged.disconnect(model.sendHeadLampStatusChange) - console.debug("exit") - return { headLampStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_HEADLAMPSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeEngineTorque(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onEngineTorqueChanged.disconnect(model.sendEngineTorqueChange) - model.onEngineTorqueChanged.connect(model.sendEngineTorqueChange) - console.debug("exit") - return { engineTorque: - { dataType: Common.VehicleDataType.VEHICLEDATA_ENGINETORQUE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeEngineTorque(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onEngineTorqueChanged.disconnect(model.sendEngineTorqueChange) - console.debug("exit") - return { engineTorque: - { dataType: Common.VehicleDataType.VEHICLEDATA_ENGINETORQUE, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeAccPedalPosition(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onAccPedalPositionChanged.disconnect(model.sendAccPedalPositionChange) - model.onAccPedalPositionChanged.connect(model.sendAccPedalPositionChange) - console.debug("exit") - return { accPedalPosition: - { dataType: Common.VehicleDataType.VEHICLEDATA_ACCPEDAL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeAccPedalPosition(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onAccPedalPositionChanged.disconnect(model.sendAccPedalPositionChange) - console.debug("exit") - return { accPedalPosition: - { dataType: Common.VehicleDataType.VEHICLEDATA_ACCPEDAL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeSteeringWheelAngle(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onSteeringWheelAngleChanged.disconnect(model.sendSteeringWheelAngleChange) - model.onSteeringWheelAngleChanged.connect(model.sendSteeringWheelAngleChange) - console.debug("exit") - return { steeringWheelAngle: - { dataType: Common.VehicleDataType.VEHICLEDATA_STEERINGWHEEL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeSteeringWheelAngle(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onSteeringWheelAngleChanged.disconnect(model.sendSteeringWheelAngleChange) - console.debug("exit") - return { steeringWheelAngle: - { dataType: Common.VehicleDataType.VEHICLEDATA_STEERINGWHEEL, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeECallInfo(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onECallInfoChanged.disconnect(model.sendECallInfoChange) - model.onECallInfoChanged.connect(model.sendECallInfoChange) - console.debug("exit") - return { eCallInfo: - { dataType: Common.VehicleDataType.VEHICLEDATA_ECALLINFO, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeECallInfo(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onECallInfoChanged.disconnect(model.sendECallInfoChange) - console.debug("exit") - return { eCallInfo: - { dataType: Common.VehicleDataType.VEHICLEDATA_ECALLINFO, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeAirbagStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onAirbagStatusChanged.disconnect(model.sendAirbagStatusChange) - model.onAirbagStatusChanged.connect(model.sendAirbagStatusChange) - console.debug("exit") - return { airbagStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_AIRBAGSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeAirbagStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onAirbagStatusChanged.disconnect(model.sendAirbagStatusChange) - console.debug("exit") - return { airbagStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_AIRBAGSTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeEmergencyEvent(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onEmergencyEventChanged.disconnect(model.sendEmergencyEventChange) - model.onEmergencyEventChanged.connect(model.sendEmergencyEventChange) - console.debug("exit") - return { emergencyEvent: - { dataType: Common.VehicleDataType.VEHICLEDATA_EMERGENCYEVENT, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeEmergencyEvent(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onEmergencyEventChanged.disconnect(model.sendEmergencyEventChange) - console.debug("exit") - return { emergencyEvent: - { dataType: Common.VehicleDataType.VEHICLEDATA_EMERGENCYEVENT, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeClusterModeStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onClusterModeStatusChanged.disconnect(model.sendClusterModeStatusChange) - model.onClusterModeStatusChanged.connect(model.sendClusterModeStatusChange) - console.debug("exit") - return { clusterModeStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeClusterModeStatus(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onClusterModeStatusChanged.disconnect(model.sendClusterModeStatusChange) - console.debug("exit") - return { clusterModeStatus: - { dataType: Common.VehicleDataType.VEHICLEDATA_CLUSTERMODESTATUS, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - - function subscribeMyKey(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onMyKeyChanged.disconnect(model.sendMyKeyChange) - model.onMyKeyChanged.connect(model.sendMyKeyChange) - console.debug("exit") - return { myKey: - { dataType: Common.VehicleDataType.VEHICLEDATA_MYKEY, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } - function unsubscribeMyKey(appID) { - console.debug("enter") - var model = dataContainer.vehicleInfoModel; - model.onMyKeyChanged.disconnect(model.sendMyKeyChange) - console.debug("exit") - return { myKey: - { dataType: Common.VehicleDataType.VEHICLEDATA_MYKEY, - resultCode: Common.VehicleDataResultCode.VDRC_SUCCESS } } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/log4cxx.properties b/src/components/qt_hmi/qml_model_qt5/log4cxx.properties deleted file mode 100644 index 0bc5ac8fdf..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/log4cxx.properties +++ /dev/null @@ -1,41 +0,0 @@ -# Socket logger -log4j.appender.SocketHub=org.apache.log4j.net.SocketHubAppender -log4j.appender.SocketHub.port=4555 -log4j.appender.SocketHub.locationInfo=true - -# Only ERROR and FATAL messages are logged to console -log4j.appender.Console=org.apache.log4j.ConsoleAppender -log4j.appender.Console.ImmediateFlush=true -log4j.appender.Console.layout=org.apache.log4j.PatternLayout -log4j.appender.Console.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %m%n -log4j.appender.Console.Threshold=ERROR - -# Log for all DBus plugin messages -log4j.appender.DBusPluginLogFile=org.apache.log4j.FileAppender -log4j.appender.DBusPluginLogFile.File=DBusPlugin.log -log4j.appender.DBusPluginLogFile.append=false -log4j.appender.DBusPluginLogFile.DatePattern='.' yyyy-MM-dd -log4j.appender.DBusPluginLogFile.ImmediateFlush=true -log4j.appender.DBusPluginLogFile.layout=org.apache.log4j.PatternLayout -log4j.appender.DBusPluginLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n - -# Log for all HMI Framework plugin -log4j.appender.HmiFrameworkPluginLogFile=org.apache.log4j.FileAppender -log4j.appender.HmiFrameworkPluginLogFile.File=HmiFrameworkPlugin.log -log4j.appender.HmiFrameworkPluginLogFile.append=false -log4j.appender.HmiFrameworkPluginLogFile.DatePattern='.' yyyy-MM-dd -log4j.appender.HmiFrameworkPluginLogFile.ImmediateFlush=true -log4j.appender.HmiFrameworkPluginLogFile.layout=org.apache.log4j.PatternLayout -log4j.appender.HmiFrameworkPluginLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n - -# Log for all Qt HMI -log4j.rootLogger=ALL, Console - -# Log for DBus plugin QtHMI -log4j.logger.DBusPlugin=ALL, DBusPluginLogFile - -# Log for HMI Framework plugin -log4j.logger.HmiFrameworkPlugin=ALL, HmiFrameworkPluginLogFile - -# Log by log4cxx plugin -log4j.logger.Log4cxxPlugin=ALL, HmiFrameworkPluginLogFile diff --git a/src/components/qt_hmi/qml_model_qt5/models/ApplicationData.qml b/src/components/qt_hmi/qml_model_qt5/models/ApplicationData.qml deleted file mode 100644 index ec40819040..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/ApplicationData.qml +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file ApplicationData.qml - * @brief Model for Application. - * 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. - */ - -import QtQuick 2.0 - -QtObject { - property string mainField1 - property string mainField2 - property string mainField3 - property string mainField4 - property string statusBar - property string mediaTrack - property string image: "" - property string secondaryImage: "" - - function reset () { - console.debug("enter") - mainField1 = "" - mainField2 = "" - mainField3 = "" - mainField4 = "" - statusBar = "" - mediaTrack = "" - image = "" - secondaryImage = "" - console.debug("exit") - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/ApplicationModel.qml b/src/components/qt_hmi/qml_model_qt5/models/ApplicationModel.qml deleted file mode 100644 index 5181e04a5b..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/ApplicationModel.qml +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file ApplicationModel.qml - * @brief Own fields for each application. - * 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. - */ - -import QtQuick 2.0 -import "../controls" - -QtObject { - property int appId - property string appName - property string ngnMediaScreenAppName - property Icon appIcon: Icon { } - property string deviceName - property int hmiDisplayLanguageDesired - property bool isMediaApplication - property int appType - property int hmiUITextAlignment - property string vrHelpTitle - property string vrHelpTitleDefault: "VR HELP" - property string vrHelpTitlePerformInteraction - property string menuTitle - property Icon menuIcon: Icon { } - - // media player - property string playPauseState - property ApplicationData hmiUIText: ApplicationData { } - property MediaClockModel mediaClock: MediaClockModel { } - property NavigationModel navigationModel: NavigationModel { } - - property string helpPrompt - property string timeoutPrompt - property ListModel vrHelpItems: ListModel { } - property ListModel vrHelpItemsDefault: VrHelpItemsDefault { } - property ListModel vrHelpItemsPerformInteraction: ListModel { } - property ListModel options: ListModel { } - property ListModel currentSubMenu: options - property ListModel turnList - property ListModel softButtons - property ListModel turnListSoftButtons - property ListModel navigationSoftButtons - property ListModel alertManeuverSoftButtons - property ListModel customPresets - property int languageTTSVR - property var allowedFunctions: [] - // This place is for adding new properties - - function reset () { - console.debug("enter") - appId = -1 - appName = "" - ngnMediaScreenAppName = "" - appIcon.reset() - deviceName = "" - hmiDisplayLanguageDesired = -1 - isMediaApplication = false - playPauseState = "" - hmiUIText.reset() -// no need to reset mediaClock - helpPrompt = "" - timeoutPrompt = "" - options.clear() - currentSubMenu = options - turnList.clear() - softButtons.clear() - navigationSoftButtons.clear() - alertManeuverSoftButtons.clear() - turnListSoftButtons.clear() - customPresets.clear() - languageTTSVR = -1 - hmiUITextAlignment = -1 - appType = 0 - allowedFunctions = [] - console.debug("exit") - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/CarMenuModel.qml b/src/components/qt_hmi/qml_model_qt5/models/CarMenuModel.qml deleted file mode 100644 index c715ae091f..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/CarMenuModel.qml +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file CarMenuModel.qml - * @brief Car menu list of elements. - * 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. - */ -import QtQuick 2.0 - -ListModel -{ - ListElement { - name: "ambient" - icon: "../res/vehicle/Ambient Lighti Icon.png" - qml: "" - } - ListElement { - name: "cal" - icon: "../res/vehicle/cal.png" - qml: "" - } - ListElement { - name: "ev" - icon: "../res/vehicle/EV Icon.png" - qml: "" - } - ListElement { - name: "folders" - icon: "../res/vehicle/folders.png" - qml: "" - } - ListElement { - name: "key" - icon: "../res/vehicle/key_car.png" - qml: "" - } - ListElement { - name: "mcs" - icon: "../res/vehicle/MCS Icon.png" - qml: "" - } - ListElement { - name: "sun" - icon: "../res/vehicle/sun.png" - qml: "" - } - ListElement { - name: "sync" - icon: "../res/vehicle/SYNC Services.png" - qml: "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/Constants.js b/src/components/qt_hmi/qml_model_qt5/models/Constants.js deleted file mode 100644 index 0b4a3191d7..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/Constants.js +++ /dev/null @@ -1,250 +0,0 @@ -/** - * @file Constants.js - * @brief Namespace of constants. - * 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. - */ -.pragma library - -// Colors - -// Main color of HMI model(now it ~lightblue). Buttons, text, icons of this color. -var primaryColor = "#1d81d5" - -// Color of pressed buttons, text, icons etc. -var primaryColorPressed = "#8ec0ea" - -// Secondary color of HMI model, backgroud of this color. -var secondaryColor = "black" - -// Color of text at buttonts that are inactive (at phone keyboard, when no any contact started with current letter). -var inactiveButtonTextColor = "grey" - -// Color of text at buttonts that are inactive but nevertheless pressed (at phone keyboard, when no any contact started with current letter). -var inactiveButtonTextColorPressed = "lightgrey" - -// Color of text at contact list screen view (Name, number and number type). -var contactTextColor = "lightblue" - -// Color of text at buttons, when they are pressed. -var pressedButtonTextColor = "black" - -// Color of text at "white" buttons, for all other buttons (which most) use primaryColor. -var releasedButtonTextColor = "white" - -// Transparent background. -var transparentColor = "#00000000" - -// "Warning" word color -var warningColor = "red" - -// Color for PopUp -var popUpBorderColor = "white" - -// Color for hardware and simulation panels -var panelColor = "#003" - -// Color for text in hardware and simulation panels -var panelTextColor = "white" - -// Audio pass thru PopUp text color -var audioPassThruTextColor = "white" - -// Semi transparent color of item in SDL Navi menu -var sdlNaviTransparentItemColor = "#30C0C0C0" - -//-------------------------------------------------------------------------------------- - -// Font sizes of different elements - -// Font size for most of text in HMI model. -var fontSize = 20 - -// Font size for text inside oval buttons. -var ovalButtonFontSize = 15 - -// Title font size -var titleFontSize = 35 - -// Power on/off button font size -var powerButtonFornSize = 25 - -// Font size of status bar -var statusBarFontSize = 15 - -// Size icon for buttons -var iconButtonSize = 30 - -// Size icon for item list -var iconItemListSize = 40 - -// font size fo TTS popup -var ttsFontSize = 12 - -// Font size for list of applications -var appListFontSize = 40 - -// Size of contact list fields -var contactListNameFieldSize = 0.4 -var contactListPhoneFieldSize = 0.3 -var contactListDescriptionFieldSize = 0.3 - -//-------------------------------------------------------------------------------------- - -// Sizes of buttons, menus, screen, etc - -// Minimal width and height of screen (screen wont resize, if height and width are lower). -var mainScreenMinWidth = 800 -var mainScreenMiHeight = 600 - -// Width for long oval button -var ovalButtonWidth = 163 - -// Height for oval button -var ovalButtonHeight = 65 - -// Height item list -var itemListHeight = 60 - -// Width for TTS popup -var ttsPopUpWidth = 250 - -// Height for TTS popup -var ttsPopUpHeight = 100 - -// Width for popup view -var popupWidth = 700 - -// Width for alert window -var alertWidth = 360 - -// Height for popup view -var popupHeigth = 500 - -// Width for combobox -var defaultComboboxWidth = 150 - -// Size icon for list of applications -var appListIconSize = 100 - -// DistanceBar height -var distanceBarHeight = 1 - - -//--------------------------------------------------------------------------------------- - -// Other - -// Offset from the edges of the screen. -var margin = 20 - -// Offset from the edges of the popup -var popupMargin = 15 - -// Spacing between items in SDLNavi view -var sdlNaviSpacing = 5 - -// Spacing between contacts at contact screen view. -var contactListSpacing = 30 - -// Duration of appearance of icon/button at icon/button menus. -var animationDuration = 500 - -// Duration of appearence of "OK" button at warning screen view, when HMI starts. -var warningScreenDuration = 1000 - -// Timer to check how long preset button is pressed. -var presetButtonTimer = 800 - -// Timer to check got long custom button is pressed. -var customButtonTimer = 2000 - -// Spacing between icon and item in list -var iconItemListSpacing = 20 - -// Spacing between item on views -var generalSpacing = 10 - -// Width of scrollBar -var scrollBarWidth = 5 - -// Speak text for a given time -var ttsSpeakTime = 2000 - -// Maximal number of submenus -var maximumSubmenus = 1000 - -// Maximal number of commands in submenu or root menu -var maximumCommandsPerSubmenu = 1000 - -// padding for popup view -var popUpPadding = 20 - -// Padding for TTS popup -var ttsPopUpPadding = 10 - -// ------------------------- -var sliderBarWidth = 400 -var sliderBarHeight = 50 -var sliderBarRadius = 3 -var sliderBarBorderWidth = 1 -var sliderTextColor = "white" -var sliderBarBorderColor = "white" -var sliderBarFillColor = "white" - -// ------------------------- -var scrollableMessageTextColor = "white" -var scrollableMessageScrollBarColor = "gray" -var scrollableMessageScrollBarWidth = 10 - -// Padding for hardware and simulation panels -var panelPadding = 20 - -// Scale for pressed icon in menu -var pressedIconScale = 1.1 - -// Values of color effect for highlighted button -var highlightedButtonHue = 0.9 -var highlightedButtonSaturation = 0.0 -var highlightedButtonLightness = 0.1 - -// Values of color effect for disabled button -var disabledButtonHue = 0.0 -var disabledButtonSaturation = -1.0 -var disabledButtonLightness = 0.1 - -// Count of rows for grid menu -var menuRowCount = 2 - -// Count of columns for grid menu -var menuColumnCount = 3 - -// Position for element that came without position value (should be always at the end) -var positionOfElementWithoutPosition = 1001 diff --git a/src/components/qt_hmi/qml_model_qt5/models/ContactsListModel.qml b/src/components/qt_hmi/qml_model_qt5/models/ContactsListModel.qml deleted file mode 100644 index 7e9326e9d8..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/ContactsListModel.qml +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @file ContactsListModel.qml - * @brief List of contacts. - * 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. - */ -import QtQuick 2.0 - -ListModel -{ - // TODO {ALeshin}: This list model should be sorted in ABC and Upper/lower case order, - // when it will be filled dynamically. - ListElement { name: "Aaron" ; phone:"(614)555-2444";type:"Mobile"} - ListElement { name: "Adrian" ; phone:"(740)245-3434";type:"Mobile" } - ListElement { name: "Albert" ; phone:"(614)245-5584";type:"Mobile" } - ListElement { name: "Alice" ; phone:"(313)878-3566";type:"Office"} - ListElement { name: "Alec" ; phone:"(917)608-2418";type:"Mobile"} - ListElement { name: "Alexander" ; phone:"(614)608-2400";type:"Home"} - ListElement { name: "Alexander Vasil'evich Michail Leontiy" ; phone:"(614)608-2400";type:"Mobile"} - ListElement { name: "Amber" ; phone:"(614)608-2111";type:"Mobile"} - ListElement { name: "Amy" ; phone:"(440)245-3434";type:"Mobile" } - ListElement { name: "Andy" ; phone:"(313)245-3434";type:"Mobile" } - ListElement { name: "Antje" ; phone:"(567)245-3434";type:"Home" } - ListElement { name: "buddy" ; phone:"(614)813-6610";type:"Mobile" } - ListElement { name: "Barry" ; phone:"(313)555-2211";type:"Mobile" } - ListElement { name: "Bea" ; phone:"(614)455-3434";type:"Mobile" } - ListElement { name: "Ben" ; phone:"(614)882-1843";type:"Office" } - ListElement { name: "Blake" ; phone:"(330)149-7778";type:"Mobile" } - ListElement { name: "Bob Mould" ; phone:"(313)245-3434";type:"Mobile" } - ListElement { name: "Brian" ; phone:"(614)332-7499";type:"Mobile" } - ListElement { name: "Calvin" ; phone:"(614)442-9974";type:"Mobile" } - ListElement { name: "Carl" ; phone:"(567)773-3434";type:"Home" } - ListElement { name: "Cat Power" ; phone:"(313)608-3434";type:"Home"} - ListElement { name: "Cathy" ; phone:"(313)444-456";type:"Home"} - ListElement { name: "Chris" ; phone:"(734)997-6514";type:"Home" } - ListElement { name: "Cloud Nothings"; phone:"(444)608-543";type:"Mobile"} - ListElement { name: "Cody" ; phone:"(567)365-8413";type:"Home" } - ListElement { name: "Curtis" ; phone:"(614)245-1547";type:"Office" } - ListElement { name: "Dakota" ; phone:"(567)555-4444";type:"Home" } - ListElement { name: "Dale" ; phone:"(567)723-1974";type:"Mobile" } - ListElement { name: "Dallas"; phone:"(614)556-879";type:"Home"} - ListElement { name: "Damian" ; phone:"(614)245-3434";type:"Office" } - ListElement { name: "Daniel"; phone:"(614)556-879";type:"Home"} - ListElement { name: "Darina"; phone:"(313)895-888";type:"Mobile"} - ListElement { name: "Dee "; phone:"(313)432-3434";type:"Home"} -// ListElement { name: "Edward" ; phone:"(917)608-975";type:"Office"} - ListElement { name: "Ferdinand" ; phone:"(917)879-795";type:"Mobile"} - ListElement { name: "gomez" ; phone:"(313)455-543";type:"Mobile"} - ListElement { name: "Harry Potter"; phone:"(313)888-432";type:"Home"} - ListElement { name: "Ivan"; phone:"(313)996-225";type:"Home"} -// ListElement { name: "James" ; phone:"(917)608-3434";type:"Mobile"} - ListElement { name: "Karen"; phone:"(313)998-332";type:"Home"} - ListElement { name: "Luis Torres"; phone:"(313)779-111";type:"Home"} - ListElement { name: "Mary"; phone:"(313)234-098";type:"Mobile"} - ListElement { name: "Neil"; phone:"(313)444-112";type:"Mobile"} - ListElement { name: "Oswald"; phone:"(313)456-921";type:"Mobile"} - ListElement { name: "Oscar"; phone:"(313)332-778";type:"Home"} - ListElement { name: "~1123"; phone:"(313)1332";type:"Home"} - ListElement { name: "Patrice"; phone:"(313)789-111";type:"Mobile"} - ListElement { name: "Queen Elizabeth"; phone:"(313)897-666";type:"Mobile"} - ListElement { name: "Rose"; phone:"(313)111-211";type:"Mobile"} - ListElement { name: "Susell"; phone:"(313)345-122";type:"Home"} - ListElement { name: "Thomas"; phone:"(917)608-342";type:"Mobile"} - ListElement { name: "Titus Andronicus" ; phone:"(917)608-321";type:"Office"} - ListElement { name: "Toretto" ; phone:"(917)608-3434";type:"Home"} - ListElement { name: "Uhl" ; phone:"(313)444-654";type:"Office"} - ListElement { name: "willi" ; phone:"(313)224-5712";type:"Office"} - ListElement { name: "Wanda" ; phone:"(313)666-6969";type:"Office"} - ListElement { name: "wanda" ; phone:"(313)666-6969";type:"Office"} - ListElement { name: "Zara" ; phone:"(313)231-009";type:"Mobile"} -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/DataStorage.qml b/src/components/qt_hmi/qml_model_qt5/models/DataStorage.qml deleted file mode 100644 index e3785bdf19..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/DataStorage.qml +++ /dev/null @@ -1,660 +0,0 @@ -/** - * @file DataStorage.qml - * @brief Container for data. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common -import "Internal.js" as Internal -import "Constants.js" as Constants - -QtObject { - property string contactsFirstLetter // first letter of contact's name that need to find at contact list - property ApplicationModel currentApplication: ApplicationModel { } - property SliderModel uiSlider: SliderModel { } - property PerformAudioPassThruModel uiAudioPassThru: PerformAudioPassThruModel { } - property ScrollableMessageModel scrollableMessageModel: ScrollableMessageModel { } - - function getApplication(appId) { - console.log("enter"); - for(var i = 0; i < applicationList.count; i++) { - if(applicationList.get(i).appId === appId) { - console.log("Application found", applicationList.get(i)); - return applicationList.get(i); - } - } - console.log("exit"); - } - - function getStashedApplication(appId) { - console.log("enter getStashedApplication function"); - for(var i = 0; i < stashedApplicationsList.count; i++) { - if(stashedApplicationsList.get(i).appId === appId) { - console.log("Application found", stashedApplicationsList.get(i)); - return stashedApplicationsList.get(i); - } - } - console.log("exit getStashedApplication: application was not found"); - } - - onApplicationListChanged: { - console.log("onApplicationListChanged()"); - setCurrentApplication(appId); - } - - function setCurrentApplication(appId) { - console.log("Enter setCurrentApplication function"); - var oldApplicationContext = applicationContext; - if (currentApplication.appId !== appId) { - applicationContext = false; - } - - for(var i = 0; i < applicationList.count; i++) { - if(applicationList.get(i).appId === appId) { - currentApplication.appId = appId - var application = applicationList.get(i) - - currentApplication.appName = application.appName - currentApplication.appType = application.appType - currentApplication.appIcon.source = application.icon - currentApplication.playPauseState = application.playPauseState - currentApplication.options = application.options - currentApplication.softButtons = application.softButtons - currentApplication.navigationSoftButtons = application.navigationSoftButtons - currentApplication.alertManeuverSoftButtons = application.alertManeuverSoftButtons - currentApplication.customPresets = application.customPresets - - if (application.navigationModel.text1 !== undefined) { - currentApplication.navigationModel.text1 = application.navigationModel.text1 - } - if (application.navigationModel.text2 !== undefined) { - currentApplication.navigationModel.text2 = application.navigationModel.text2 - } - if (application.navigationModel.totalDistance !== undefined) { - currentApplication.navigationModel.totalDistance = application.navigationModel.totalDistance - } - if (application.navigationModel.eta !== undefined) { - currentApplication.navigationModel.eta = application.navigationModel.eta - } - if (application.navigationModel.timeToDestination !== undefined) { - currentApplication.navigationModel.timeToDestination = application.navigationModel.timeToDestination - } - if (application.navigationModel.turnIcon !== undefined) { - currentApplication.navigationModel.turnIcon = application.navigationModel.turnIcon - } - if (application.navigationModel.nextTurnIcon !== undefined) { - currentApplication.navigationModel.nextTurnIcon = application.navigationModel.nextTurnIcon - } - if (application.navigationModel.distanceToManeuver !== undefined) { - currentApplication.navigationModel.distanceToManeuver = application.navigationModel.distanceToManeuver - } - if (application.navigationModel.distanceToManeuverScale !== undefined) { - currentApplication.navigationModel.distanceToManeuverScale = application.navigationModel.distanceToManeuverScale - } - if (application.navigationModel.maneuverComplete !== undefined) { - currentApplication.navigationModel.maneuverComplete = application.navigationModel.maneuverComplete - } - if (application.navigationModel.appID !== undefined) { - currentApplication.navigationModel.appID = application.navigationModel.appID - } - if (application.hmiUIText.mainField1 !== undefined) { - currentApplication.hmiUIText.mainField1 = application.hmiUIText.mainField1 - } - if (application.hmiUIText.mainField2 !== undefined) { - currentApplication.hmiUIText.mainField2 = application.hmiUIText.mainField2 - } - if (application.hmiUIText.mainField3 !== undefined) { - currentApplication.hmiUIText.mainField3 = application.hmiUIText.mainField3 - } - if (application.hmiUIText.mainField4 !== undefined) { - currentApplication.hmiUIText.mainField4 = application.hmiUIText.mainField4 - } - if (application.hmiUIText.statusBar !== undefined) { - currentApplication.hmiUIText.statusBar = application.hmiUIText.statusBar - } - if (application.hmiUIText.mediaTrack !== undefined) { - currentApplication.hmiUIText.mediaTrack = application.hmiUIText.mediaTrack - } - if (application.hmiUIText.image !== undefined) { - currentApplication.hmiUIText.image = application.hmiUIText.image - } - if (application.hmiUIText.secondaryImage!== undefined) { - currentApplication.hmiUIText.secondaryImage= application.hmiUIText.secondaryImage - } - if (application.hmiUITextAlignment !== undefined) { - currentApplication.hmiUITextAlignment = application.hmiUITextAlignment - } - if (application.helpPrompt !== undefined) { - currentApplication.helpPrompt = application.helpPrompt - } - if (application.timeoutPrompt !== undefined) { - currentApplication.timeoutPrompt = application.timeoutPrompt - } - if (application.mediaClock.startTime !== undefined) { - currentApplication.mediaClock.startTime = application.mediaClock.startTime - } - if (application.mediaClock.endTime !== undefined) { - currentApplication.mediaClock.endTime = application.mediaClock.endTime - } - // Check fields with mandatory = false - - if (application.menuIcon !== undefined) { - currentApplication.menuIcon.source = application.menuIcon - } - currentApplication.vrHelpTitle = application.vrHelpTitle - currentApplication.vrHelpTitleDefault = application.vrHelpTitleDefault - currentApplication.vrHelpTitlePerformInteraction = application.vrHelpTitlePerformInteraction - currentApplication.menuTitle = application.menuTitle - currentApplication.vrHelpItems = application.vrHelpItems - currentApplication.vrHelpItemsPerformInteraction = application.vrHelpItemsPerformInteraction - currentApplication.deviceName = application.deviceName - currentApplication.isMediaApplication = application.isMediaApplication - currentApplication.turnList = application.turnList - currentApplication.turnListSoftButtons = application.turnListSoftButtons - currentApplication.mediaClock.updateMode = application.mediaClock.updateMode - currentApplication.mediaClock.runningMode = application.mediaClock.runningMode - if (application.mediaClock.startTimeForProgress !== undefined) { - currentApplication.mediaClock.startTimeForProgress = application.mediaClock.startTimeForProgress - } - currentApplication.languageTTSVR = application.languageTTSVR - currentApplication.hmiDisplayLanguageDesired = application.hmiDisplayLanguageDesired - currentApplication.allowedFunctions = application.allowedFunctions - // This place is for adding new properties - } - } - applicationContext = oldApplicationContext; - currentApplicationChanged() - console.log("Exit setCurrentApplication function") - } - - function addApplication(app) { - console.log("enter") - applicationList.append({ - appName: app.appName, - ngnMediaScreenAppName: app.ngnMediaScreenAppName, - icon: app.icon, - menuIcon: { - value: "", - imageType: 1 - }, - deviceName: app.deviceName, - appId: app.appId, - hmiDisplayLanguageDesired: app.hmiDisplayLanguageDesired, - isMediaApplication: app.isMediaApplication, - appType: app.appType, - helpPrompt: "", - timeoutPrompt: "", - customPresets: app.customPresets ? app.customPresets : [], - playPauseState: 'Pause', - hmiUIText: app.hmiUIText, - hmiUITextAlignment: app.hmiUITextAlignment, - options: [], - turnList: [], - turnListSoftButtons: [], - mediaClock: app.mediaClock, - languageTTSVR: Common.Language.EN_US, - softButtons: [], - vrHelpTitle: "", - vrHelpTitlePerformInteraction: "", - vrHelpTitleDefault: "VR HELP", - menuTitle: "", - keyboardProperties: [], - vrHelpItems: [], - vrHelpItemsPerformInteraction: [], - vrHelpItemsDefault: { - text: "VrHelpItems - defaultText1", - image: "", - position: 1 - }, - navigationSoftButtons: [], - alertManeuverSoftButtons: [], - navigationModel: { - appID: -1, - text1: "", - text2: "", - totalDistance: "", - eta: "", - timeToDestination: "", - turnIcon: { - value: "", - imageType: -1 - }, - nextTurnIcon: { - value: "", - imageType: -1 - }, - distanceToManeuver: 0, - distanceToManeuverScale: 0, - maneuverComplete: false - }, - allowedFunctions: [] - // This place is for adding new properties - }) - if (app.isMediaApplication) { - musicSourceModel.insert(0, { - "title": app.appName, - "qml": "views/SDLPlayerView.qml", - "appId": app.appId - }) - } - - console.log("exit") - } - - function setApplicationProperties(appId, props) { - console.log("Enter setApplicationProperties function"); - - var app = getApplication(appId) - for (var p in props) { - console.debug(p) - if (props[p] !== undefined) { - app[p] = props[p] - } - } - if (currentApplication.appId === appId) { - setCurrentApplication(appId); // copy new values to current application - } - console.log("Exit setApplicationProperties function"); - } - - function removeApplication(appId) { - console.log("enter removeApplication"); - for (var j = 0; j < musicSourceModel.count; ++j) { - if (musicSourceModel.get(j).appId === appId) { - musicSourceModel.remove(j); - break; - } - } - for (var i = 0; i < applicationList.count; i++) { - if (applicationList.get(i).appId === appId) { - applicationList.remove(i); - break; - } - } - console.log("exit removeApplication"); - } - - function stashApplication(appId) { - console.log("stashApplication enter"); - stashedApplicationsList.append(getApplication(appId)) - console.log("stashApplication exit"); - } - - function getResumeResult (appID) { - - if (getStashedApplication(appId) && getApplication(appID)) { - var stashedApp = getStashedApplication(appId), - app = getApplication(appID); - if (stashedApp.options.count == app.options.count) { - for (var optionIndex = 0; optionIndex < stashedApp.options.count; ++optionIndex) { - if (app.options.get(optionIndex).type === Internal.MenuItemType.MI_SUBMENU) { - //comparison subMenu compare - - if ( !((app.options.get(optionIndex).id === stashedApp.options.get(optionIndex).id) && - (app.options.get(optionIndex).name === stashedApp.options.get(optionIndex).name) && - (app.options.get(optionIndex).position === stashedApp.options.get(optionIndex).position) && - (app.options.get(optionIndex).icon === stashedApp.options.get(optionIndex).icon))) { - return { - result: false - } - } - - var stashedAppSubMenu = stashedApp.options.get(optionIndex).subMenu, - appSubMenuArray = app.options.get(optionIndex).subMenu; - - if (stashedAppSubMenu.length != appSubMenuArray.length) { - return { - result: false - } - } - - for (var subMenuIndex = 0; subMenuIndex < stashedAppSubMenu.length; subMenuIndex++) { - if ( !((appSubMenuArray[subMenuIndex].id === stashedAppSubMenu[subMenuIndex].id) && - (appSubMenuArray[subMenuIndex].name === stashedAppSubMenu[subMenuIndex].name) && - (appSubMenuArray[subMenuIndex].position === stashedAppSubMenu[subMenuIndex].position) && - (appSubMenuArray[subMenuIndex].icon === stashedAppSubMenu[subMenuIndex].icon) - )) { - return { - result: false - } - } - } - } else { - //comparison Command compare - if ( !((app.options.get(optionIndex).id === stashedApp.options.get(optionIndex).id) && - (app.options.get(optionIndex).name === stashedApp.options.get(optionIndex).name) && - (app.options.get(optionIndex).position === stashedApp.options.get(optionIndex).position) && - (app.options.get(optionIndex).icon === stashedApp.options.get(optionIndex).icon) - )) { - return { - result: false - } - } - } - } - // if all commands and subMenus were same - // rerturn SUCCESS result - return { - result: true - } - } - } - - return { - result: false - } - } - - property int systemContext - property int hmiContext - property bool applicationContext: false - property bool applicationSavedContext - property string routeText: "" - property PlayerState cdPlayerState: PlayerState { - playPauseState: 'Pause' - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - } - property PlayerState ipodPlayerState: PlayerState { - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - playPauseState: 'Pause' - } - property PlayerState usbPlayerState: PlayerState { - playPauseState: 'Pause' - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - } - property PlayerState linePlayerState: PlayerState { - playPauseState: 'Pause' - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - } - property PlayerState btPlayerState: PlayerState { - playPauseState: 'Pause' - albumImage: "../res/album_art.png" - trackNumber: "13/16" - trackName: "The Dog Days Are Over" - albumName: "Florence and the Machine" - } - property PlayerState amPlayerState: PlayerState { - songName: "So Far Around The Bend" - albumName: "The National" - presets: [ "1130", "950", "760", "1270", "1400", "2100", "940", "1001" ] - } - property PlayerState fmPlayerState: PlayerState { - songName: "So Far Around The Bend" - albumName: "The National" - presets: ["96.3", "107.9", "104.3", "101.9", "105.3", "100.5", "107.9", "103.4"] - } - property PlayerState siriusPlayerState: PlayerState { - songName: "So Far Around The Bend" - albumName: "The National" - presets: [ "Lithium", "Spectrum", "ESPN", "Alt Nation", "Lithium", "Spectrum", "ESPN", "Alt Nation" ] - } - - property bool hmiVRAvailable: false - property bool hmiTTSAvailable: false - property bool hmiNavigationAvailable: false - property bool hmiVehicleInfoAvailable: false - property bool hmiUIAvailable: false - - property int hmiUILanguage: Common.Language.EN_US - property int hmiTTSVRLanguage: Common.Language.EN_US - - property ListModel deviceList: ListModel { } - property ListModel applicationList: ListModel { } - property ListModel stashedApplicationsList: ListModel { } - property ListModel vrCommands: ListModel { } - property ListModel choicesVrCommands: ListModel { } - - function reset () { - console.log("dataContainer reset enter"); - routeText = "" - console.log("dataContainer reset exit"); - } - - function changeRegistrationUI (language, appID) { - console.log("dataContainer changeRegistrarionUI enter"); - setApplicationProperties(appID, { hmiDisplayLanguageDesired: language }); - console.log("dataContainer changeRegistrarionUI exit"); - } - - function changeRegistrationTTSVR(language, appID) { - console.log("dataContainer changeRegistrationTTSVR enter"); - setApplicationProperties(appID, { languageTTSVR: language }); - console.log("dataContainer changeRegistrationTTSVR exit"); - } - - function addCommand (cmdID, menuParams, cmdIcon, appID) { - console.debug("enter: " + - cmdID + - ", " + - (menuParams ? - "{" + menuParams.parentID + ", " + menuParams.position + ", " + menuParams.menuName + "}" : menuParams) + - ", " + - (cmdIcon ? - "{" + cmdIcon.value + ", " + cmdIcon.imageType + "}" : cmdIcon) + - ", " + - appID - ) - var commandToAddPosition - var app = getApplication(appID) - var currentMenu = app.options - var maximumCommands = Constants.maximumCommandsPerSubmenu - var index = 0 - - if ((menuParams) && (menuParams.parentID)) { // Work with sub menu - var parentNotFound = true - for (var optionIndex = 0; optionIndex < app.options.count; ++optionIndex) { - if ((app.options.get(optionIndex).type === Internal.MenuItemType.MI_SUBMENU) && (app.options.get(optionIndex).id === menuParams.parentID)) { - currentMenu = app.options.get(optionIndex).subMenu - parentNotFound = false - maximumCommands += 1 - } - } - if (parentNotFound) { - console.log("UI::addCommand(): parentID " + menuParams.parentID + " not found") - } - } - - if (currentMenu.count < maximumCommands) { - if (menuParams && (menuParams.position !== undefined)) { - commandToAddPosition = menuParams.position - } else { - commandToAddPosition = Constants.positionOfElementWithoutPosition - } - for (var i = 0; i < currentMenu.count; i++) { - if (commandToAddPosition >= currentMenu.get(i).position) { - index = i + 1 - } else { - break - } - } - currentMenu.insert( index, - { id: cmdID, - name: menuParams.menuName, - type: Internal.MenuItemType.MI_NODE, - position: commandToAddPosition, - icon: cmdIcon ? cmdIcon : {}, - subMenu: [] - }) - } else { - console.log("addCommand(): too many commands in menu: ", menuParams.parentID, " rejecting") - throw Common.Result.REJECTED - } - console.debug("exit") - } - - function deleteCommand (cmdID, appID) { - console.debug("enter: " + cmdID + ", " + appID) - for (var optionIndex = 0; optionIndex < getApplication(appID).options.count; ++optionIndex) { - var option = getApplication(appID).options.get(optionIndex) - if (option.type === Internal.MenuItemType.MI_NODE) { - if (option.id === cmdID) { - getApplication(appID).options.remove(optionIndex) - break - } - } - if (option.type === Internal.MenuItemType.MI_SUBMENU) { - var subMenu = option.subMenu - var idMatchFound = false - for (var subOptionIndex = 0; subOptionIndex < subMenu.count; ++subOptionIndex) { - if (subMenu.get(subOptionIndex).id === cmdID) { - idMatchFound = true - if (subMenu !== currentApplication.currentSubMenu) { - subMenu.remove(subOptionIndex) - } - else { - console.log("UI::deleteCommand(): cannot remove item from current submenu") - throw Common.Result.IN_USE - } - break - } - } - if (idMatchFound) { - break - } - } - } - console.debug("exit") - } - - function addSubMenu (menuID, menuParams, appID) { - console.debug("enter: " + menuID + ", {" + menuParams.parentID + ", " + menuParams.position + ", " + menuParams.menuName + "}, " + appID) - var app = getApplication(appID) - var index = 0 - var count = app.options.count - var subMenuToAddPosition - - if (count < Constants.maximumSubmenus) { - if (menuParams.position !== undefined) { - subMenuToAddPosition = menuParams.position - } else { - subMenuToAddPosition = Constants.positionOfElementWithoutPosition - } - for (var i = 0; i < count; i++) { - if (subMenuToAddPosition >= app.options.get(i).position) { - index = i + 1 - } else { - break - } - } - app.options.insert(index, { - "id": menuID, - "name": menuParams.menuName, - "position": subMenuToAddPosition, - "type": Internal.MenuItemType.MI_SUBMENU, - "icon": undefined, - "subMenu": [{ - "id": -1, - "name": menuParams.menuName, - "position": -1, - "type": Internal.MenuItemType.MI_PARENT, - "icon": { - "imageType": Common.ImageType.DYNAMIC, - "value": "../res/nav/turnArrow.png" - }, - "subMenu": getApplication(appID).options - }] - }) - } - else { - console.log("addSubMenu(): too many submenus, rejecting") - throw Common.Result.REJECTED - } - console.debug("exit") - } - - function deleteSubMenu (menuID, appID) { - console.debug("enter: " + menuID + ", " + appID) - for (var optionIndex = 0; optionIndex < getApplication(appID).options.count; ++optionIndex) { - var option = getApplication(appID).options.get(optionIndex) - if ((option.type === Internal.MenuItemType.MI_SUBMENU) && (option.id === menuID)) { - if (option.subMenu !== currentApplication.currentSubMenu) { - getApplication(appID).options.remove(optionIndex) - } - else { - console.log("UI::deleteSubMenu(): cannot remove current submenu") - throw Common.Result.IN_USE - } - break - } - } - console.debug("exit") - } - property VehicleInfoModel vehicleInfoModel: VehicleInfoModel { } - property bool activeVR: false - property int driverDistractionState: Common.DriverDistractionState.DD_OFF - onDriverDistractionStateChanged: { - sdlUI.onDriverDistraction(driverDistractionState); - } - property bool activeTTS: false - property var activePopup: [] // Stack of names of active pop ups - property int popups: 0 - - property bool activeAlert: false - - onActiveVRChanged: setSystemContext() - onActiveAlertChanged: setSystemContext() - onPopupsChanged: setSystemContext() - - function setSystemContext () { - console.debug("enter") - if (popups > 0) { - systemContext = Common.SystemContext.SYSCTXT_HMI_OBSCURED - } - else if (activeAlert) { - systemContext = Common.SystemContext.SYSCTXT_ALERT - } - else if (activeVR) { - systemContext = Common.SystemContext.SYSCTXT_VRSESSION - } - else if (contentLoader.item !== null) { - systemContext = contentLoader.item.systemContext - } - console.debug("exit") - } - property MusicSourceModel musicSourceModel: MusicSourceModel { - } - - property SettingsSourceModel settingsSourceModel: SettingsSourceModel { - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/Internal.js b/src/components/qt_hmi/qml_model_qt5/models/Internal.js deleted file mode 100644 index 53d7640136..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/Internal.js +++ /dev/null @@ -1,176 +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. - */ - -.pragma library -.import "../hmi_api/Common.js" as Common - -var MenuItemType = { - MI_NODE: 0, - MI_SUBMENU: 1, - MI_PARENT: 2 -} - -function activePageChoose(flickElement, pages) { - if (flickElement.contentX <= 0) { - return 0 - } - else if ( (flickElement.contentWidth - flickElement.contentX) < flickElement.width) { - return pages -1 - } - else { - if ( (flickElement.contentX % flickElement.width) >= (1/6 * flickElement.width)) { - return Math.ceil(flickElement.contentX / flickElement.width) - } - else if ( (flickElement.contentX % flickElement.width) > 0) { - return Math.floor(flickElement.contentX / flickElement.width) - } - } -} - -var MediaClockUpdateMode = { - MCU_COUNTUP: 0, - MCU_COUNTDOWN: 1, -} - -var MediaClockRunningMode = { - MCR_RUNNING: 0, - MCR_STOPPED: 1 -} - -function chooseAppStartScreen(appType, isMediaApplication) { - if (checkBit(appType, Common.AppHMIType.NAVIGATION)) { - return "./views/SDLNavi.qml" - } else if (isMediaApplication) { - return "./views/SDLPlayerView.qml" - } else { - return "./views/SDLNonMediaView.qml" - } -} - -function appendVrHelpItem (arrayElement, index, array) { - this.append({ - text: arrayElement.text, - image: arrayElement.image ? arrayElement.image : "", - position: arrayElement.position - }) -} - -function checkBit(value, bitPosition) { - return (value & (1 << bitPosition)) -} - -function getArrayForPresetRow(app) { - var array = [] - for (var i = 0; i < app.customPresets.count; i++) { - array.push(app.customPresets.get(i).text) - } - return array -} - -function pad (string, length, lead) { - if (!lead) { - lead = '0' - } - var paddedString = "" + string - while (paddedString.length < length) { - paddedString = lead + paddedString - } - return paddedString -} - -function hmsTime (hours, minutes, seconds) { - return 60 * (60 * hours + minutes) + seconds -} - -function hmsTimeToString (hmsTime) { - if (hmsTime === -1) { - return "0:00:00" - } - - var _time = hmsTime - var seconds = _time % 60 - _time -= seconds - _time /= 60 - var minutes = _time % 60 - _time -= minutes - _time /= 60 - var hours = _time - var string = "" - string += hours - string += ":" - string += pad(minutes, 2) - string += ":" - string += pad(seconds, 2) - return string -} - -function stringToHmsTime (hmsString) { - console.debug("enter: \"" + hmsString + "\"") - var substrings = hmsString.split(":") - var seconds = substrings.length > 0 ? parseInt(substrings.pop()) : 0 - if (seconds >= 60) { - console.log("incorrect field \"seconds\": " + seconds) - console.debug("exit") - return 0 - } - var minutes = substrings.length > 0 ? parseInt(substrings.pop()) : 0 - if (minutes >= 60) { - console.log("incorrect field \"minutes\": " + minutes) - console.debug("exit") - return 0 - } - var hours = substrings.length > 0 ? parseInt(substrings.pop()) : 0 - console.debug("exit") - return hmsTime(hours, minutes, seconds) -} - -function mediaClockUpdateModeToString (mediaClockUpdateMode) { - switch (mediaClockUpdateMode) { - case MediaClockUpdateMode.MCU_COUNTUP: - return "Internal.MediaClockUpdateMode.MCU_COUNTUP" - case MediaClockUpdateMode.MCU_COUNTDOWN: - return "Internal.MediaClockUpdateMode.MCU_COUNTDOWN" - default: - return "" - } -} - -function mediaClockRunningModeToString (mediaClockRunningMode) { - switch (mediaClockRunningMode) { - case MediaClockRunningMode.MCR_RUNNING: - return "Internal.MediaClockRunningMode.MCR_RUNNING" - case MediaClockRunningMode.MCR_STOPPED: - return "Internal.MediaClockRunningMode.MCR_STOPPED" - default: - return "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/MainMenuListModel.qml b/src/components/qt_hmi/qml_model_qt5/models/MainMenuListModel.qml deleted file mode 100644 index a2f659c393..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/MainMenuListModel.qml +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file MainMenuListModel.qml - * @brief Main menu list of elements. - * 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. - */ -import QtQuick 2.0 - -ListModel -{ - ListElement { - name: "Climate" - icon: "../res/snow.png" - qml: "./views/ClimateControlView.qml" - } - - ListElement { - name: "Navigation" - icon: "../res/arrow.png" - qml: "./views/NavigationNoRouteGridView.qml" - } - - ListElement { - name: "Media" - icon: "../res/notes.png" - qml: "./views/MusicSourceView.qml" - } - - ListElement { - name: "Settings" - icon: "../res/gear.png" - qml: "./views/SettingsSourceView.qml" - } - - ListElement { - name: "Apps" - icon: "../res/apps.png" - qml: "./views/ApplicationListView.qml" - } - - ListElement { - name: "Phone" - icon: "../res/phone/phone.png" - qml: "./views/PhoneMenuGridView.qml" - } - - ListElement { - name: "Car" - icon: "../res/car.png" - qml: "./views/CarMenuGridView.qml" - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml b/src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml deleted file mode 100644 index 3712ca4c31..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/MediaClockModel.qml +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @file MediaClockModel.qml - * @brief Media clock model - * 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. - */ - -import QtQuick 2.0 -import "Internal.js" as Internal - -QtObject { - property int updateMode - property int runningMode - property int startTime - property int endTime - property int upperTimeLimit: 60 * 60 * 60 - 1 - property int startTimeForProgress - property real progress - - property Timer timer: Timer { - id: timer - interval: 1000 - repeat: true - onTriggered: onTimer() - } - onRunningModeChanged: { - if (runningMode === Internal.MediaClockRunningMode.MCR_STOPPED) { - timer.stop() - } else { - timer.start() - } - } - - onStartTimeChanged: { - onProgress() - } - - onEndTimeChanged: { - onProgress() - } - - onStartTimeForProgressChanged: { - onProgress() - } - - function onTimer () { - switch (updateMode) { - case Internal.MediaClockUpdateMode.MCU_COUNTUP: - console.debug("count up") - if (startTime < endTime) { - startTime++ - } else { - timer.stop() - runningMode = Internal.MediaClockRunningMode.MCR_STOPPED - console.debug("count Up timer stopped") - } - break - case Internal.MediaClockUpdateMode.MCU_COUNTDOWN: - console.debug("count down") - if (startTime > endTime) { - startTime-- - } else { - timer.stop() - runningMode = Internal.MediaClockRunningMode.MCR_STOPPED - console.debug("count Down timer stopped") - } - break - } - dataContainer.setApplicationProperties(dataContainer.currentApplication.appId, { - "mediaClock": {startTime: startTime, - endTime: endTime, - updateMode: updateMode, - runningMode: runningMode, - startTimeForProgress: startTimeForProgress - } - }) - } - - function onProgress () { - if (startTime === -1) { - progress = 0 - } - else if (endTime != -1 && endTime === startTimeForProgress) { - progress = 1 - } - else { - progress = (startTime - startTimeForProgress) / (endTime - startTimeForProgress) - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/MusicSourceModel.qml b/src/components/qt_hmi/qml_model_qt5/models/MusicSourceModel.qml deleted file mode 100644 index 7497d987d4..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/MusicSourceModel.qml +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file MusicSourceModel.qml - * @brief Music source menu list of elements. - * 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. - */ -import QtQuick 2.0 - -ListModel -{ - ListElement { - title: "FM" - qml: "./views/FMPlayerView.qml" - appId: 0 - } - ListElement { - title: "AM" - qml: "./views/AMPlayerView.qml" - appId: 0 - } - ListElement { - title: "BT Audio" - qml: "./views/BTPlayerView.qml" - appId: 0 - } - ListElement { - title: "Sirius" - qml: "./views/SiriusPlayerView.qml" - appId: 0 - } - ListElement { - title: "CD" - qml: "./views/CDPlayerView.qml" - appId: 0 - } - ListElement { - title: "iPod" - qml: "./views/IPodPlayerView.qml" - appId: 0 - } - ListElement { - title: "USB" - qml: "./views/UsbPlayerView.qml" - appId: 0 - } - ListElement { - title: "LineIn" - qml: "./views/LineInPlayerView.qml" - appId: 0 - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/NavigationMenuModel.qml b/src/components/qt_hmi/qml_model_qt5/models/NavigationMenuModel.qml deleted file mode 100644 index 6e434495a6..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/NavigationMenuModel.qml +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file NavigationMenuModel.qml - * @brief Model for navigation menu. - * 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. - */ - -import QtQuick 2.0 - -ListModel -{ - ListElement { - title: "Home" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Keyboard" - icon: "../res/buttons/long_oval_btn.png" - qml: "./views/NavigationKeyboardView.qml" - } - ListElement { - title: "Favorites" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Work" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Recent" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "POI" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Scout" - icon: "../res/buttons/long_oval_btn.png" - } - ListElement { - title: "Waze" - icon: "../res/buttons/long_oval_btn.png" - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/NavigationModel.qml b/src/components/qt_hmi/qml_model_qt5/models/NavigationModel.qml deleted file mode 100644 index 0abbe6b309..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/NavigationModel.qml +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file NavigationModel.qml - * @brief Model for Navigation. - * 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. - */ - -import QtQuick 2.0 - -QtObject { - property string text1: "" - property string text2: "" - property string totalDistance: "" - property string eta: "" - property string timeToDestination: "" - property var turnIcon - property var nextTurnIcon - - property real distanceToManeuver: 0 - property real distanceToManeuverScale: 0 - property bool maneuverComplete: false - property int appID: -1 -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/PerformAudioPassThruModel.qml b/src/components/qt_hmi/qml_model_qt5/models/PerformAudioPassThruModel.qml deleted file mode 100644 index 0952b7d8ad..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/PerformAudioPassThruModel.qml +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file PerformAudioPassThruModel.qml - * @brief Data model audio pass thru. - * 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. - */ - -import QtQuick 2.0 - -QtObject { - property string appName: "" - property string firstLine: "" - property string secondLine: "" - property int timeout: 0 - property bool running: false -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/PhoneMenuModel.qml b/src/components/qt_hmi/qml_model_qt5/models/PhoneMenuModel.qml deleted file mode 100644 index 519f48a809..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/PhoneMenuModel.qml +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @file PhoneMenuModel.qml - * @brief Phone menu list of elements. - * 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. - */ -import QtQuick 2.0 - -ListModel -{ - ListElement { - name: "phone" - icon: "../res/phone/phone.png" - qml: "" - } - ListElement { - name: "contacts" - icon: "../res/phone/contacts.png" - qml: "./views/PhoneKeyboardView.qml" - } - ListElement { - name: "messages" - icon: "../res/phone/messages.png" - qml: "" - } - ListElement { - name: "DND" - icon: "../res/phone/dnd_off.png" - qml: "" - } - ListElement { - name: "texts" - icon: "../res/phone/texts.png" - qml: "" - } - ListElement { - name: "recent" - icon: "../res/phone/recent.png" - qml: "" - } - ListElement { - name: "keyboard" - icon: "../res/phone/keypad.png" - qml: "" - } - ListElement { - name: "more" - icon: "../res/phone/more.png" - qml: "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/PlayerState.qml b/src/components/qt_hmi/qml_model_qt5/models/PlayerState.qml deleted file mode 100644 index 9707f35193..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/PlayerState.qml +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file PlayerState.qml - * @brief List of parameters for each player. - * 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. - */ -import QtQuick 2.0 - -// Player state for all players except SDL media player -Item { - // Media players - property string playPauseState - property string albumImage - property string trackNumber - property int songPosition - property string trackName - - // Radio Players - property var presets: [] - - // Both players - property string songName - property string albumName -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/ScrollableMessageModel.qml b/src/components/qt_hmi/qml_model_qt5/models/ScrollableMessageModel.qml deleted file mode 100644 index 9f45a5d06d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/ScrollableMessageModel.qml +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file ScrollableMessageModel.qml - * @brief Model for Scrollable Message. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common - -QtObject { - property string longMessageText: "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" + - "ffsdjjjjjjjjj jjjjjjjjjjjjjjjjjj jjjjjjjjjjjjjjjjjjj jjjjiiiiiiiiiiiii iiiiiiiiiiii iiiiiiiii iiiiiiiiiiiii iiiiiiiiiiiiioooooo ooooooooo oooooooooooooooo ooooooooooooo ooooooooooooooooooooooooooooooooooooooooooooooo oooooooooooooooooooooooooooo ooooooohhhhhhhhhh hhhhhhhhhhhhh hhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhh hhhhh" - property ListModel softButtons: ListModel {} - property int appId: -1 - property int timeout: 0 - property var async - property bool running: false - property int result: -1 -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/SettingsSourceModel.qml b/src/components/qt_hmi/qml_model_qt5/models/SettingsSourceModel.qml deleted file mode 100644 index fed6d499d9..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/SettingsSourceModel.qml +++ /dev/null @@ -1,92 +0,0 @@ -/** - * @file SettingsSourceModel.qml - * @brief Settings source menu list of elements. - * 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. - */ -import QtQuick 2.0 - -ListModel -{ - ListElement { - title: "Allow SDL Functionality" - qml: "./views/SDLFunctionalityView.qml" - appId: 0 - action: "" - } - ListElement { - title: "Update SDL" - qml: "" - appId: 0 - action: "update_sdl" - } - ListElement { - title: "Policy table update status" - qml: "" - appId: 0 - action: "get_status_update" - } - ListElement { - title: "Send request GetURLS" - qml: "" - appId: 0 - action: "get_urls" - } - ListElement { - title: "Statistics info settings" - qml: "./views/StatisticsInfoView.qml" - appId: 0 - action: "" - } - ListElement { - title: "App permissions" - qml: "./views/PolicyAppListView.qml" - appId: 0 - action: "" - } - ListElement { - title: "Device state change" - qml: "./views/DeviceStateChangedView.qml" - appId: 0 - action: "" - } - ListElement { - title: "System Error" - qml: "./views/SystemErrorView.qml" - appId: 0 - action: "" - } - ListElement { - title: "System Request" - qml: "./views/SystemRequestView.qml" - appId: 0 - action: "" - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/SettingsStorage.qml b/src/components/qt_hmi/qml_model_qt5/models/SettingsStorage.qml deleted file mode 100644 index a102b4ee27..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/SettingsStorage.qml +++ /dev/null @@ -1,401 +0,0 @@ -/** - * @file SettingsStorage.qml - * @brief Storage for keeping settings. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common -import "../models/Internal.js" as Internal - -Item -{ - property var sdlLanguagesList: [ - Common.Language.EN_US, - Common.Language.ES_MX, - Common.Language.FR_CA, - Common.Language.DE_DE, - Common.Language.ES_ES, - Common.Language.EN_GB, - Common.Language.RU_RU, - Common.Language.TR_TR, - Common.Language.PL_PL, - Common.Language.FR_FR, - Common.Language.IT_IT, - Common.Language.SV_SE, - Common.Language.PT_PT, - Common.Language.NL_NL, - Common.Language.ZH_TW, - Common.Language.JA_JP, - Common.Language.AR_SA, - Common.Language.KO_KR, - Common.Language.PT_BR, - Common.Language.CS_CZ, - Common.Language.DA_DK, - Common.Language.NO_NO - ] - - property var displayCapabilities: { - "displayType": Common.DisplayType.GEN2_8_DMA, - "textFields": [ - Common.TextFieldName.mainField1, - Common.TextFieldName.mainField2, - Common.TextFieldName.mainField3, - Common.TextFieldName.mainField4, - Common.TextFieldName.statusBar, - Common.TextFieldName.mediaClock, - Common.TextFieldName.mediaTrack, - Common.TextFieldName.alertText1, - Common.TextFieldName.alertText2, - Common.TextFieldName.alertText3, - Common.TextFieldName.scrollableMessageBody, - Common.TextFieldName.initialInteractionText, - Common.TextFieldName.navigationText1, - Common.TextFieldName.navigationText2, - Common.TextFieldName.ETA, - Common.TextFieldName.totalDistance, - Common.TextFieldName.navigationText, - Common.TextFieldName.audioPassThruDisplayText1, - Common.TextFieldName.audioPassThruDisplayText2, - Common.TextFieldName.sliderHeader, - Common.TextFieldName.sliderFooter, - Common.TextFieldName.notificationText - ], - "mediaClockFormats": [ - Common.MediaClockFormat.CLOCK1, - Common.MediaClockFormat.CLOCK2, - Common.MediaClockFormat.CLOCK3, - Common.MediaClockFormat.CLOCKTEXT1, - Common.MediaClockFormat.CLOCKTEXT2, - Common.MediaClockFormat.CLOCKTEXT3, - Common.MediaClockFormat.CLOCKTEXT4 - ], - "graphicSupported": true, - "imageCapabilities": [ Common.ImageType.DYNAMIC ], - "templatesAvailable": [ "" ], - "screenParams": { - "resolution": { - "resolutionWidth": 800, - "resolutionHeight": 480 - }, - "touchEventAvailable": { - "pressAvailable": true, - "multiTouchAvailable": true, - "doublePressAvailable": true - } - }, - "numCustomPresetsAvailable": 6 - } - - property var softButtonCapabilities: { - "shortPressAvailable": true, - "longPressAvailable": true, - "upDownAvailable": true, - "imageSupported": true - } - - property var buttonCapabilities: [] - - readonly property string fileIVSU: "hmi/res/IVSU/PROPRIETARY_REQUEST" - - property string filePTSnapshot: "" - - property int timeoutPTExchange: 500 - - property var retriesPTExchange: [] - - property var urlsPTExchange: [] - - property int currentRetry: 0 - - property int currentUrl: 0 - - property string appIdIVSU: "" - - property var urlsIVSU: [] - - function updateStatus(result) { - console.debug("Result update SDL:", result); - var text = {} - text[Common.UpdateResult.UP_TO_DATE] = "UP_TO_DATE"; - text[Common.UpdateResult.UPDATING] = "UPDATING"; - text[Common.UpdateResult.UPDATE_NEEDED] = "UPDATE_NEEDED"; - ttsPopUp.activate(text[result]) - } - - function startPTExchange(urls) { - console.log("enter startPTExchange"); - urlsPTExchange = urls; - currentRetry = 0; - currentUrl = 0; - tryUpdatePolicy(); - console.log("exit startPTExchange"); - } - - function startIVSU(urls) { - urlsIVSU = urls; - sendSystemRequest(Common.RequestType.PROPRIETARY, urlsIVSU[0].url, - fileIVSU, appIdIVSU); - } - - function getUrl() { - console.log("enter getUrl"); - if (currentUrl >= 0 && currentUrl < urlsPTExchange.length) { - var url = urlsPTExchange[currentUrl]; - currentUrl = (currentUrl + 1) / urlsPTExchange.length; - console.log("exit getUrl"); - return url; - } else { - console.log("exit getUrl (empty)"); - return {url: ""} - } - } - - function getInterval() { - if (currentRetry >= 0 && currentRetry < retriesPTExchange.length) { - var interval = (timeoutPTExchange + retriesPTExchange[currentRetry]) * 1000; - currentRetry++; - return interval; - } else { - return 0; - } - } - - function sendSystemRequest(type, url, fileName, applicationId) { - console.log("enter sendSystemRequest"); - var offset = 1000; - var length = 10000; - var appId = applicationId ? applicationId : "default"; - var file = fileName ? fileName : fileIVSU; - - sdlBasicCommunication.onSystemRequest(type, url, Common.FileType.JSON, - offset, length, timeoutPTExchange, - file, appId); - console.log("enter sendSystemRequest"); - } - - function tryUpdatePolicy() { - console.log("enter tryUpdatePolicy"); - if (urlsPTExchange.length) { - var url = getUrl(); - sendSystemRequest(Common.RequestType.PROPRIETARY, url.url, filePTSnapshot, url.policyAppId); - } else { - sendSystemRequest(Common.RequestType.PROPRIETARY); - } - - retriesTimer.interval = getInterval(); - if (retriesTimer.interval > 0) { - console.log("start retry strategy"); - retriesTimer.start(); - } - console.log("exit tryUpdatePolicy"); - } - - function systemRequest(type) { - if (urlsPTExchange.length) { - sendSystemRequest(type, urlsPTExchange[0].url, null, urlsPTExchange[0].policyAppId); - } else { - sendSystemRequest(type); - } - } - - function stopPTExchange(fileName) { - console.log("enter stopPTExchange"); - retriesTimer.stop(); - sdlSDL.onReceivedPolicyUpdate(fileName); - console.log("exit stopPTExchange"); - } - - Timer { - id: retriesTimer - interval: timeoutPTExchange; running: false; repeat: false - onTriggered: sendSystemRequest() - } - - function activateApp (appId) { - - console.debug("SDL.ActivateApp Request enter", appId); - - RequestToSDL.SDL_ActivateApp(appId, function(isSDLAllowed, device, isPermissionsConsentNeeded, isAppPermissionsRevoked, appRevokedPermissions, isAppRevoked, priority){ - settingsContainer.activateApp_Response(appId, isSDLAllowed, device, isPermissionsConsentNeeded, isAppPermissionsRevoked, appRevokedPermissions, isAppRevoked, priority) - }) - - console.debug("SDL.ActivateApp Request exit"); - } - - function activateApp_Response (appId, isSDLAllowed, device, isPermissionsConsentNeeded, isAppPermissionsRevoked, appRevokedPermissions, isAppRevoked, priority) { - - console.debug("activateApp_Response enter", appId, isSDLAllowed, device, isPermissionsConsentNeeded, isAppPermissionsRevoked, appRevokedPermissions, isAppRevoked, priority); - - if (!isSDLAllowed) { - - userActionPopUp.activate("Allow SDL Functionality request", - "Would you like to allow SDL functionality for device '" + device.name + "'?", - function(result){ - allowSDLFunctionality(result, device) - }, - true - ) - } - - if (isPermissionsConsentNeeded) { - RequestToSDL.SDL_GetListOfPermissions(appId, function(allowedFunctions){ - settingsContainer.getListOfPermissions_Response(appId, allowedFunctions) - }) - } - - if (isAppPermissionsRevoked) { - - appPermissionsRevoked(appId, appRevokedPermissions, "AppPermissionsRevoked") - } - - if (isAppRevoked) { - - RequestToSDL.SDL_GetUserFriendlyMessage(["AppUnsupported"], dataContainer.hmiUILanguage, function(messages){ - settingsContainer.getUserFriendlyMessageAppPermissionsRevoked("AppUnsupported", messages) - }); - } else if (isSDLAllowed && !isPermissionsConsentNeeded) { - - dataContainer.setCurrentApplication(appId) - contentLoader.go( - Internal.chooseAppStartScreen( - dataContainer.currentApplication.appType, - dataContainer.currentApplication.isMediaApplication - ), - appId - ) - } - } - - function allowSDLFunctionality (result, device) { - console.log("allowSDLFunctionality enter", result, device); - - sdlSDL.onAllowSDLFunctionality(device, result, Common.ConsentSource.GUI) - - console.log("allowSDLFunctionality exit"); - } - - function getListOfPermissions_Response (appId, allowedFunctions) { - console.log("getListOfPermissions_Response enter"); - - var app = dataContainer.getApplication(appId); - var messageCodes = []; - - app.allowedFunctions = allowedFunctions; - - allowedFunctions.forEach(function (x) { - messageCodes.push(x.name); - }); - - RequestToSDL.SDL_GetUserFriendlyMessage(messageCodes, dataContainer.hmiUILanguage, function(messages){ - settingsContainer.onAppPermissionConsent_Notification(appId, messages) - }); - - console.log("getListOfPermissions_Response exit"); - } - - function appPermissionsRevoked (appId, permissions, title) { - - var messageCodes = []; - - permissions.forEach(function (x) { - messageCodes.push(x.name); - }); - - messageCodes.push("AppPermissionsRevoked"); - - RequestToSDL.SDL_GetUserFriendlyMessage(messageCodes, dataContainer.hmiUILanguage, function(messages){ - settingsContainer.getUserFriendlyMessageAppPermissionsRevoked(title, messages) - }); - } - - function getUserFriendlyMessageAppPermissionsRevoked (title, messages) { - var tts = "", - text = ""; - - messages.forEach(function (x) { - if (x.tts) { - tts += x.tts; - } - if (x.textBody) { - text += x.textBody; - } - }); - - if (tts) { - ttsPopUp.activate(tts) - } - - userActionPopUp.activate(title, text, null, false) - - } - - function onAppPermissionConsent_Notification (appId, messages) { - console.log("onAppPermissionConsent_Notification enter"); - - onAppPermissionConsentPopUp.permissionItems.clear() - - var tts = ""; - - for (var i = 0; i < messages.length; i++) { - onAppPermissionConsentPopUp.permissionItems.append({ - "messageCode": messages[i].messageCode, - "label": messages[i].label, - "textBody": messages[i].textBody, - "allowed": false, - "id": messages[i].id - }); - - if (messages[i].tts) { - tts += x.tts; - } - } - - if (tts) { - ttsPopUp.activate(tts) - } - - onAppPermissionConsentPopUp.activate(appId) - - console.log("onAppPermissionConsent_Notification enter"); - } - - function decrypt(file, appId) { - sendSystemRequest(Common.RequestType.FILE_RESUME, urlsIVSU[0].url, file, - appId); - } - - function updateIVSU(appId) { - appIdIVSU = appId; - var service = 4; // service type for IVSU - RequestToSDL.SDL_GetURLS(service, startIVSU); - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/SliderModel.qml b/src/components/qt_hmi/qml_model_qt5/models/SliderModel.qml deleted file mode 100644 index 359eb5d59c..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/SliderModel.qml +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file SliderModel.qml - * @brief Data model for slider. - * 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. - */ - -import QtQuick 2.0 - -QtObject { - property string appName: "" - property string header: "" - property var footer: [] - property int numTicks: 0 - property int position: 0 - property int timeout: 0 - property bool running: false -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/VehicleInfoModel.qml b/src/components/qt_hmi/qml_model_qt5/models/VehicleInfoModel.qml deleted file mode 100644 index 997ce1ee0a..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/VehicleInfoModel.qml +++ /dev/null @@ -1,234 +0,0 @@ -/** - * @file VehicleInfoModel.qml - * @brief Data model for vehicle info. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common - -QtObject { - id: vehicleInfo - property real speed: 80.1 - property int rpm: 5000 - property real fuelLevel: 0.2 - property int fuelLevel_State: Common.ComponentVolumeStatus.CVS_LOW - property real instantFuelConsumption: 2.2 - property int driverBraking: Common.VehicleDataEventStatus.VDES_NO_EVENT - property int wiperStatus: Common.WiperStatus.OFF - property real engineTorque: 2.5 - property real accPedalPosition: 0.5 - property real steeringWheelAngle: 1.2 - property real externalTemperature: 40.0 - property string vin: '52-452-52-752' - property int odometer: 2 - property int prndl: Common.PRNDL.FIFTH - - property var headLampStatus: { - "lowBeamsOn": false, - "highBeamsOn": false, - "ambientLightSensorStatus": Common.AmbientLightStatus.TWILIGHT_1 - } - property var deviceStatus: { - 'voiceRecOn': false, - 'btIconOn': false, - 'callActive': false, - 'phoneRoaming': false, - 'textMsgAvailable': false, - 'battLevelStatus': Common.DeviceLevelStatus.ZERO_LEVEL_BARS, - 'stereoAudioOutputMuted': false, - 'monoAudioOutputMuted': false, - 'signalLevelStatus': Common.DeviceLevelStatus.ZERO_LEVEL_BARS, - 'primaryAudioSource': Common.PrimaryAudioSource.NO_SOURCE_SELECTED, - 'eCallEventActive': false - } - property var bodyInformation: { - 'parkBrakeActive': false, - 'ignitionStableStatus': Common.IgnitionStableStatus.IGNITION_SWITCH_NOT_STABLE, - 'ignitionStatus': Common.IgnitionStatus.IS_UNKNOWN - } - property var beltStatus: { - 'driverBeltDeployed': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'passengerBeltDeployed': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'passengerBuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'driverBuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'leftRow2BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'passengerChildDetected': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'rightRow2BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'middleRow2BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'middleRow3BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'leftRow3BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'rightRow3BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'leftRearInflatableBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'rightRearInflatableBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'middleRow1BeltDeployed': Common.VehicleDataEventStatus.VDES_NO_EVENT, - 'middleRow1BuckleBelted': Common.VehicleDataEventStatus.VDES_NO_EVENT, - } - property var tirePressure: { - 'pressureTelltale': Common.WarningLightStatus.WLS_ON, - 'leftFront': { status: Common.ComponentVolumeStatus.CVS_NORMAL}, - 'rightFront': { status: Common.ComponentVolumeStatus.CVS_UNKNOWN }, - 'leftRear': { status: Common.ComponentVolumeStatus.CVS_NORMAL }, - 'rightRear': { status: Common.ComponentVolumeStatus.CVS_UNKNOWN }, - 'innerLeftRear': { status: Common.ComponentVolumeStatus.CVS_UNKNOWN }, - 'innerRightRear': { status: Common.ComponentVolumeStatus.CVS_UNKNOWN } - } - property var gps: { - 'longitudeDegrees': 42.3293, - 'latitudeDegrees': -83.0464, - 'utcYear': 2013, - 'utcMonth': 2, - 'utcDay': 14, - 'utcHours': 13, - 'utcMinutes': 16, - 'utcSeconds': 54, - 'compassDirection': Common.CompassDirection.SOUTHWEST, - 'pdop': 4, - 'hdop': 5, - 'vdop': 6, - 'actual': false, - 'satellites': 8, - 'dimension': Common.Dimension.Dimension_2D, - 'altitude': 7, - 'heading': 173, - 'speed': 2 - } - property var ecuDIDData: { - 'data1': 'ECU 1 Test Data', - 'data2': 'ECU 2 Test Data' - } - property var eCallInfo: { - "eCallNotificationStatus" : Common.VehicleDataNotificationStatus.VDNS_NORMAL, - "auxECallNotificationStatus" : Common.VehicleDataNotificationStatus.VDNS_ACTIVE, - "eCallConfirmationStatus" : Common.ECallConfirmationStatus.ECCS_NORMAL - } - property var airbagStatus: { - "driverAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NO_EVENT, - "driverSideAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NO, - "driverCurtainAirbagDeployed" : Common.VehicleDataEventStatus.VDES_YES, - "passengerAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NOT_SUPPORTED, - "passengerCurtainAirbagDeployed" : Common.VehicleDataEventStatus.VDES_FAULT, - "driverKneeAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NO, - "passengerSideAirbagDeployed" : Common.VehicleDataEventStatus.VDES_YES, - "passengerKneeAirbagDeployed" : Common.VehicleDataEventStatus.VDES_NOT_SUPPORTED - } - property var emergencyEvent: { - "emergencyEventType" : Common.EmergencyEventType.EET_NO_EVENT, - "fuelCutoffStatus" : Common.EmergencyEventType.EET_FRONTAL, - "rolloverEvent" : Common.EmergencyEventType.EET_SIDE, - "maximumChangeVelocity" : Common.EmergencyEventType.EET_REAR, - "multipleEvents" : Common.EmergencyEventType.EET_ROLLOVER - } - property var clusterModeStatus: { - "powerModeActive" : true, - "powerModeQualificationStatus" : Common.PowerModeQualificationStatus.POWER_MODE_UNDEFINED, - "carModeStatus" : Common.CarModeStatus.CMS_NORMAL, - "powerModeStatus" : Common.PowerModeStatus.KEY_OUT - } - property var myKey: { - "e911Override": Common.VehicleDataStatus.VDS_NO_DATA_EXISTS - } - - - function sendGpsChange(){ - sdlVehicleInfo.onGps(vehicleInfo.gps) - } - function sendSpeedChange(){ - sdlVehicleInfo.onSpeed(vehicleInfo.speed) - } - function sendRpmChange(){ - sdlVehicleInfo.onRpm(vehicleInfo.rpm) - } - function sendFuelLevelChange(){ - sdlVehicleInfo.onFuelLevel(vehicleInfo.fuelLevel) - } - function sendFuelLevel_StateChange(){ - sdlVehicleInfo.onFuelLevel_State(vehicleInfo.fuelLevel_State) - } - function sendInstantFuelConsumptionChange(){ - sdlVehicleInfo.onInstantFuelConsumption(vehicleInfo.instantFuelConsumption) - } - function sendExternalTemperatureChange(){ - sdlVehicleInfo.onExternalTemperature(vehicleInfo.externalTemperature) - } - function sendPrndlChange() { - if (dataContainer.vehicleInfoModel.prndl !== -1) - {sdlVehicleInfo.onPrndl(vehicleInfo.prndl)} - } - function sendTirePressureChange(){ - sdlVehicleInfo.onTirePressure(vehicleInfo.tirePressure) - } - function sendOdometerChange(){ - sdlVehicleInfo.onOdometer(vehicleInfo.odometer) - } - function sendBeltStatusChange(){ - sdlVehicleInfo.onBeltStatus(vehicleInfo.beltStatus) - } - function sendBodyInformationChange(){ - sdlVehicleInfo.onBodyInformation(vehicleInfo.bodyInformation) - } - function sendDeviceStatusChange(){ - sdlVehicleInfo.onDeviceStatus(vehicleInfo.deviceStatus) - } - function sendDriverBrakingChange(){ - sdlVehicleInfo.onDriverBraking(vehicleInfo.driverBraking) - } - function sendWiperStatusChange(){ - sdlVehicleInfo.onWiperStatus(vehicleInfo.wiperStatus) - } - function sendHeadLampStatusChange(){ - sdlVehicleInfo.onHeadLampStatus(vehicleInfo.headLampStatus) - } - function sendEngineTorqueChange(){ - sdlVehicleInfo.onEngineTorque(vehicleInfo.engineTorque) - } - function sendAccPedalPositionChange(){ - sdlVehicleInfo.onAccPedalPosition(vehicleInfo.accPedalPosition) - } - function sendSteeringWheelAngleChange(){ - sdlVehicleInfo.onSteeringWheelAngle(vehicleInfo.steeringWheelAngle) - } - function sendECallInfoChange(){ - sdlVehicleInfo.onECallInfo(vehicleInfo.eCallInfo) - } - function sendAirbagStatusChange(){ - sdlVehicleInfo.onAirbagStatus(vehicleInfo.airbagStatus) - } - function sendEmergencyEventChange(){ - sdlVehicleInfo.onEmergencyEvent(vehicleInfo.emergencyEvent) - } - function sendClusterModeStatusChange(){ - sdlVehicleInfo.onClusterModeStatus(vehicleInfo.clusterModeStatus) - } - function sendMyKeyChange(){ - sdlVehicleInfo.onMyKey(vehicleInfo.myKey) - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/models/VrHelpItemsDefault.qml b/src/components/qt_hmi/qml_model_qt5/models/VrHelpItemsDefault.qml deleted file mode 100644 index 3dc6ad563d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/models/VrHelpItemsDefault.qml +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file VrHelpItemsDefault.qml - * @brief Default voice recognition help items. - * 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. - */ -import QtQuick 2.0 - -ListModel { - id: vrHelpItemsDefault - - Component.onCompleted: { - vrHelpItemsDefault.append({ - text: "Default VR Help Text1", - image: { - value: "", - imageType: 1 - }, - position: 1 - }); - vrHelpItemsDefault.append({ - text: "Default VR Help Text2", - image: { - value: "", - imageType: 1 - }, - position: 2 - }); - vrHelpItemsDefault.append({ - text: "Default VR Help Text3", - image: { - value: "", - imageType: 1 - }, - position: 3 - }); - } -} - diff --git a/src/components/qt_hmi/qml_model_qt5/popups/AlertWindow.qml b/src/components/qt_hmi/qml_model_qt5/popups/AlertWindow.qml deleted file mode 100644 index 2d0c4119b1..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/AlertWindow.qml +++ /dev/null @@ -1,290 +0,0 @@ -/** - * @file AlertWindow.qml - * @brief Alert popup window - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -Rectangle { - id: alertWindow - property date lastAlertTime - property var softButtons - property int appId - property string popUpName // TODO{ALESHIN}: No requerments for closePopUp, if alert couldn't be closed by closePopUp request - delete everywhere - - color: "transparent" - - property var async - - Rectangle { - id: rectangle - - anchors.centerIn: parent - color: "black" - border.color: "white" - - width: alertContent.width + 60 - height: alertContent.height + 60 - - property alias alertString: alert.text - property alias appNameString: appName.text - property int duration - - Column { - id: alertContent - anchors.centerIn: parent - spacing: 20 - - Text { - id: appName - anchors.horizontalCenter: parent.horizontalCenter - color: "white" - font.pointSize: 16 - } - - Row { - width: Constants.alertWidth - spacing: 20 - - Image { - id: alertLogo - source: "../res/warning.png" - } - - Text { - id: alert - width: parent.width - alertLogo.width - parent.spacing - clip: true - color: "white" - font.pointSize: 16 - } - } - - Rectangle { - id: progressIndicator - color: "white" - height: 10 - } - - Column { - Item { - width: Constants.alertWidth - height: alertButton1.visible ? alertButton1.height : 0 - - SoftButton { - id: alertButton1 - appId: alertWindow.appId - button: softButtons && softButtons.length > 0 ? softButtons[0] : undefined - anchors.left: parent.left - anchors.right: alertButton2.visible ? alertButton2.left : parent.right - width: Constants.alertWidth / 2 - onPressed: { alertWindow.keep = true; } - onReleased: { alertWindow.keep = false; } - onKeepContext: { - alertWindow.restart(); - sdlUI.onResetTimeout(appId, "UI.Alert") - } - onDefaultAction: { alertWindow.complete(Common.Result.SUCCESS); } - onStealFocus: { - alertWindow.complete(Common.Result.SUCCESS); - contentLoader.go( Internal.chooseAppStartScreen(dataContainer.currentApplication.appType, - dataContainer.currentApplication.isMediaApplication), appId ) - } - } - SoftButton { - id: alertButton2 - appId: alertWindow.appId - button: softButtons && softButtons.length > 1 ? softButtons[1] : undefined - anchors.right: parent.right - width: Constants.alertWidth / 2 - onPressed: { alertWindow.keep = true; } - onReleased: { alertWindow.keep = false; } - onKeepContext: { - alertWindow.restart(); - sdlUI.onResetTimeout(appId, "UI.Alert") - } - onDefaultAction: { alertWindow.complete(Common.Result.SUCCESS); } - onStealFocus: { - alertWindow.complete(Common.Result.SUCCESS); - contentLoader.go( Internal.chooseAppStartScreen(dataContainer.currentApplication.appType, - dataContainer.currentApplication.isMediaApplication), appId ) - } - } - } - Item { - width: Constants.alertWidth - height: alertButton3.visible ? childrenRect.height : 0 - SoftButton { - id: alertButton3 - appId: alertWindow.appId - button: softButtons && softButtons.length > 2 ? softButtons[2] : undefined - anchors.left: parent.left - anchors.right: alertButton4.visible ? alertButton4.left : parent.right - width: Constants.alertWidth / 2 - onPressed: { alertWindow.keep = true; } - onReleased: { alertWindow.keep = false; } - onKeepContext: { - alertWindow.restart(); - sdlUI.onResetTimeout(appId, "UI.Alert") - } - onDefaultAction: { alertWindow.complete(Common.Result.SUCCESS); } - onStealFocus: { - alertWindow.complete(Common.Result.SUCCESS); - contentLoader.go( Internal.chooseAppStartScreen(dataContainer.currentApplication.appType, - dataContainer.currentApplication.isMediaApplication), appId ) - } - } - SoftButton { - id: alertButton4 - appId: alertWindow.appId - button: softButtons && softButtons.length > 3 ? softButtons[3] : undefined - anchors.right: parent.right - width: Constants.alertWidth / 2 - onPressed: { alertWindow.keep = true; } - onReleased: { alertWindow.keep = false; } - onKeepContext: { - alertWindow.restart(); - sdlUI.onResetTimeout(appId, "UI.Alert") - } - onDefaultAction: { alertWindow.complete(Common.Result.SUCCESS); } - onStealFocus: { - alertWindow.complete(Common.Result.SUCCESS); - contentLoader.go( Internal.chooseAppStartScreen(dataContainer.currentApplication.appType, - dataContainer.currentApplication.isMediaApplication), appId ) - } - } - } - } - } - - SequentialAnimation { - id: animation - PropertyAction { target: progressIndicator; property: "width"; value: alertContent.width } - PropertyAnimation { - id: shrinkProgressAnimation - target: progressIndicator - property: "width" - to: 0 - duration: rectangle.duration - } - } - } - - Timer { - id: timer - onTriggered: { - complete(Common.Result.SUCCESS) - } - } - - function alert (alertStrings, duration, sButtons, showIndicator, alertType, applicationId) { - if (timer.running) { // we have alert already - var currentTime = new Date() - var timeFromLastAlert = currentTime - lastAlertTime - var timeLeft = timer.interval - timeFromLastAlert - var discreteInMilliseconds = 1000 // wish to round left time to integer seconds - var timeLeftRounded = discreteInMilliseconds * Math.ceil(timeLeft / discreteInMilliseconds) - return timeLeftRounded - } - else { - lastAlertTime = new Date(); - appId = applicationId - rectangle.appNameString = dataContainer.getApplication(appId).appName; - softButtons = sButtons; - rectangle.alertString = alertStrings.join('\n'); - timer.interval = duration; - rectangle.duration = duration; - timer.start(); - show(); - - progressIndicator.visible = !!showIndicator - progressIndicator.width = alertContent.width - console.log("ProgressIndicator.width:", progressIndicator.width) - animation.start() - } - } - - function show () { - dataContainer.activeAlert = true - dataContainer.applicationSavedContext = dataContainer.applicationContext - visible = true - } - - function complete (reason, data) { - if (!keep) { - hide() - switch (reason) { - case Common.Result.SUCCESS: - DBus.sendReply(async, { __retCode: Common.Result.SUCCESS, __message: "UI.Alert" }) - break - // For other cases - } - } - timer.stop() - } - - function hide() { - console.debug(popUpName, "HIDE") - dataContainer.activeAlert = false - dataContainer.applicationContext = dataContainer.applicationSavedContext - visible = false - } - - function restart() { - animation.restart(); - timer.restart(); - } - - property bool keep: false - - onKeepChanged: { - if (visible && !keep && !timer.running) { - hide() - } - } - - onVisibleChanged: { - if (visible) { - dataContainer.activePopup.push(popUpName) - } else { - for (var i in dataContainer.activePopup) { - if (dataContainer.activePopup[i] === popUpName) { - dataContainer.activePopup.splice(i, 1) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/ContextPopup.qml b/src/components/qt_hmi/qml_model_qt5/popups/ContextPopup.qml deleted file mode 100644 index 92e9d7442b..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/ContextPopup.qml +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file ContextPopup.qml - * @brief Popup view with system context. - * 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. - */ - -import QtQuick 2.0 - -PopUp { - function show() { - console.debug("enter") - if (!visible) { // must not increment counter if show() called for visible popup - visible = true; - dataContainer.popups++ - } - console.debug("exit") - } - - function hide() { - console.debug("enter") - console.debug(popUpName, "HIDE") - if (visible) { // must not decrement counter if hide() called for invisible popup - visible = false; - dataContainer.popups-- - } - console.debug("exit") - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/ExitAllApplicationsPopup.qml b/src/components/qt_hmi/qml_model_qt5/popups/ExitAllApplicationsPopup.qml deleted file mode 100644 index bf88366eae..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/ExitAllApplicationsPopup.qml +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @file ExitAllApplicationsPopup.qml - * @brief Popup "Exit all applications" - * 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. - */ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../controls" - -PopUp { - function complete(reason){ - hide() - } - - Item { - ListModel { - id: reasonExit - - Component.onCompleted: { - for (var name in Common.ApplicationsCloseReason) { - append({name: name}); - } - } - } - } - - Column - { - anchors.centerIn: parent - Row { - Text { - text: "Select reason: " - color: "white" - } - - ComboBox { - id: reasonComboBox - model: reasonExit - } - z: 1000 - } - OvalButton { - text: "Exit" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - sdlBasicCommunication.onExitAllApplications(Common.ApplicationsCloseReason[reasonComboBox.currentText]) - hide() - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/InteractionPopup.qml b/src/components/qt_hmi/qml_model_qt5/popups/InteractionPopup.qml deleted file mode 100644 index a6fc4d7107..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/InteractionPopup.qml +++ /dev/null @@ -1,175 +0,0 @@ -/** - * @file InteractionPopup.qml - * @brief Interaction popup view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../hmi_api/Async.js" as Async -import "../models/Internal.js" as Internal - -ContextPopup { - id: piPopUp - property ListModel choiceSet: ListModel { } - property int timeout - property int appID - property int interactionLayout - property var async - property var grammarID - property bool performInteractionIsActiveNow - - Text { - id: initialText - anchors.top: parent.top - anchors.topMargin: Constants.popupMargin - anchors.left: parent.left - anchors.leftMargin: Constants.popupMargin - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - ListView { - anchors.top: initialText.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.popupMargin - model: choiceSet - delegate: OvalButton { - width: parent.width - text: menuName - icon: image - onClicked: { - complete(Common.Result.SUCCESS, {"choiceID": model.choiceID}) - } - } - } - - Item { - Timer { - id: timer - onTriggered: { - complete(Common.Result.TIMED_OUT) - } - } - } - - function performInteraction(initialTextArg, choiceSet, vrHelpTitle, vrHelp, timeout, interactionLayout, appID) { - console.debug("enter") - var app = dataContainer.getApplication(appID) - var dataToUpdate = {} - - performInteractionIsActiveNow = true - if (initialTextArg !== undefined){ - initialText.text = initialTextArg.fieldText - } - this.timeout = timeout - this.appID = appID - - this.choiceSet.clear() - if (choiceSet !== undefined) { - choiceSet.forEach( function(arrayElement) { - piPopUp.choiceSet.append({ - choiceID: arrayElement.choiceID, - menuName: arrayElement.menuName ? arrayElement.menuName : "", - image: arrayElement.image ? arrayElement.image : "", - secondaryText: arrayElement.secondaryText ? arrayElement.secondaryText : "", - tertiaryText: arrayElement.tertiaryText ? arrayElement.tertiaryText: "", - secondaryImage: arrayElement.secondaryImage ? arrayElement.secondaryImage : "" - }) - }) - } - if (vrHelpTitle !== undefined) { - dataToUpdate.vrHelpTitlePerformInteraction = vrHelpTitle - } - - app.vrHelpItemsPerformInteraction.clear() - - if (vrHelp !== undefined) { - vrHelp.forEach( Internal.appendVrHelpItem, app.vrHelpItemsPerformInteraction ) - } - if (interactionLayout !== undefined) { - this.interactionLayout = interactionLayout - } - dataContainer.setApplicationProperties(appID, dataToUpdate) - async = new Async.AsyncCall() - if (piPopUp.choiceSet.count !== 0) { - activate() - }else if (grammarID) { - vrActivate() - } - console.debug("exit") - return async - } - - function activate () { - console.debug("enter") - timer.interval = timeout - timer.start() - if (grammarID) { - vrPopUp.sortModelforPerformInteraction() - } - show() - console.debug("exit") - } - function vrActivate () { - console.debug("enter") - timer.interval = timeout - timer.start() - vrPopUp.sortModelforPerformInteraction() - vrPopUp.show() - vrHelpPopup.show() - console.debug("exit") - } - - function complete (reason, data) { - console.debug("enter") - switch (reason) { - case Common.Result.SUCCESS: - DBus.sendReply(async, data) - break - case Common.Result.ABORTED: - DBus.sendReply(async, { __retCode: Common.Result.ABORTED }) - break - case Common.Result.TIMED_OUT: - DBus.sendReply(async, { __retCode: Common.Result.TIMED_OUT }) - break - } - timer.stop() - grammarID = "" - hide() - performInteractionIsActiveNow = false - console.debug("exit") - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/OnAppPermissionConsentPopUp.qml b/src/components/qt_hmi/qml_model_qt5/popups/OnAppPermissionConsentPopUp.qml deleted file mode 100644 index 2c4fe8bd3d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/OnAppPermissionConsentPopUp.qml +++ /dev/null @@ -1,153 +0,0 @@ -/** - * @file OnAppPermissionConsent.qml - * @brief Settings source screen view. - * 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. - */ -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 -import "../models" -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -PopUp { - - width: Constants.popupWidth - 200 - height: Constants.popupHeigth - 200 - - property int appID - property ListModel permissionItems: ListModel{} - - function activate(appId) { - console.debug("onAppPermissionConsentPopUp activate enter"); - appID = appId - show() - console.debug("onAppPermissionConsentPopUp activate exit"); - } - - function getFunctionalID(messageCode) { - - console.debug(appID); - - var app = dataContainer.getApplication(appID); - - for (var i = 0; i < app.allowedFunctions.length; i++) { - if (messageCode == app.allowedFunctions[i].name) { - - return app.allowedFunctions[i].id; - } - } - } - - function deactivate() { - console.debug("onAppPermissionConsentPopUp deactivate enter"); - hide() - - var consentedFunctions = []; - - for (var i = 0; i < permissionItems.count; i++) { - consentedFunctions.push({ - "name": permissionItems.get(i).messageCode, - "id": getFunctionalID(permissionItems.get(i).messageCode), - "allowed": permissionItems.get(i).allowed - }) - - console.debug("consentedFunctions.push", consentedFunctions[i].name,consentedFunctions[i].id,consentedFunctions[i].allowed); - } - - sdlSDL.onAppPermissionConsent(appID, consentedFunctions, Common.ConsentSource.GUI); - console.debug("onAppPermissionConsentPopUp deactivate exit"); - } - - Column { - anchors.fill: parent - - Component { - id: listDelegate - - Item { - height: 70 - width: parent.width - - CheckBox { - id: checkBox - height: 20 - - style: CheckBoxStyle { - label: Text { - color: Constants.panelTextColor - text: permissionItems.get(index).label - } - } - onClicked: { - permissionItems.setProperty(index, "allowed", !allowed) - } - } - - Text { - id: label - color: Constants.primaryColor - font.pixelSize: 0 - text: textBody - wrapMode: TextEdit.Wrap - width: parent.width - anchors.top: checkBox.bottom - } - } - } - - ScrollableListView { - id: onAppPermissonList - anchors.fill: parent; - anchors.margins: 5 - anchors.bottomMargin: 100 - model: permissionItems - delegate: listDelegate - } - - Item { - id: bottomPanel - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 100 - width: parent.width - - OvalButton { - anchors.centerIn: parent - text: "Done" - onClicked: { - deactivate() - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/PerformAudioPassThruPopup.qml b/src/components/qt_hmi/qml_model_qt5/popups/PerformAudioPassThruPopup.qml deleted file mode 100644 index 2cb0212a34..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/PerformAudioPassThruPopup.qml +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @file PerformAudioPassThruPopup.qml - * @brief Popup for audio pass thru - * 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. - */ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../controls" - -ContextPopup { - property var async - - function showAudioPassThru(){ - console.debug("entered") - dataContainer.uiAudioPassThru.running = true - show() - if (dataContainer.uiAudioPassThru.timeout) { - timer.start() - } - console.debug("exited") - } - - function complete(reason){ - console.debug("enter", reason) - timer.stop() - dataContainer.uiAudioPassThru.timeout = 0 - dataContainer.uiAudioPassThru.running = false - switch (reason) { - case Common.Result.ABORTED: - console.debug("exit with abort") - DBus.sendError(async, Common.Result.ABORTED) - break; - case Common.Result.SUCCESS: - console.debug("exit with success") - DBus.sendReply(async, {}) - break; - case Common.Result.RETRY: - console.debug("exit with retry") - DBus.sendError(async, Common.Result.RETRY) - break; - } - hide() - } - - - Column { - spacing: Constants.generalSpacing - anchors.centerIn: parent - Timer { - id: timer - interval: dataContainer.uiAudioPassThru.timeout - onTriggered: { - complete(Common.Result.SUCCESS) - } - } - - Text { - id: appNameText - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiAudioPassThru.appName - color: Constants.primaryColor - font.pixelSize: Constants.fontSize * 2 - } - - Row { - spacing: Constants.generalSpacing - Image { - source: "../res/controlButtons/vrImage.png" - } - - Column { - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiAudioPassThru.firstLine - color: Constants.audioPassThruTextColor - font.pixelSize: Constants.fontSize - } - Text { - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiAudioPassThru.secondLine - color: Constants.audioPassThruTextColor - font.pixelSize: Constants.fontSize - } - } - } - - - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: Constants.generalSpacing - - OvalButton { - text: "Retry" - fontSize: Constants.fontSize - onClicked: { - complete(Common.Result.RETRY) - } - } - - OvalButton { - text: "Done" - fontSize: Constants.fontSize - onClicked: { - complete(Common.Result.SUCCESS) - } - } - } - - OvalButton { - text: "Close" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - console.debug("enter") - complete(Common.Result.ABORTED) - console.debug("exit") - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/PopUp.qml b/src/components/qt_hmi/qml_model_qt5/popups/PopUp.qml deleted file mode 100644 index 544852638d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/PopUp.qml +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @file PopUp.qml - * @brief General popup view. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -Item { - default property alias content: content.children - property int padding: Constants.popUpPadding - property string popUpName - - visible: false - - width: Constants.popupWidth - height: Constants.popupHeigth - - MouseArea { anchors.fill: parent } - - Rectangle { - width: parent.width - padding / 2 - height: parent.height - padding / 2 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - color: Constants.secondaryColor - border.width: 1 - border.color: Constants.popUpBorderColor - radius: padding - Rectangle { - id: content - width: parent.width - padding - height: parent.height - padding - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - color: Constants.transparentColor - } - } - - onVisibleChanged: { - if (popUpName) { - if (visible) { - dataContainer.activePopup.push(popUpName) - } else { - for (var i in dataContainer.activePopup) { - if (dataContainer.activePopup[i] === popUpName) { - dataContainer.activePopup.splice(i, 1) - } - } - } - } - } - - function show() { - console.debug("enter"); - visible = true; - console.debug("exit"); - } - - function hide() { - console.debug("enter"); - visible = false; - console.debug("exit"); - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/SliderPopup.qml b/src/components/qt_hmi/qml_model_qt5/popups/SliderPopup.qml deleted file mode 100644 index 38f866797d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/SliderPopup.qml +++ /dev/null @@ -1,217 +0,0 @@ -/** - * @file ExitAllApplicationsPopup.qml - * @brief Popup "Exit all applications" - * 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. - */ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../controls" - -ContextPopup { - property var async - property int position: 1 - /** - * Test Support Section - */ - property int resultCode: -1 - signal onReady - /** - * Test Support Section End - */ - - function showSlider(){ - console.debug("enter") - - dataContainer.uiSlider.running = true - dataContainer.applicationSavedContext = dataContainer.applicationContext - if(dataContainer.uiSlider.footer === undefined || - dataContainer.uiSlider.footer.length === 0 || - dataContainer.uiSlider.position === 0 ) { - footerText.text = "" - } else { - footerText.text = dataContainer.uiSlider.footer.length === 1 ? dataContainer.uiSlider.footer[0] : dataContainer.uiSlider.footer[dataContainer.uiSlider.position - 1] - } - position = dataContainer.uiSlider.position - show() - timer.start() - onReady() - console.debug("exit") - } - - function complete(reason){ - console.debug("enter reason = ", reason) - timer.stop() - dataContainer.applicationContext = dataContainer.applicationSavedContext - dataContainer.uiSlider.running = false - switch(reason) { - case Common.Result.ABORTED: - console.debug("aborted position is", position) - resultCode = Common.Result.ABORTED - DBus.sendReply(async, {__retCode: resultCode, sliderPosition: position}) - break - case Common.Result.SUCCESS: - console.debug("send position", position) - resultCode = Common.Result.SUCCESS - dataContainer.uiSlider.position = position - DBus.sendReply(async, {sliderPosition:position}) - break - default: - break - } - hide() - position = 1 - console.debug("exit") - } - - - Column - { - spacing: Constants.generalSpacing - anchors.centerIn: parent - Timer { - id: timer - interval: dataContainer.uiSlider.timeout - onTriggered: { - console.debug("triggered") - complete(Common.Result.SUCCESS) - } - } - - Text { - id: appNameText - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiSlider.appName - color: Constants.primaryColor - font.pixelSize: Constants.fontSize * 2 - } - - Text { - id: headerText - width: borderRectangle.width - elide: Text.ElideRight - anchors.horizontalCenter: parent.horizontalCenter - text: dataContainer.uiSlider.header - color: Constants.sliderTextColor - font.pixelSize: Constants.fontSize * 2 - } - - Rectangle { - id: borderRectangle - width: Constants.sliderBarWidth - height: Constants.sliderBarHeight - anchors.horizontalCenter: parent.horizontalCenter - border.color: Constants.sliderBarBorderColor - border.width: Constants.sliderBarBorderWidth - radius: Constants.sliderBarRadius - color: "black" - - Rectangle { - id: rectangle - color: Constants.sliderBarFillColor - height: parent.height - border.color: parent.border.color - border.width: parent.border.width - radius: parent.radius - - onVisibleChanged: { - var tickWidth = borderRectangle.width / dataContainer.uiSlider.numTicks - rectangle.width = dataContainer.uiSlider.position * tickWidth - } - } - - MouseArea{ - id: mouseArea - anchors.fill: parent - onClicked: { - onPositionChanged(mouse) - } - - onPositionChanged: { - if(mouseX <= 0){ - rectangle.width = borderRectangle.width / dataContainer.uiSlider.numTicks - position = 1 - } - - if(mouseX > borderRectangle.width) { - rectangle.width = borderRectangle.width - position = dataContainer.uiSlider.numTicks - } - - if(mouseX > 0 && mouseX < borderRectangle.width) { - var tickWidth = borderRectangle.width / dataContainer.uiSlider.numTicks - position = Math.ceil(mouseX / tickWidth) - rectangle.width = position * tickWidth - } - - if(dataContainer.uiSlider.footer.length > 1){ - footerText.text = dataContainer.uiSlider.footer[position - 1] - } - } - } - } - - Text { - id:footerText - width: borderRectangle.width - elide: Text.ElideRight - anchors.horizontalCenter: parent.horizontalCenter - text: "" - color: Constants.sliderTextColor - font.pixelSize: Constants.fontSize * 2 - } - - OvalButton { - text: "Close" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - console.debug("enter") - complete(Common.Result.ABORTED) - console.debug("exit") - } - } - } - - function getTimer() { - return timer - } - function getBackButton() { - return backButton - } - function getFooterText() { - return footerText - } - function getBorderRectangle() { - return borderRectangle - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/TBTClientStatePopUp.qml b/src/components/qt_hmi/qml_model_qt5/popups/TBTClientStatePopUp.qml deleted file mode 100644 index 5cd49bdd51..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/TBTClientStatePopUp.qml +++ /dev/null @@ -1,71 +0,0 @@ -/** - * @file TBTClientStatePopUp.qml - * @brief Popup view for TBT interface (list of states). - * 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. - */ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -PopUp { - Item { - ListModel { - id: tbtState - - Component.onCompleted: { - for (var name in Common.TBTState) { - append({name: name}); - } - } - } - } - Text { - text: "TBT Client State" - verticalAlignment: Text.AlignVCenter - anchors.right: parent.right - anchors.left: parent.left - anchors.top: parent.top - color: Constants.primaryColor - } - ComboBox { - id: comboBox - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - model: tbtState - onCurrentTextChanged: { - console.log("Send signal onTBTClientState:", currentText); - sdlNavigation.onTBTClientState(Common.TBTState[currentText]); - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/TTSPopUp.qml b/src/components/qt_hmi/qml_model_qt5/popups/TTSPopUp.qml deleted file mode 100644 index d16015ec56..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/TTSPopUp.qml +++ /dev/null @@ -1,110 +0,0 @@ -/** - * @file TTSPopUp.qml - * @brief Popup view for TTS - * 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. - */ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -PopUp { - height: Constants.ttsPopUpHeight - width: Constants.ttsPopUpWidth - padding: Constants.ttsPopUpPadding - property var async - property string helpPromptstr - - ScrollView { - anchors.fill: parent - Text { - id: text - anchors.fill: parent - color: Constants.popUpBorderColor - font.pixelSize: Constants.ttsFontSize - text:"" - } - } - - resources: [ - Timer { - id: timer - interval: Constants.ttsSpeakTime - onTriggered: deactivate() - }, - - Timer { - id: ttsPerformInteractionTimer - interval: Constants.ttsSpeakTime - onTriggered: - if(interactionPopup.performInteractionIsActiveNow) - activate(message) - property var message: undefined - } - ] - - function performInteraction(helpPrompt, initialPrompt, timeoutPrompt, timeout) { - console.debug("Activate TTS popup:", "message"); - helpPromptstr = helpPrompt - activate(initialPrompt); - if (timeout * 2 - Constants.ttsSpeakTime > 0) { - ttsPerformInteractionTimer.message = timeoutPrompt; - ttsPerformInteractionTimer.interval = timeout - Constants.ttsSpeakTime; - ttsPerformInteractionTimer.restart() - } - } - - function activate(message) { - console.debug("Activate TTS popup:", message); - dataContainer.activeTTS = true; - sdlTTS.started(); - console.debug("TTS started"); - text.text = message; - show(); - timer.restart(); - console.debug("Exit"); - } - - function deactivate() { - console.debug("Deactivate TTS popup"); - dataContainer.activeTTS = false; - sdlTTS.stopped(); - console.debug("TTS stopped"); - text.text = ''; - timer.stop(); - hide(); - DBus.sendReply(async, {}); - async = null; - console.debug("Exit"); - } -} - diff --git a/src/components/qt_hmi/qml_model_qt5/popups/UserActionPopUp.qml b/src/components/qt_hmi/qml_model_qt5/popups/UserActionPopUp.qml deleted file mode 100644 index d49c212297..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/UserActionPopUp.qml +++ /dev/null @@ -1,175 +0,0 @@ -/** - * @file PopUp.qml - * @brief General popup view. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants -import "../controls" - -Item { - default property alias content: content.children - property var callbackFunc: null - property int padding: Constants.popUpPadding - property string popUpName - - visible: false - - width: Constants.popupWidth - height: Constants.popupHeigth - - MouseArea { anchors.fill: parent } - - Rectangle { - width: parent.width / 2 - height: parent.height / 2 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - color: Constants.secondaryColor - border.width: 1 - border.color: Constants.popUpBorderColor - radius: padding - Rectangle { - id: content - width: parent.width - padding - height: parent.height - padding - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - color: Constants.transparentColor - } - - Text { - id: title - text: "adsadad" - anchors.top: parent.top - anchors.topMargin: 5 - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - width: parent.width - padding - height: 20 - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - wrapMode: TextEdit.Wrap - } - - Text { - id: message - text: "adsadad" - anchors.top: parent.top - anchors.topMargin: 30 - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - width: parent.width - padding - height: 100 - font.pixelSize: 0 - color: Constants.primaryColor - wrapMode: TextEdit.Wrap - } - - OvalButton { - id: okButton - text: "Ok" - fontSize: Constants.fontSize - property bool result: true - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.leftMargin: 15 - width: parent.width / 2 - 20 - onClicked: { - deactivate(result) - } - visible: false - } - - OvalButton { - id: cancelButton - text: "Cancel" - fontSize: Constants.fontSize - property bool result: false - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.rightMargin: 15 - width: parent.width / 2 - 20 - onClicked: { - deactivate(result) - } - visible: false - } - - OvalButton { - id: closeButton - text: "Close" - fontSize: Constants.fontSize - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.leftMargin: 15 - width: parent.width - 20 - onClicked: { - deactivate() - } - visible: false - } - - } - - function activate(titleText, textBoxText, callback, buttons) { - console.log("userActionPopUp activate enter"); - title.text = titleText; - message.text = textBoxText; - - if (buttons) { - callbackFunc = callback; - okButton.visible = true - cancelButton.visible = true - } else { - closeButton.visible = true - } - - visible = true; - console.debug("userActionPopUp activate exit"); - } - - function deactivate(result) { - console.log("userActionPopUp deactivate enter"); - visible = false; - title.text = ""; - message.text = ""; - if (callbackFunc) { - callbackFunc(result); - callbackFunc = null; - } - okButton.visible = false - cancelButton.visible = false - closeButton.visible = false - console.debug("userActionPopUp deactivate exit"); - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/VRHelpPopup.qml b/src/components/qt_hmi/qml_model_qt5/popups/VRHelpPopup.qml deleted file mode 100644 index c699f0f51d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/VRHelpPopup.qml +++ /dev/null @@ -1,113 +0,0 @@ -/** - * @file VRHelpPopup.qml - * @brief Popup view for VR help - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common - -PopUp { - property alias title: title.text - Text { - id: title - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.popupMargin - text: { - // not in application - if (!dataContainer.applicationContext) { - return dataContainer.currentApplication.vrHelpTitleDefault - // in application - } else { - if (interactionPopup.performInteractionIsActiveNow) { - return dataContainer.currentApplication.vrHelpTitlePerformInteraction - } else if (dataContainer.currentApplication.vrHelpTitle) { - return dataContainer.currentApplication.vrHelpTitle - } else { - return dataContainer.currentApplication.vrHelpTitleDefault - } - } - } - font.pixelSize: Constants.titleFontSize - color: Constants.primaryColor - } - - ScrollableListView { - anchors.top: title.bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.popupMargin - - model: { - // not in application - if (!dataContainer.applicationContext) { - return dataContainer.currentApplication.vrHelpItemsDefault - // in application - } else { - if (interactionPopup.performInteractionIsActiveNow) { - return dataContainer.currentApplication.vrHelpItemsPerformInteraction - } else if (dataContainer.currentApplication.vrHelpItems.count > 0) { - return dataContainer.currentApplication.vrHelpItems - } else { - return dataContainer.currentApplication.vrHelpItemsDefault - } - } - } - - delegate: - Row { - spacing: Constants.iconItemListSpacing - Icon { - source: model.image - anchors.verticalCenter: parent.verticalCenter - width: Constants.iconItemListSize - height: Constants.iconItemListSize - } - - Text { - id: text - anchors.verticalCenter: parent.verticalCenter - text: model.text - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - } - } - } - - function complete(reason, data) { - hide() - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/VRPopUp.qml b/src/components/qt_hmi/qml_model_qt5/popups/VRPopUp.qml deleted file mode 100644 index ed33e5ca8d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/VRPopUp.qml +++ /dev/null @@ -1,158 +0,0 @@ -/** - * @file VRPopUp.qml - * @brief Popup view for VR interface (list commands). - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../views" -import "../controls" - -PopUp { - Text { - id: title - anchors.left: parent.left - anchors.top: parent.top - height: voice.height - width: parent.width - voice.width - text: "Speak the command" - verticalAlignment: Text.AlignVCenter - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - Image { - id: voice - anchors.top: parent.top - anchors.right: parent.right - source: "../res/controlButtons/vrImage.png" - } - OvalButton{ - id:helpButton - anchors.rightMargin: Constants.popupMargin - anchors.leftMargin: Constants.popupMargin - anchors.top: voice.bottom - anchors.left: parent.left - anchors.right: parent.right - text: "Help" - onClicked:{ - if (interactionPopup.performInteractionIsActiveNow) - ttsPopUp.activate(ttsPopUp.helpPromptstr) - if (dataContainer.activeVR) { - vrPopUp.complete(); - vrHelpPopup.hide() - } - } - } - - ScrollableListView { - anchors.bottomMargin: Constants.popupMargin - anchors.rightMargin: Constants.popupMargin - anchors.leftMargin: Constants.popupMargin - anchors.top: helpButton.bottom - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.left: parent.left - - model: if (interactionPopup.grammarID) { - dataContainer.choicesVrCommands - } - else { - dataContainer.vrCommands - } - - delegate: OvalButton { - width: parent.width - text: command - visible: visibleButtons(grammarID,type) - onClicked: { - if (interactionPopup.performInteractionIsActiveNow && type === Common.VRCommandType.Choice) - interactionPopup.complete(Common.Result.SUCCESS, {"choiceID": cmdID}) - sdlVR.onCommand(cmdID, appID === 0 ? undefined : appID); - if (dataContainer.activeVR) { - vrPopUp.complete(); - vrHelpPopup.hide() - } - } - } - } - - function activate() { - dataContainer.activeVR = true; - sdlVR.started(); - show(); - } - - function complete(reason) { - dataContainer.activeVR = false; - sdlVR.stopped(); - hide(); - } - - function sortModelforPerformInteraction() { - var n, - i, - j; - for (n = 0; n < dataContainer.choicesVrCommands.count; n++) { - for (i = n + 1; i < dataContainer.choicesVrCommands.count; i++) { - if (dataContainer.choicesVrCommands.get(n).type === Common.VRCommandType.Command && - dataContainer.choicesVrCommands.get(i).type === Common.VRCommandType.Choice) { - dataContainer.choicesVrCommands.move(i, n, 1); - n = 0; - } - } - } - for (j = interactionPopup.grammarID.length; j > 0; j--) { - for (n = 0; n < dataContainer.choicesVrCommands.count && - dataContainer.choicesVrCommands.get(n).type === Common.VRCommandType.Choice; n++) { - for (i = n + 1; i < dataContainer.choicesVrCommands.count && - dataContainer.choicesVrCommands.get(i).type === Common.VRCommandType.Choice; i++) { - if (dataContainer.choicesVrCommands.get(n).grammarID !== interactionPopup.grammarID[j-1] - && dataContainer.choicesVrCommands.get(i).grammarID === interactionPopup.grammarID[j-1]) { - dataContainer.choicesVrCommands.move(i, n, 1); - n = 0; - } - } - } - } - } - - function visibleButtons(grammarID, type) { - if (interactionPopup.grammarID) { - return interactionPopup.grammarID.indexOf(grammarID) !== -1 - } - else { - return type === Common.VRCommandType.Command - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/popups/VehicleInfoPopUp.qml b/src/components/qt_hmi/qml_model_qt5/popups/VehicleInfoPopUp.qml deleted file mode 100644 index a97f346719..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/popups/VehicleInfoPopUp.qml +++ /dev/null @@ -1,112 +0,0 @@ -/** - * @file VIPopUp.qml - * @brief Pop up window with information about vehicle. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common -import "../controls" -import QtQuick.Controls 1.0 - -PopUp { - //TODO{ALeshin}: Redraw this window as ListView or Column, when we'll get requirements - Column { - anchors.fill: parent - Text { - id: viText - width: parent.width - height: 1/5 * parent.height - text: "Vehicle Information" - font.pixelSize: Constants.fontSize - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - color: Constants.primaryColor - } - - Row { - height: 1/5 * parent.height - width: parent.width - - Text { - width: 1/4 * parent.width - height: 1/5 * parent.height - anchors.verticalCenter: parent.verticalCenter - text: "PRNDL: " - font.pixelSize: Constants.fontSize - verticalAlignment: Text.AlignVCenter - color: Constants.primaryColor - } - - ComboBox { - anchors.verticalCenter: parent.verticalCenter - id: comboBox - model: prndlList - - onCurrentIndexChanged: { - console.debug("PRNDL:", currentIndex) - dataContainer.vehicleInfoModel.prndl = model.get(currentIndex).id - } - - textRole: "name" - ListModel { - id: prndlList - Component.onCompleted: { - append({ id: -1, name: "<NO DATA (prndl)>" }) - for (var name in Common.PRNDL) { - append({ id: Common.PRNDL[name], name: name }); - } - } - } - } - z: 1000 - } - - Text { - width: parent.width - height: 1/5 * parent.height - text: "ECU 1: " + dataContainer.vehicleInfoModel.ecuDIDData.data1 - font.pixelSize: Constants.fontSize - verticalAlignment: Text.AlignVCenter - color: Constants.primaryColor - } - - Text { - width: parent.width - height: 1/5 * parent.height - text: "ECU 2: " + dataContainer.vehicleInfoModel.ecuDIDData.data2 - font.pixelSize: Constants.fontSize - verticalAlignment: Text.AlignVCenter - color: Constants.primaryColor - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/qml_model.qmlproject b/src/components/qt_hmi/qml_model_qt5/qml_model.qmlproject deleted file mode 100644 index ea820e8019..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/qml_model.qmlproject +++ /dev/null @@ -1,20 +0,0 @@ -/* File generated by Qt Creator, version 2.7.0 */ - -import QmlProject 1.1 - -Project { - mainFile: "MainWindow.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "../res" - } - /* List of plugin directories passed to QML runtime */ - importPaths: [ "." ] -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/AMPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/AMPlayerView.qml deleted file mode 100644 index ad0c9d1907..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/AMPlayerView.qml +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file AMPlayerView.qml - * @brief AM player screen view. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common - -GeneralView { - category: Common.DeactivateReason.AUDIO - RadioPlayer { - id: amRadioPlayer - anchors.fill: parent - radioType: "AM" - radioName: "AM Radio" - - playerState: dataContainer.amPlayerState - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/ApplicationListView.qml b/src/components/qt_hmi/qml_model_qt5/views/ApplicationListView.qml deleted file mode 100644 index 38c5ab067e..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/ApplicationListView.qml +++ /dev/null @@ -1,126 +0,0 @@ -/** - * @file ApplicationListView.qml - * @brief Application list view - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -GeneralView { - Column { - anchors.fill: parent - Item { - // top 1/4 of screen - width: parent.width - height: 1/4 * parent.height - - PagedFlickable { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - elementWidth: Constants.ovalButtonWidth - snapTo: elementWidth + spacing - spacing: (width - 4 * elementWidth) / 3 - - OvalButton { - text: "Find New Apps" - } - - OvalButton { - text: "Change device" - onReleased: contentLoader.go("./views/ChangeDeviceView.qml") - } - - OvalButton { - text: "911 Assist" - } - - OvalButton { - text: "Vehicle Health Report" - } - - OvalButton { - text: "Install applications/Up" - } - } - } - - Item { - height: parent.height / 2 - width: parent.width - - ScrollableListView { - id: applicationListView - anchors.fill: parent - model: dataContainer.applicationList - - delegate: Item { - width: parent.width - height: Math.max(applicationName.height, appIcon.height) - Image { - id: appIcon - source: icon - height: Constants.appListIconSize - width: height - } - ClickableText { - id: applicationName - text: appName - defaultColor: Constants.primaryColor - pressedColor: Constants.primaryColorPressed - font.pixelSize: Constants.appListFontSize - anchors.verticalCenter: parent.verticalCenter - anchors.left: appIcon.right - anchors.leftMargin: Constants.margin - onClicked: { - settingsContainer.activateApp(appId) -// dataContainer.setCurrentApplication(appId) -// contentLoader.go( Internal.chooseAppStartScreen(dataContainer.currentApplication.appType, -// dataContainer.currentApplication.isMediaApplication), appId ) - } - } - } - } - } - - Item { - // bottom 1/4 of screen - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/BTPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/BTPlayerView.qml deleted file mode 100644 index a1d8c43a39..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/BTPlayerView.qml +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file BTPlayerView.qml - * @brief FM player screen view. - * 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. - */ -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: btPlayer - playerName: "BT Audio" - anchors.fill: parent - - playerState: dataContainer.btPlayerState - image: playerState.albumImage - - buttons: [ - OvalButton { - text: btPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/CDPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/CDPlayerView.qml deleted file mode 100644 index 8cf1c3f728..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/CDPlayerView.qml +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file CDPlayerView.qml - * @brief CD player screen view. - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: cdPlayer - playerName: "CD" - anchors.fill: parent - image: playerState.albumImage - playerState: dataContainer.cdPlayerState - - buttons: [ - OvalButton { - text: cdPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/CarMenuGridView.qml b/src/components/qt_hmi/qml_model_qt5/views/CarMenuGridView.qml deleted file mode 100644 index e61bac1d08..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/CarMenuGridView.qml +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file CarMenuGridView.qml - * @brief Car menu screen view. - * 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. - */ -import QtQuick 2.0 -import "../models" -import "../controls" - -GridMenu { - id: menu - model: CarMenuModel { } - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - ClickableImage { - anchors.centerIn: parent - source: icon - onClicked: { - if(qml !== "") { - contentLoader.go(qml) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/ChangeDeviceView.qml b/src/components/qt_hmi/qml_model_qt5/views/ChangeDeviceView.qml deleted file mode 100644 index 84a751efec..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/ChangeDeviceView.qml +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @file ChangeDeviceView.qml - * @brief Screen view with list of available devices. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - Text { - id: searchDeviceText - anchors.left: parent.left - anchors.top: parent.top - height: 1/4 * parent.height - width: parent.width - color: Constants.primaryColor - font.pixelSize: Constants.titleFontSize - text: "Devices available:" - verticalAlignment: Text.AlignVCenter - } - - ListView { - id: changeDeviceListView - anchors.left: parent.left - anchors.top: searchDeviceText.bottom - model: dataContainer.deviceList - width:parent.width - height:parent.height - searchDeviceText.height - - delegate: Text { - MouseArea { - anchors.fill: parent - onClicked: { - sdlBasicCommunication.onDeviceChosen({ name: name, id: devid }); - sdlBasicCommunication.onFindApplications({ name: name, id: devid }) - contentLoader.go("./views/ApplicationListView.qml") - } - } - text: name - color: Constants.primaryColor - font.pixelSize: Constants.titleFontSize - } - } - } - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent } - } - - Component.onCompleted: { - console.log("ChangeDeviceView Component.onCompleted enter"); - sdlBasicCommunication.onStartDeviceDiscovery(); - console.log("ChangeDeviceView Component.onCompleted exit"); - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/ClimateControlView.qml b/src/components/qt_hmi/qml_model_qt5/views/ClimateControlView.qml deleted file mode 100644 index 41b0c32efa..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/ClimateControlView.qml +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @file ClimateControlView.qml - * @brief Screen view of climat menu. - * 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. - */ - -import QtQuick 2.0 -import "../controls" - -GeneralView { - Item { - id: climatMenu - anchors.fill: parent - - Item { - height: parent.height - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - Column { - id: leftItem - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 1/4*parent.width - useThisToGetButtonSize.width - - Row { - ClimateControlBtn {name: "heated_seat"} - ClimateControlBtn {name: "heated_wheel"} - } - Row { - ClimateControlBtn {name: "AC"} - ClimateControlBtn {name: "headed_dash"} - } - } - - Column { - id: centralItem - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - - ClimateControlBtn {id: useThisToGetButtonSize; name: "defrost"; state: "on"} - ClimateControlBtn {name: "face"; state: "on"} - ClimateControlBtn {name: "feet"} - } - - Row { - id: rightItem - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: 1/4*parent.width - useThisToGetButtonSize.width - - ClimateControlBtn { - anchors.verticalCenter: parent.verticalCenter - txt: "Dual" - state: "on" - } - - Column { - ClimateControlBtn { name: "heated_seat" } - ClimateControlBtn { name: "AC" } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/ContactsListView.qml b/src/components/qt_hmi/qml_model_qt5/views/ContactsListView.qml deleted file mode 100644 index 90f817036d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/ContactsListView.qml +++ /dev/null @@ -1,118 +0,0 @@ -/** - * @file ContactsListView.qml - * @brief Contact list screen view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -GeneralView { - function setCurrent(firstLetter){ - for(var i = 0; i < contactsListView.count; i ++) { - if (contactsListView.model.get(i).name[0].toUpperCase() === firstLetter) { - contactsListView.positionViewAtIndex(i, ListView.Beginning) - break; - } - } - } - Component.onCompleted: setCurrent(dataContainer.contactsFirstLetter) - - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - ScrollableListView { - id: contactsListView - anchors.fill: parent - clip: true - spacing: 1/2 * Constants.fontSize - model: ContactsListModel { } - - section.property: "name" - section.criteria: ViewSection.FirstCharacter - section.delegate: Text { - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - text: section.toUpperCase() - } - - delegate: Item { - anchors.left: parent.left - width: parent.width - Constants.scrollBarWidth - height: typeText.height - - Text { - id: contactName - anchors.left: parent.left - text: name - width: Constants.contactListNameFieldSize * parent.width - color: Constants.contactTextColor - font.pixelSize: Constants.fontSize - elide: Text.ElideRight - } - Text { - id: phoneText - anchors.left: contactName.right - width: Constants.contactListPhoneFieldSize * parent.width - text: phone - color: Constants.contactTextColor - font.pixelSize: Constants.fontSize - horizontalAlignment: Text.AlignHCenter - } - Text { - id: typeText - anchors.right: parent.right - width: Constants.contactListDescriptionFieldSize * parent.width - text: type - color: Constants.contactTextColor - font.pixelSize: Constants.fontSize - horizontalAlignment: Text.AlignHCenter - } - } - } - } - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/DeviceStateChangedView.qml b/src/components/qt_hmi/qml_model_qt5/views/DeviceStateChangedView.qml deleted file mode 100644 index 5a0b5b7754..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/DeviceStateChangedView.qml +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -import QtQuick 2.0 -import "../models" -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - Text { - id: title - text: "Choose devices to be Unpaired:" - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - height: Constants.fontSize + Constants.panelPadding - } - - ScrollableListView { - id: menu - model: dataContainer.deviceList - anchors.left: parent.left - anchors.right: parent.right - anchors.top: title.bottom - anchors.bottom: bottomPanel.top - delegate: OvalButton { - text: name - onClicked: { - sdlSDL.onDeviceStateChanged(Common.DeviceState.UNPAIRED, - "", {id: devid, name: name}); - } - anchors.left: parent.left - anchors.right: parent.right - fontSize: Constants.fontSize - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/FMPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/FMPlayerView.qml deleted file mode 100644 index ae117ccd05..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/FMPlayerView.qml +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @file FMPlayerView.qml - * @brief FM player screen view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -GeneralView { - category: Common.DeactivateReason.AUDIO - RadioPlayer { - id: fmRadioPlayer - anchors.fill: parent - radioType: "FM" - radioName: "FM Radio" - - playerState: dataContainer.fmPlayerState - - property int hdButtonValue: 1 - - buttonHD: [ - Image { - id: hdButton - anchors.bottom: parent.bottom - anchors.left: parent.left - source: "../res/buttons/long_oval_btn.png" - property string textColor: Constants.primaryColor - - Row { - anchors.centerIn: parent - spacing: (hdButton.width - hdLogo.width - one.width - two.width - three.width - four.width) / 10 - - Image { - id: hdLogo - anchors.verticalCenter: parent.verticalCenter - source:"../res/hd_logo_on.png" - } - - Text { - id: one - anchors.verticalCenter: parent.verticalCenter - text: "1" - color: fmRadioPlayer.hdButtonValue === 1 ? "white" : hdButton.textColor - font.pixelSize: Constants.fontSize - } - - Text { - id: two - anchors.verticalCenter: parent.verticalCenter - text: "2" - color: fmRadioPlayer.hdButtonValue === 2 ? "white" : hdButton.textColor - font.pixelSize: Constants.fontSize - } - - Text { - id: three - anchors.verticalCenter: parent.verticalCenter - text: "3" - color: fmRadioPlayer.hdButtonValue === 3 ? "white" : hdButton.textColor - font.pixelSize: Constants.fontSize - } - - Text { - id: four - anchors.verticalCenter: parent.verticalCenter - text: "4" - color: fmRadioPlayer.hdButtonValue === 4 ? "white" : hdButton.textColor - font.pixelSize: Constants.fontSize - } - } - - MouseArea { - anchors.fill: parent - onPressed: { - hdLogo.source = "../res/hd_logo_off.png" - hdButton.source = "../res/buttons/long_oval_pressed_btn.png" - hdButton.textColor = Constants.secondaryColor - - } - onReleased: { - hdLogo.source = "../res/hd_logo_on.png" - hdButton.source = "../res/buttons/long_oval_btn.png" - hdButton.textColor = Constants.primaryColor - fmRadioPlayer.hdButtonValue === 4 ? fmRadioPlayer.hdButtonValue = 1 : fmRadioPlayer.hdButtonValue++ - } - } - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/GeneralView.qml b/src/components/qt_hmi/qml_model_qt5/views/GeneralView.qml deleted file mode 100644 index ca6eb12e8f..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/GeneralView.qml +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file GeneralView.qml - * @brief Base view class. Defines properties and behavior common for all views - * 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. - */ - -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common - -Item { - /// HMI context view is related to - property int systemContext: Common.SystemContext.SYSCTXT_MAIN - /// True if view is in application context - property bool applicationContext: false - /// View category for AppDeactivated notification (reason) - property int category: Common.DeactivateReason.GENERAL - - signal enterScreen - signal leaveScreen -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/GridMenu.qml b/src/components/qt_hmi/qml_model_qt5/views/GridMenu.qml deleted file mode 100644 index f935b030c4..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/GridMenu.qml +++ /dev/null @@ -1,86 +0,0 @@ -/** - * @file GridMenu.qml - * @brief Parent class for main menu. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -GeneralView { - id: main - property alias model: repeater.model - property alias delegate: repeater.delegate - property alias rows: grid.rows - property int columnsOnPage: Constants.menuColumnCount - - Flickable { - id: flicker - anchors.fill: parent - contentWidth: grid.width - flickableDirection: Flickable.HorizontalFlick - - Grid { - id: grid - anchors.centerIn: parent - rows: Constants.menuRowCount - columns: Math.ceil(model.count / rows) - flow: Grid.TopToBottom - Repeater { - id: repeater - } - } - - property int snapTo: width / parent.columnsOnPage - onMovementEnded: { - var rest = flicker.contentX % snapTo - var time = 0.25 - if (rest > flicker.snapTo / 2) { rest = rest - flicker.snapTo } - var vel = 2 * rest / time - flickDeceleration = Math.abs(vel) / time - flick(vel, 0) - flickDeceleration = 1500 - } - } - - Pager { - id: pager - space: 10 - anchors.horizontalCenter: parent.horizontalCenter - anchors.top: parent.top - anchors.topMargin: Constants.margin - - pages: Math.ceil(grid.columns / parent.columnsOnPage) - activePage: Internal.activePageChoose(flicker, pager.pages) - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/HardwareButtonsView.qml b/src/components/qt_hmi/qml_model_qt5/views/HardwareButtonsView.qml deleted file mode 100644 index 1a162f2caa..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/HardwareButtonsView.qml +++ /dev/null @@ -1,175 +0,0 @@ -/** - * @file HardwareButtonsView.qml - * @brief Area of screen responsible for hardware buttons - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -Rectangle { - height: row.height + row.anchors.margins - anchors.left: parent.left - anchors.right: parent.right - color: Constants.panelColor - - signal buttonDown(string name) - signal buttonUp(string name) - - function pressButton(name) { - buttonDown(name) - } - - function longPressButton(name) { - console.log("long press " + name) - } - - function releaseButton(name) { - buttonUp(name) - } - - Row { - id: row - spacing: Constants.panelPadding - anchors.centerIn: parent - anchors.margins: Constants.panelPadding - - PowerSwitchButton {anchors.verticalCenter: parent.verticalCenter} - - MaskedButton { - name: "vr" - anchors.verticalCenter: parent.verticalCenter - onReleased: { - console.debug("Clicked VR button"); - if (!dataContainer.activeVR) { - vrPopUp.activate(); - vrHelpPopup.show(); - } else { - vrPopUp.complete(); - vrHelpPopup.hide() - } - } - } - - ArrowKeys {anchors.verticalCenter: parent.verticalCenter} - - Grid { - columns: 5 - rows: 2 - spacing: 5 - anchors.verticalCenter: parent.verticalCenter - Repeater { - model: 10 - delegate : Rectangle { - width: 40 - height: 40 - radius: 5 - gradient: Gradient { - GradientStop - { - position: 0.0; - color: "#2c2c2c" - Behavior on position { - NumberAnimation { duration: 80 } - } - } - - GradientStop - { - position: 1.0; - color: "black" - Behavior on position { - NumberAnimation { duration: 80 } - } - } - } - - Text { - text: (1 + index) % 10 - font.pixelSize: 30 - color: Constants.panelTextColor - anchors.centerIn: parent - } - - Timer { - id: timer - interval: Constants.presetButtonTimer - repeat: false - triggeredOnStart: false - } - - MouseArea { - id: mouseArea - anchors.fill: parent - property bool clickProcessed - onPressed: { - parent.gradient.stops[0].position = 1.0 - parent.gradient.stops[1].position = 0.0 - clickProcessed = false - timer.start() - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + index, Common.ButtonEventMode.BUTTONDOWN, undefined) - } - onReleased: { - parent.gradient.stops[0].position = 0.0 - parent.gradient.stops[1].position = 1.0 - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + index, Common.ButtonEventMode.BUTTONUP, undefined) - timer.stop() - if (!clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + index, Common.ButtonPressMode.SHORT, undefined) - } - } - Connections { - target: timer - onTriggered: { - if(!mouseArea.clickProcessed) { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + index, Common.ButtonPressMode.LONG, undefined) - mouseArea.clickProcessed = true - } - } - } - } - - Component.onCompleted: { - settingsContainer.buttonCapabilities.push( - { - name: Common.ButtonName.PRESET_0 + index, - upDownAvailable: true, - shortPressAvailable: true, - longPressAvailable: true - }); - } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/IPodPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/IPodPlayerView.qml deleted file mode 100644 index 65a667702b..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/IPodPlayerView.qml +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file IPodPlayerView.qml - * @brief IPod player screen view. - * 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. - */ -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: ipodPlayer - playerName: "iPod" - anchors.fill: parent - image: playerState.albumImage - playerState: dataContainer.ipodPlayerState - - buttons: [ - OvalButton { - text: ipodPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/LineInPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/LineInPlayerView.qml deleted file mode 100644 index 70f3e04772..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/LineInPlayerView.qml +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file LineInPlayerView.qml - * @brief LineIn player screen view. - * 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. - */ -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: lineInPlayer - playerName: "LineIn" - anchors.fill: parent - image: playerState.albumImage - playerState: dataContainer.linePlayerState - - buttons: [ - OvalButton { - text: lineInPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/MainMenuView.qml b/src/components/qt_hmi/qml_model_qt5/views/MainMenuView.qml deleted file mode 100644 index 7ed435b137..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/MainMenuView.qml +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @file MainMenuView.qml - * @brief Main menu screen view. - * 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. - */ -import QtQuick 2.0 -import "../models" -import "../controls" - -GridMenu { - id: menu - model: MainMenuListModel { } - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - ClickableImage { - anchors.centerIn: parent - source: icon - onClicked: { - if(qml !== "") { - contentLoader.go(qml) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/MediaClockView.qml b/src/components/qt_hmi/qml_model_qt5/views/MediaClockView.qml deleted file mode 100644 index 5178d979cf..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/MediaClockView.qml +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file MediaClockView.qml - * @brief Media clock view - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -Item { - property alias time: timeText.text - Text { - id: timeText - anchors.left: parent.left - width: 1/10 * parent.width - anchors.verticalCenter: parent.verticalCenter - horizontalAlignment: Text.AlignRight - color: "white" - text: (mediaPlayerView.playerType === "SDL") ? Internal.hmsTimeToString(dataContainer.currentApplication.mediaClock.startTime) - : "02:36" //TODO {Aleshin}: get track time for all players except SDL - font.pixelSize: 18 - } - - Row { - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - height: parent.height - width: 2/3 * parent.width - - Rectangle { - anchors.verticalCenter: parent.verticalCenter - height: 2 - width: dataContainer.currentApplication.mediaClock.progress * parent.width - color: "white" - } - - Rectangle { - anchors.verticalCenter: parent.verticalCenter - height: 2 - width: (1 - dataContainer.currentApplication.mediaClock.progress) * parent.width - color: Constants.primaryColor - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/MediaPlayer.qml b/src/components/qt_hmi/qml_model_qt5/views/MediaPlayer.qml deleted file mode 100644 index ed4eda014e..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/MediaPlayer.qml +++ /dev/null @@ -1,302 +0,0 @@ -/** - * @file MediaPlayerView.qml - * @brief Parent for BT, IPod, CD players screen view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -Item { - id: mediaPlayerView - - property string playerName: "" - property string playerType: "" - - signal rewind - signal forward - signal play - signal pause - - // Holds players state(song name, play/pause state, track number etc). For all players except SDL. - property PlayerState playerState; - - property alias buttons: buttonsRow.content - property alias buttonsSpacing: buttonsRow.spacing - property alias image: image.source - - Item { - // row of oval buttons - id: ovalButtonsRow - width: parent.width - height: 1/5 * parent.height - anchors.left: parent.left - anchors.top: parent.top - - PagedFlickable { - id: buttonsRow - width: parent.width - spacing: (mediaPlayerView.playerType === "SDL") ? ((width - 4 * elementWidth) / 3) - : (width - 2 * elementWidth) - anchors.verticalCenter: parent.verticalCenter - snapTo: Constants.ovalButtonWidth + spacing - elementWidth: Constants.ovalButtonWidth - } - } - - Item { - id: spacingBetweenItems - width: parent.width - height: 1/10 * parent.height - anchors.left: parent.left - anchors.top: ovalButtonsRow.bottom - - Behavior on height { - NumberAnimation { - duration : Constants.animationDuration - } - } - } - - Column { - // Picture + text information + media clock - id: mediaContent - width: parent.width - height: 2/5 * parent.height - anchors.left: parent.left - anchors.top: spacingBetweenItems.bottom - - Row { - // picture + text info - width: parent.width - height: 3/4 * parent.height - spacing: Constants.margin - - Image { - id: image - height: parent.height - width: height - } - - Column { - // text info - id: textInfo - height: parent.height - width: parent.width - image.width - parent.spacing - spacing: (height - titleText.height - 3 * text.height) / 3 - - Text { - id: titleText - anchors.left: parent.left - anchors.right: parent.right - horizontalAlignment: dataContainer.currentApplication.hmiUITextAlignment - color: Constants.primaryColor - text: (mediaPlayerView.playerType === "SDL") ? dataContainer.currentApplication.hmiUIText.mainField1 - : playerState.trackName - font.pixelSize: Constants.titleFontSize - font.bold: true - } - - Text { - id: text - anchors.left: parent.left - anchors.right: parent.right - horizontalAlignment: dataContainer.currentApplication.hmiUITextAlignment - color: Constants.primaryColor - text: (mediaPlayerView.playerType === "SDL") ? dataContainer.currentApplication.hmiUIText.mainField2 - : playerState.albumName - font.pixelSize: Constants.fontSize - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - horizontalAlignment: Text.AlignHCenter - color: Constants.primaryColor - text: (mediaPlayerView.playerType === "SDL") ? dataContainer.currentApplication.hmiUIText.mediaTrack - : playerState.trackNumber - font.pixelSize: Constants.fontSize - } - } - } - - MediaClockView { - width: parent.width - height: parent.height * 1/4 - } - } - - Item { - id: spacingBetweenItems2 - width: parent.width - height: 1/10 * parent.height - anchors.left: parent.left - anchors.top: mediaContent.bottom - - Behavior on height { - NumberAnimation { - duration : Constants.animationDuration - } - } - } - - Row { - // Rewind, play, pause, forward buttons - id: playPauseRewindForward - width: parent.width - height: 1/5 * parent.height - statusBar.height - anchors.left: parent.left - anchors.leftMargin: (width - playPauseButton.width - prevButton.width - nextButton.width) / 2 - anchors.top: spacingBetweenItems2.bottom - - Image { - id: prevButton - anchors.verticalCenter: parent.verticalCenter - source: "../res/buttons/player_prev_btn.png" - MouseArea { - anchors.fill: parent - onPressed: { - prevButton.source = "../res/buttons/player_prev_pressed_btn.png" - } - onReleased: { - prevButton.source = "../res/buttons/player_prev_btn.png" - } - } - } - - PlayPauseButton { - id: playPauseButton - anchors.verticalCenter: parent.verticalCenter - state: (mediaPlayerView.playerType === "SDL") ? dataContainer.currentApplication.playPauseState : playerState.playPauseState - onClicked: { - (state == 'Play') ? play() : pause(); - var newState = state === "Play" ? "Pause" : "Play"; - (mediaPlayerView.playerType === "SDL") ? dataContainer.setApplicationProperties(dataContainer.currentApplication.appId, { playPauseState: newState } ) - : playerState.playPauseState = newState - } - } - - Image { - id: nextButton - anchors.verticalCenter: parent.verticalCenter - source: "../res/buttons/player_next_btn.png" - MouseArea { - anchors.fill: parent - onPressed: { - nextButton.source = "../res/buttons/player_next_pressed_btn.png" - } - onReleased: { - nextButton.source = "../res/buttons/player_next_btn.png" - } - } - } - } - - Item { - id: presetButtons - width: parent.width - height: 1/5 * parent.height - anchors.top: playPauseRewindForward.bottom - anchors.left: parent.left - - PresetRow { - id: presetsRow - anchors.top: parent.top - anchors.left: parent.left - presets: mediaPlayerView.playerType === "SDL" ? Internal.getArrayForPresetRow(dataContainer.currentApplication) : [] - width: parent.width - - onPresetButtonPressed: { - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonEventMode.BUTTONDOWN, undefined) - } - - onPresetButtonReleased: { - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonEventMode.BUTTONUP, undefined) - } - - onPresetButtonClicked: { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonPressMode.SHORT, undefined) - } - - onPresetButtonHold: { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonPressMode.LONG, undefined) - } - } - } - - StatusBar { - id: statusBar - anchors.left: parent.left - anchors.bottom: parent.bottom - } - - states: [ - State { - name: 'presetButtonsON' - when: (dataContainer.currentApplication.customPresets.count > 0) && (mediaPlayerView.playerType === "SDL") - PropertyChanges { - target: spacingBetweenItems - height: 1 - } - PropertyChanges { - target: spacingBetweenItems2 - height: 1 - } - PropertyChanges { - target: presetButtons - visible: true - enabled: true - } - }, - - State { - name: 'presetButtonsOFF' - when: (dataContainer.currentApplication.customPresets.count === 0) || (mediaPlayerView.playerType !== "SDL") - PropertyChanges { - target: spacingBetweenItems - height: 1/10 * mediaPlayerView.height - } - PropertyChanges { - target: spacingBetweenItems2 - height: 1/10 * mediaPlayerView.height - } - PropertyChanges { - target: presetButtons - visible: false - enabled: false - } - } - ] -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/MusicSourceView.qml b/src/components/qt_hmi/qml_model_qt5/views/MusicSourceView.qml deleted file mode 100644 index 08f1d76b60..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/MusicSourceView.qml +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @file MusicSourceView.qml - * @brief Music source screen view. - * 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. - */ -import QtQuick 2.0 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - GridMenu { - id: menu - model: dataContainer.musicSourceModel - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: bottomPanel.top - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - OvalButton { - text: title - onReleased: contentLoader.go(qml, appId) - anchors.centerIn: parent - fontSize: Constants.fontSize - } - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} - - - diff --git a/src/components/qt_hmi/qml_model_qt5/views/NavigationInRouteGridView.qml b/src/components/qt_hmi/qml_model_qt5/views/NavigationInRouteGridView.qml deleted file mode 100644 index 99f1877a51..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/NavigationInRouteGridView.qml +++ /dev/null @@ -1,250 +0,0 @@ -/** - * @file NavigationInRouteGridView.qml - * @brief Navigation in route screen veiw. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - - -GeneralView { - Item { - id: navInRoute - anchors.fill: parent - - Image { - // 3/4 top screen - id: map - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - source: "../res/nav/map.png" - - Image { - id: compas - anchors.bottom: parent.bottom - anchors.bottomMargin: 1/4 * compas.width - anchors.left: parent.left - anchors.leftMargin: 1/4 * compas.width - source: "../res/nav/compass.png" - } - - Column { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: compas.horizontalCenter - spacing: 1/8 * parent.height - - // Zoom "+" button - Image { - id: zoomIn - source: "../res/buttons/zoom.png" - - Text { - id: zoomInBtn - anchors.centerIn: parent - text: "+" - color: Constants.releasedButtonTextColor - font.pixelSize: 30 - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/zoom_pressed.png" - zoomInBtn.color = Constants.pressedButtonTextColor - } - onReleased: { - parent.source = "../res/buttons/zoom.png" - zoomInBtn.color = Constants.releasedButtonTextColor - } - - onClicked: { - //Some behavior - } - } - } - - // Zoom "-" button - Image { - id: zoomOut - source: "../res/buttons/zoom.png" - - Text { - id: zoomOutBtn - anchors.centerIn: parent - text: "-" - color: "white" - font.pixelSize: 30 - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/zoom_pressed.png" - zoomOutBtn.color = Constants.pressedButtonTextColor - } - onReleased: { - parent.source = "../res/buttons/zoom.png" - zoomOutBtn.color = Constants.releasedButtonTextColor - } - - onClicked: { - //Some behavior - } - } - } - } // column - - // Options button - Image { - id: navOptions - anchors.top: parent.top - anchors.right: parent.right - source: "../res/nav/options.png" - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/nav/options_pressed.png" - } - onReleased: { - parent.source = "../res/nav/options.png" - } - onClicked: { - //Options screen - } - } - } - } //map - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - Image { - id: muteBtnImg - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 1/4 * muteBtnImg.width - source: "../res/nav/mute_off.png" - MouseArea { - anchors.fill: parent - onClicked: if (muteBtnImg.state === "off") { - muteBtnImg.state = "on" - muteBtnImg.source = "../res/nav/mute_off.png" - } - else { - muteBtnImg.source = "../res/nav/mute_on.png" - muteBtnImg.state = "off" - } - } - } - - Image { - id: turnArrow - anchors.verticalCenter: parent.verticalCenter - anchors.left: muteBtnImg.right - anchors.leftMargin: 1/20 * contentLoader.width - source: "../res/nav/turnArrow.png" - } - - Text { - id: street - anchors.verticalCenter: cancel.verticalCenter - anchors.left: turnArrow.right - anchors.leftMargin: 1/20 * contentLoader.width - text: "0.2 mi on Cherry Hill Rd." - color: "White" - font.pixelSize: 20 - } - - Text { - id: timeToDest - anchors.verticalCenter: cancel.verticalCenter - anchors.right: cancel.left - anchors.rightMargin: 1/20 * contentLoader.width - text: "2 hrs 27 min" - color: "White" - font.pixelSize: 20 - } - - Image { - id: cancel - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - - source: "../res/buttons/long_oval_btn.png" - - Image { - id: destIcon - anchors.verticalCenter: parent.verticalCenter - anchors.left: cancel.left - anchors.leftMargin: Constants.fontSize - source: "../res/nav/dest_icon.png" - } - - Text { - id: cancelText - anchors.centerIn: parent - text: "Cancel" - color: Constants.primaryColor - font.pixelSize: 20 - } - - MouseArea { - anchors.fill: parent - - onPressed: { - cancel.source = "../res/buttons/long_oval_pressed_btn.png" - destIcon.source = "../res/nav/dest_icon_black.png" - cancelText.color = Constants.pressedButtonTextColor - } - - onReleased: { - cancel.source = "../res/buttons/long_oval_btn.png" - destIcon.source = "../res/nav/dest_icon.png" - cancelText.color = Constants.primaryColor - } - - onClicked: { - contentLoader.go("./views/NavigationNoRouteGridView.qml") - } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/NavigationKeyboardView.qml b/src/components/qt_hmi/qml_model_qt5/views/NavigationKeyboardView.qml deleted file mode 100644 index f5d19e7626..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/NavigationKeyboardView.qml +++ /dev/null @@ -1,221 +0,0 @@ -/** - * @file NavigationKeyboardView.qml - * @brief Navigation keyboard screen view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - id: navKeyboard - anchors.fill: parent - - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - // Text line with input text - TextInput { - id: inputText - anchors.top:parent.top - anchors.left:parent.left - maximumLength: 30 - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - text: dataContainer.routeText - } - - // Keyboard - Column { - anchors.centerIn: parent - Row { - id: upperRow - property string qWERTY : "QWERTYUIOP" - anchors.horizontalCenter: parent.horizontalCenter - - Repeater { - model: 10 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: upperRow.qWERTY.charAt(index) - pixelSize: Constants.fontSize - - onClicked: { - dataContainer.routeText += upperRow.qWERTY.charAt(index) - } - } - } - } - Row { - id: middleRow - property string aSDFGH : "ASDFGHJKL" - anchors.horizontalCenter: parent.horizontalCenter - - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "123" - pixelSize: 15 - } - //-------------- - Repeater { - model: 9 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: middleRow.aSDFGH.charAt(index) - pixelSize: Constants.fontSize - - onClicked: { - dataContainer.routeText += middleRow.aSDFGH.charAt(index) - } - } - } - //-------------- - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - onIsPressedChanged: { - hoverImg.source = isPressed ? "../res/nav/delete_icon_black.png" : "../res/nav/delete_icon.png"; - } - Image { - id: hoverImg - anchors.centerIn: parent - source: "../res/nav/delete_icon.png" - } - - onClicked: { - dataContainer.routeText = dataContainer.routeText.substring(0,dataContainer.routeText.length - 1) - } - } - } - Row { - id: lowerRow - property string zXCVBN : "ZXCVBNM" - anchors.horizontalCenter: parent.horizontalCenter - - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "!@#" - pixelSize: 15 - } - //----------------- - Repeater { - model: 7 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: lowerRow.zXCVBN.charAt(index) - pixelSize: Constants.fontSize - - onClicked: { - dataContainer.routeText += lowerRow.zXCVBN.charAt(index) - } - } - } - //---------------- - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "Clear" - pixelSize: 12 - - onClicked: { - dataContainer.routeText = "" - } - } - //---------------- - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "Space" - pixelSize: 12 - - onClicked: { - dataContainer.routeText += " " - } - } - } - - } // column - - Image { - id: goBtn - anchors.right: parent.right - anchors.top: parent.top - source: "../res/buttons/short_oval_btn.png" - - Text { - id: goText - anchors.centerIn: parent - text: "Go" - color: Constants.primaryColor - font.pixelSize: Constants.fontSize - } - - MouseArea { - anchors.fill: parent - - onPressed: { - goBtn.source = "../res/buttons/short_oval_btn_pressed.png" - goText.color = Constants.pressedButtonTextColor - } - - onReleased: { - goBtn.source = "../res/buttons/short_oval_btn.png" - goText.color = Constants.primaryColor - } - - onClicked: { - contentLoader.go("./views/NavigationInRouteGridView.qml") - } - } - } - } // 3/4 top screen - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/NavigationMenuView.qml b/src/components/qt_hmi/qml_model_qt5/views/NavigationMenuView.qml deleted file mode 100644 index 8b8b7ef261..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/NavigationMenuView.qml +++ /dev/null @@ -1,75 +0,0 @@ -/** - * @file NavigationMenuView.qml - * @brief Navigation menu screen view. - * 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. - */ - -import QtQuick 2.0 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - GridMenu { - id: menu - model: NavigationMenuModel {} - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: bottomPanel.top - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - OvalButton { - text: title - onReleased: contentLoader.go(qml) - anchors.centerIn: parent - fontSize: Constants.fontSize - } - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} - - diff --git a/src/components/qt_hmi/qml_model_qt5/views/NavigationNoRouteGridView.qml b/src/components/qt_hmi/qml_model_qt5/views/NavigationNoRouteGridView.qml deleted file mode 100644 index d4fbb9f4ef..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/NavigationNoRouteGridView.qml +++ /dev/null @@ -1,205 +0,0 @@ -/** - * @file NavigationNoRouteGridView.qml - * @brief Navigation no route screen view. - * 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. - */ - -import QtQuick 2.0 -import "../models/Constants.js" as Constants - -GeneralView { - Item { - id: navNoRoute - anchors.fill: parent - - Image { - // 3/4 top screen - id: map - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - source: "../res/nav/map.png" - - Image { - id: compas - anchors.bottom: parent.bottom - anchors.bottomMargin: 1/4 * compas.width - anchors.left: parent.left - anchors.leftMargin: 1/4 * compas.width - source: "../res/nav/compass.png" - } - - Column { - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: compas.horizontalCenter - spacing: 1/8 * parent.height - - // Zoom "+" button - Image { - id: zoomIn - source: "../res/buttons/zoom.png" - - Text { - id: zoomInBtn - anchors.centerIn: parent - text: "+" - color: "white" - font.pixelSize: Constants.fontSize - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/zoom_pressed.png" - zoomInBtn.color = Constants.pressedButtonTextColor - } - onReleased: { - parent.source = "../res/buttons/zoom.png" - zoomInBtn.color = Constants.releasedButtonTextColor - } - - onClicked: { - //Some behavior - } - } - } - - // Zoom "-" button - Image { - id: zoomOut - source: "../res/buttons/zoom.png" - - Text { - id: zoomOutBtn - anchors.centerIn: parent - text: "-" - color: "white" - font.pixelSize: Constants.fontSize - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/zoom_pressed.png" - zoomOutBtn.color = Constants.pressedButtonTextColor - } - onReleased: { - parent.source = "../res/buttons/zoom.png" - zoomOutBtn.color = Constants.releasedButtonTextColor - } - - onClicked: { - //Some behavior - } - } - } - } // column - - // Options button - Image { - id: navOptions - anchors.top: parent.top - anchors.right: parent.right - source: "../res/nav/options.png" - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/nav/options_pressed.png" - } - onReleased: { - parent.source = "../res/nav/options.png" - } - onClicked: { - //Options screen - } - } - } - } //map - - Item { - // 1/4 bottom screen - id: bottomPart - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - // Destination search button - Image { - id: destSearch - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - source: "../res/buttons/longest_oval_btn.png" - - Image { - id: destIcon - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: 15 - source: "../res/nav/dest_icon.png" - } - - Text { - id: destText - anchors.verticalCenter: parent.verticalCenter - anchors.left: destIcon.right - anchors.leftMargin: 5 - text: "Destination" - color: Constants.primaryColor - font.pixelSize: 20 - } - - MouseArea { - anchors.fill: parent - - onPressed: { - destSearch.source = "../res/buttons/longest_oval_btn_pressed.png" - destIcon.source = "../res/nav/dest_icon_black.png" - destText.color = Constants.pressedButtonTextColor - } - - onReleased: { - destSearch.source = "../res/buttons/longest_oval_btn.png" - destIcon.source = "../res/nav/dest_icon.png" - destText.color = Constants.primaryColor - } - - onClicked: { - contentLoader.go("./views/NavigationMenuView.qml") - } - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/PhoneKeyboardView.qml b/src/components/qt_hmi/qml_model_qt5/views/PhoneKeyboardView.qml deleted file mode 100644 index 4b217cf9f5..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/PhoneKeyboardView.qml +++ /dev/null @@ -1,171 +0,0 @@ -/** - * @file PhoneKeyboardView.qml - * @brief Phone keyboard screen view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -GeneralView{ - Component.onCompleted: phoneKeyboard.changeColorOfActiveButtons() - - Item { - function changeColorOfActiveButtons() { - for (var i = 0; i < contactsListModel.count; i++) { - activeButtons[contactsListModel.get(i).name[0].toUpperCase()] = true - } - } - - id: phoneKeyboard - anchors.fill: parent - - property var activeButtons: { - "A": false, "B": false, "C": false, "D": false, "E": false, - "F": false, "G": false, "H": false, "I": false, "J": false, - "K": false, "L": false, "M": false, "N": false, "O": false, - "P": false, "Q": false, "R": false, "S": false, "T": false, - "U": false, "V": false, "W": false, "X": false, "Y": false, "Z": false - } - - ContactsListModel { - id: contactsListModel - } - - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - - Column { - anchors.centerIn: parent - - Row { - id: upperRow - property string contentLoader : "ABCDEFGHI" - anchors.horizontalCenter: parent.horizontalCenter - Repeater { - model: 9 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - textColorDefault: phoneKeyboard.activeButtons[upperRow.contentLoader.charAt(index)] - ? Constants.primaryColor : Constants.inactiveButtonTextColor - text: upperRow.contentLoader.charAt(index) - pixelSize: Constants.fontSize - onIsPressedChanged: { - if (!isPressed){ - if (phoneKeyboard.activeButtons[upperRow.contentLoader.charAt(index)]) { - dataContainer.contactsFirstLetter = text - contentLoader.go("./views/ContactsListView.qml") - } - } - } - } - } - } - - Row { - id: middleRow - property string contentLoader : "JKLMNOPQR" - anchors.horizontalCenter: parent.horizontalCenter - Repeater { - model: 9 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - textColorDefault: phoneKeyboard.activeButtons[middleRow.contentLoader.charAt(index)] - ? Constants.primaryColor : Constants.inactiveButtonTextColor - text: middleRow.contentLoader.charAt(index) - pixelSize: Constants.fontSize - onIsPressedChanged: { - if (!isPressed){ - if (phoneKeyboard.activeButtons[middleRow.contentLoader.charAt(index)]) { - dataContainer.contactsFirstLetter = text - contentLoader.go("./views/ContactsListView.qml") - } - } - } - } - } - } - - Row { - id: lowerRow - property string contentLoader : "STUVWXYZ" - anchors.horizontalCenter: parent.horizontalCenter - Repeater { - model: 8 - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - textColorDefault: phoneKeyboard.activeButtons[lowerRow.contentLoader.charAt(index)] - ? Constants.primaryColor : Constants.inactiveButtonTextColor - text: lowerRow.contentLoader.charAt(index) - pixelSize: Constants.fontSize - onIsPressedChanged: { - if (!isPressed){ - if (phoneKeyboard.activeButtons[lowerRow.contentLoader.charAt(index)]) { - dataContainer.contactsFirstLetter = text - contentLoader.go("./views/ContactsListView.qml") - } - } - } - } - } - CircleButton { - imgOff: "../res/buttons/preset_btn.png" - imgOn: "../res/buttons/preset_pressed_btn.png" - text: "123" - pixelSize: 20 - } - } - } - } - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent} - } - } -} - - diff --git a/src/components/qt_hmi/qml_model_qt5/views/PhoneMenuGridView.qml b/src/components/qt_hmi/qml_model_qt5/views/PhoneMenuGridView.qml deleted file mode 100644 index 5cfdc5a309..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/PhoneMenuGridView.qml +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file PhoneMenuGridView.qml - * @brief View for phone menu. - * 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. - */ - -import QtQuick 2.0 -import "../models" -import "../controls" - -GridMenu { - id: menu - model: PhoneMenuModel {} - delegate: GridItem { - width: menu.width / menu.columnsOnPage - height: menu.height / menu.rows - ClickableImage { - anchors.centerIn: parent - source: icon - onClicked: { - if(qml !== "") { - contentLoader.go(qml) - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/PolicyAppListView.qml b/src/components/qt_hmi/qml_model_qt5/views/PolicyAppListView.qml deleted file mode 100644 index 83a223a18a..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/PolicyAppListView.qml +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @file SettingsSourceView.qml - * @brief Settings source screen view. - * 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. - */ -import QtQuick 2.0 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - Text { - id: title - text: "Permissions (choose application):" - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - height: Constants.fontSize + Constants.panelPadding - } - ScrollableListView { - id: applicationList - anchors.top: title.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - model: dataContainer.applicationList - - delegate: Item { - width: parent.width - height: Math.max(applicationName.height, appIcon.height) - Image { - id: appIcon - source: icon - height: Constants.appListIconSize - width: height - } - ClickableText { - id: applicationName - text: appName - defaultColor: Constants.primaryColor - pressedColor: Constants.primaryColorPressed - font.pixelSize: Constants.appListFontSize - anchors.verticalCenter: parent.verticalCenter - anchors.left: appIcon.right - anchors.leftMargin: Constants.margin - onClicked: { - RequestToSDL.SDL_GetListOfPermissions(appId, function(params){ - settingsContainer.getListOfPermissions_Response(appId, params) - }); - } - } - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/RadioPlayer.qml b/src/components/qt_hmi/qml_model_qt5/views/RadioPlayer.qml deleted file mode 100644 index f673327c68..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/RadioPlayer.qml +++ /dev/null @@ -1,160 +0,0 @@ -/** - * @file RadioPlayerView.qml - * @brief Parent for AM, FM, Sirius players screen view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models" -import "../models/Constants.js" as Constants - -Item { - id: radioPlayerView - - property string radioType: "" - property string radioName: "" - property alias buttonHD: bot.children - - property PlayerState playerState - - Item { - // top 3/4 screen - id: upperContent - anchors.top: parent.top - anchors.left: parent.left - height: parent.height * 3/4 - width: parent.width - - Item { - // top part for buttons - id: top - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: parent.height * 1/4 - - OvalButton { - text: radioName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - } - - OvalButton { - anchors.right: parent.right - anchors.top: parent.top - text: "Tune" - fontSize: Constants.fontSize - } - } - - Item { - // mid part for information about song - id: mid - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - width: parent.width - height: parent.height / 2 - - Column { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - - Row { - Text { - id: radioChannelNameText - color: Constants.primaryColor - text: playerState.presets[0] - font.pixelSize: 45 - } - Text { - anchors.bottom: radioChannelNameText.bottom - color: Constants.primaryColor - text: " " + radioType - font.pixelSize: 25 - } - } - - Text { - color: Constants.primaryColor - text: playerState.songName - font.pixelSize: 25 - font.bold: true - } - - Text { - color: Constants.primaryColor - text: playerState.albumName - font.pixelSize: 25 - } - } - } - - Item { - // bottom part for HD button (for FM radio) - id: bot - anchors.left: parent.left - anchors.bottom: parent. bottom - width: parent.width - height: parent.height * 1/4 - } - } - - Item { - // bottom 1/4 screen - id: lowerContent - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - // Line that divide screen in two parts - Rectangle { - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: 2 - color: Constants.primaryColor - } - - PresetRow { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - presets: playerState.presets - width: parent.width - onSelectedIndexChanged: { - radioChannelNameText.text = presets[selectedIndex]; - } - } - } -} - - diff --git a/src/components/qt_hmi/qml_model_qt5/views/SDLFunctionalityView.qml b/src/components/qt_hmi/qml_model_qt5/views/SDLFunctionalityView.qml deleted file mode 100644 index 8ac6e6d9b8..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SDLFunctionalityView.qml +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -import QtQuick 2.0 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - Item { - id: deviceList - property bool allowed: false - - function setAllowed(allowed) { - console.debug("Set allowed", allowed, deviceList.allowed); - deviceList.allowed = allowed; - for (var i = 0; i < dataContainer.deviceList.count; ++i) { - menu.model.get(i).allowed = allowed; - } - } - - anchors.fill: parent - Text { - id: title - text: "Choose devices to be allowed for SDL functionality:" - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - height: Constants.fontSize + Constants.panelPadding - } - - OvalButton { - id: allDevice - text: "All devices Not Allowed" - onClicked: { - if (parent.allowed) { - parent.setAllowed(false); - text = "All devices Not Allowed"; - } else { - parent.setAllowed(true); - text = "All devices Allowed"; - } - settingsContainer.allowSDLFunctionality(parent.allowed, undefined); - } - anchors.top: title.bottom - anchors.left: parent.left - anchors.right: parent.right - fontSize: Constants.fontSize - } - - ScrollableListView { - id: menu - model: dataContainer.deviceList - anchors.left: parent.left - anchors.right: parent.right - anchors.top: allDevice.bottom - anchors.bottom: bottomPanel.top - delegate: OvalButton { - text: (allowed) ? name + " - Allowed" : - name + " - Not allowed" - onClicked: { - var item = menu.model.get(index); - allDevice.text = "All devices manual Configuration"; - item.allowed = !item.allowed; - settingsContainer.allowSDLFunctionality(item.allowed, - {id: item.devid, - name: item.name}); - deviceList.allowed = null; - } - anchors.left: parent.left - anchors.right: parent.right - fontSize: Constants.fontSize - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/SDLNavi.qml b/src/components/qt_hmi/qml_model_qt5/views/SDLNavi.qml deleted file mode 100644 index ef98ffb10d..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SDLNavi.qml +++ /dev/null @@ -1,223 +0,0 @@ -/** - * @file SDLNavi.qml - * @brief SDL navigation screen view. - * 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. - */ - -import QtQuick 2.0 -import QtMultimedia 5.0 -import "../controls" -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common - -GeneralView { - applicationContext: true - - MultiTouchArea { - anchors.fill: parent - id: wholeWindow - - Row { - // Top items - id: topItems - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: 1/6 * parent.height - spacing: Constants.sdlNaviSpacing - - Rectangle { - anchors.top: parent.top - width: 1/5 * parent.width - height: 4/5 * parent.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - - Text { - text: dataContainer.currentApplication.hmiUIText.mainField1 - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - Rectangle { - anchors.top: parent.top - width: 3/5 * parent.width - 2 * parent.spacing - height: parent.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - - Text { - text: dataContainer.currentApplication.hmiUIText.mainField2 - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - Rectangle { - id: rightRectOfTopItems - anchors.top: parent.top - width: 1/5 * parent.width - height: 4/5 * parent.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - Text { - text: dataContainer.currentApplication.hmiUIText.mainField3 ? dataContainer.currentApplication.hmiUIText.mainField3 : "field3" - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - } - - Column { - // "+", "-" button at left - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - width: 1/12 * parent.width - height: 2/10 * parent.height + spacing - spacing: Constants.sdlNaviSpacing - - GradientRectangle { - width: parent.width - height: 1/10 * wholeWindow.height - text: "+" - isCustomButton: true - customButtonID: 3 - } - GradientRectangle { - width: parent.width - height: 1/10 * wholeWindow.height - text: "-" - isCustomButton: true - customButtonID: 4 - } - } - - Column { - anchors.right: parent.right - anchors.top: topItems.bottom - width: 1/6 * parent.width - height: 2/10 * parent.height + spacing - spacing: Constants.sdlNaviSpacing - - Rectangle { - width: parent.width - height: 1/10 * wholeWindow.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - Text { - text: "" - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - Rectangle { - width: parent.width - height: 1/10 * wholeWindow.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - Text { - text: dataContainer.currentApplication.hmiUIText.mainField4 ? dataContainer.currentApplication.hmiUIText.mainField4 : "mainField4" - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - } - - Row { - // bottom items - id: bottomItems - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/6 * parent.height - spacing: Constants.sdlNaviSpacing - - GradientRectangle { - anchors.bottom: parent.bottom - width: 1/3 * parent.width - height: parent.height - text: "Menu" - isCustomButton: true - customButtonID: 1 - } - Rectangle { - anchors.bottom: parent.bottom - width: 1/3 * parent.width - 2 * parent.spacing - height: parent.height - color: Constants.sdlNaviTransparentItemColor - radius: 5 - Text { - text: "mainField5" - anchors.fill: parent - font.pixelSize: Constants.fontSize - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } - GradientRectangle { - anchors.bottom: parent.bottom - width: 1/3 * parent.width - height: parent.height - text: "Custom Button" - isCustomButton: true - customButtonID: 2 - } - } - - GradientRectangle { - anchors.right: parent.right - anchors.bottom: bottomItems.top - anchors.bottomMargin: Constants.sdlNaviSpacing - width: 1/6 * parent.width - height: 1/10 * parent.height - text: "Options" - fontSize: Constants.fontSize - onReleased: { - contentLoader.go("./views/SDLPlayerOptionsListView.qml", dataContainer.currentApplication.appId) - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/SDLNonMediaView.qml b/src/components/qt_hmi/qml_model_qt5/views/SDLNonMediaView.qml deleted file mode 100644 index 231ab03135..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SDLNonMediaView.qml +++ /dev/null @@ -1,179 +0,0 @@ -/** - * @file SDLNonMediaView.qml - * @brief SDL non media screen view. - * 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. - */ - - -import QtQuick 2.0 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal -import "../hmi_api/Common.js" as Common - -GeneralView { - applicationContext: true - - Item { - id: upperContent - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - - Item { - id: topButtonRow - // top 1/4 of screen - width: parent.width - height: 1/4 * parent.height - - PagedFlickable { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - elementWidth: Constants.ovalButtonWidth - spacing: (width - 4 * elementWidth) / 3 - snapTo: elementWidth + spacing - - OvalButton { - text: "Options" - onClicked: { contentLoader.go("./views/SDLPlayerOptionsListView.qml") } - } - - Repeater { - model: dataContainer.currentApplication.softButtons ? - dataContainer.currentApplication.softButtons.count : - 0 - delegate: - SoftButton { - appId: dataContainer.currentApplication.appId - button: dataContainer.currentApplication.softButtons.get(index) - } - } - } - } - - Column { - id: midContent - height: parent.height * 3/4 - width: parent.width - anchors.top: topButtonRow.bottom - anchors.left: parent.left - - Text { - id: deviceName - width: parent.width - height: 1/5 * parent.height - text: "Device: " + dataContainer.currentApplication.deviceName - verticalAlignment: Text.AlignVCenter - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - Row { - width: parent.width - height: 4/5 * parent.height - spacing: Constants.margin - - Image { - id: image - height: parent.height - width: height - source: dataContainer.currentApplication.hmiUIText.image - } - - Column { - height: parent.height - width: parent.width - image.width - parent.spacing - spacing: Constants.margin - - Text { - id: text1 - width: parent.width - verticalAlignment: Text.AlignVCenter - horizontalAlignment: dataContainer.currentApplication.hmiUITextAlignment - text: dataContainer.currentApplication.hmiUIText.mainField1 - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - Text { - width: parent.width - verticalAlignment: Text.AlignVCenter - horizontalAlignment: dataContainer.currentApplication.hmiUITextAlignment - text: dataContainer.currentApplication.hmiUIText.mainField2 - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - } - } - } - } - - Item { - // bottom 1/4 screen - id: lowerContent - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: parent.height * 1/4 - - PresetRow { - id: presetsRow - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - presets: Internal.getArrayForPresetRow(dataContainer.currentApplication) - width: parent.width - property bool clickProcessed - - onPresetButtonPressed: { - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonEventMode.BUTTONDOWN, undefined) - } - - onPresetButtonReleased: { - sdlButtons.onButtonEvent(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonEventMode.BUTTONUP, undefined) - } - - onPresetButtonClicked: { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonPressMode.SHORT, undefined) - } - - onPresetButtonHold: { - sdlButtons.onButtonPress(Common.ButtonName.PRESET_0 + selectedIndex, Common.ButtonPressMode.LONG, undefined) - } - } - } - - StatusBar { - anchors.left: parent.left - anchors.bottom: parent.bottom - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/SDLPlayerOptionsListView.qml b/src/components/qt_hmi/qml_model_qt5/views/SDLPlayerOptionsListView.qml deleted file mode 100644 index e249a5eb76..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SDLPlayerOptionsListView.qml +++ /dev/null @@ -1,121 +0,0 @@ -/** - * @file SDLPlayerOptionsListView.qml - * @brief SDL player options screen view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models/Internal.js" as Internal - -GeneralView { - applicationContext: true - systemContext: Common.SystemContext.SYSCTXT_MENU - Item { - // 3/4 top screen - height: parent.height * 3/4 - width: parent.width - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - - ListView { - id: sdlPlayerOptionsListView - anchors.horizontalCenter: parent.horizontalCenter - width:parent.width - height:parent.height - - model: dataContainer.currentApplication.currentSubMenu - - delegate: Row { - spacing: Constants.iconItemListSpacing - Icon { - source: model.icon - width: Constants.iconItemListSize - height: Constants.iconItemListSize - - MouseArea { - anchors.fill: parent - enabled: model.icon.value !== undefined - - onPressed: text.press() - onReleased: text.release() - onCanceled: text.release() - onClicked: text.click() - } - } - - ClickableText { - id: text - text: name + (type === Internal.MenuItemType.MI_SUBMENU ? " >" : "") - width: sdlPlayerOptionsListView.width - x - elide: Text.ElideRight - defaultColor: type === Internal.MenuItemType.MI_PARENT ? - Constants.inactiveButtonTextColor : - Constants.primaryColor - pressedColor: type === Internal.MenuItemType.MI_PARENT ? - Constants.inactiveButtonTextColorPressed : - Constants.primaryColorPressed - font.pixelSize: Constants.titleFontSize - - function click() { - console.debug("enter") - switch (type) { - case Internal.MenuItemType.MI_NODE: - sdlUI.onCommand(model.id, dataContainer.currentApplication.appId) - contentLoader.back() - dataContainer.currentApplication.currentSubMenu = dataContainer.currentApplication.options - break; - case Internal.MenuItemType.MI_SUBMENU: - case Internal.MenuItemType.MI_PARENT: - dataContainer.currentApplication.currentSubMenu = subMenu - break; - } - console.debug("exit") - } - onClicked: click() - } - } - } - } - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - BackButton { anchors.centerIn: parent } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/SDLPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/SDLPlayerView.qml deleted file mode 100644 index 4fff5aa826..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SDLPlayerView.qml +++ /dev/null @@ -1,79 +0,0 @@ -/** - * @file SDLPlayerView.qml - * @brief SDL player screen view. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -GeneralView { - applicationContext: true - MediaPlayer { - id: mediaPlayer - onPlay: { sdlButtons.onButtonPress(Common.ButtonName.OK, Common.ButtonPressMode.SHORT, undefined) } - onPause: { sdlButtons.onButtonPress(Common.ButtonName.OK, Common.ButtonPressMode.SHORT, undefined) } - playerName: "SDL music" - playerType: "SDL" - image: dataContainer.currentApplication.hmiUIText.image - anchors.fill: parent - - buttons: [ - OvalButton { - text: dataContainer.currentApplication.appName - onReleased: { contentLoader.go("./views/MusicSourceView.qml") } - }, - - OvalButton { - text: "SDL Menu" - onReleased: { contentLoader.go("./views/ApplicationListView.qml") } - }, - - OvalButton { - text: "Options" - onReleased: { contentLoader.go("./views/SDLPlayerOptionsListView.qml") } - }, - - Repeater { - model: dataContainer.currentApplication.softButtons ? - dataContainer.currentApplication.softButtons.count : - 0 - - delegate: SoftButton { - appId: dataContainer.currentApplication.appId - button: dataContainer.currentApplication.softButtons.get(index) - } - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml b/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml deleted file mode 100644 index 0dcb7a3b32..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/ScrollableMessageView.qml +++ /dev/null @@ -1,181 +0,0 @@ -/** - * @file ScrollableMessageView.qml - * @brief Scrollable Message View. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../hmi_api/Async.js" as Async -import "../models/Constants.js" as Constants -import "../models" -import "../popups" - -GeneralView { - applicationContext: true - systemContext: Common.SystemContext.SYSCTXT_HMI_OBSCURED - onLeaveScreen: { - timer.stop() - dataContainer.scrollableMessageModel.running = false - DBus.sendReply(dataContainer.scrollableMessageModel.async, { __retCode: dataContainer.scrollableMessageModel.result }) - } - Component.onCompleted: { - dataContainer.scrollableMessageModel.result = Common.Result.ABORTED - dataContainer.scrollableMessageModel.running = true - timer.start() - } - - Timer { - id: timer - interval: dataContainer.scrollableMessageModel.timeout - onTriggered: { - dataContainer.scrollableMessageModel.result = Common.Result.SUCCESS - contentLoader.back() - } - } - - Rectangle { - anchors.fill: parent - color: Constants.secondaryColor - - Item { - // top 1/5 of screen - id: top - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: dataContainer.scrollableMessageModel.softButtons.count > 0 ? parent.height * 1/5 : 1 - - PagedFlickable { - id: flickRow - width: top.width - spacing: (width - elementWidth * 4) / 3 - snapTo: Constants.ovalButtonWidth + spacing - elementWidth: Constants.ovalButtonWidth - Repeater { - model: dataContainer.scrollableMessageModel.softButtons ? - dataContainer.scrollableMessageModel.softButtons.count : - 0 - delegate: - SoftButton { - appId: dataContainer.scrollableMessageModel.appId - button: dataContainer.scrollableMessageModel.softButtons.get(index) - onKeepContext: { timer.restart() } - onDefaultAction: { - dataContainer.scrollableMessageModel.result = Common.Result.ABORTED - contentLoader.back() - } - onStealFocus: { - dataContainer.scrollableMessageModel.result = Common.Result.SUCCESS - contentLoader.back() - } - } - } - } - } - - Item { - id: middle - anchors.top: top.bottom - anchors.left: parent.left - anchors.bottom: bottom.top - width: parent.width - clip: true - - Flickable { - id:flickable - anchors.fill: middle - flickableDirection: Flickable.VerticalFlick - contentWidth: longMessageText.width - contentHeight: longMessageText.height - clip: true - - Text { - id: longMessageText - wrapMode: Text.Wrap - width: middle.width - text: dataContainer.scrollableMessageModel.longMessageText - color: Constants.scrollableMessageTextColor - font.pixelSize: Constants.fontSize - } - } - Rectangle { - id: scrollbar - anchors.right: flickable.right - y: flickable.visibleArea.yPosition * flickable.height - width: Constants.scrollableMessageScrollBarWidth - height: flickable.visibleArea.heightRatio * flickable.height - visible: !(flickable.visibleArea.heightRatio > 1) - color: Constants.scrollableMessageScrollBarColor - } - } - Item { - // 1/5 bottom screen - id: bottom - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/5 * parent.height - OvalButton { - anchors.centerIn: parent - text: "Close" - onClicked: { - dataContainer.scrollableMessageModel.result = Common.Result.ABORTED - contentLoader.back() - } - } - } - } - /** - * Test Support Section - * - */ - function getTimer(){ - return timer - } - function getSoftButtonsListView(){ - return softButtons - } - function getScrollbar(){ - return scrollbar - } - function getTextArea(){ - return middle - } - function getBackButton(){ - return backButton - } - - /** - * Test Support Section End - */ -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/SettingsSourceView.qml b/src/components/qt_hmi/qml_model_qt5/views/SettingsSourceView.qml deleted file mode 100644 index fa0bfbc821..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SettingsSourceView.qml +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @file SettingsSourceView.qml - * @brief Settings source screen view. - * 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. - */ -import QtQuick 2.0 -import "../models" -import "../controls" -import "../models/Constants.js" as Constants - -GeneralView { - signal itemActivated(string item) - - onItemActivated: { - switch (item) { - case "update_sdl": RequestToSDL.SDL_UpdateSDL(settingsContainer.updateStatus); break; - case "get_status_update": RequestToSDL.SDL_GetStatusUpdate(settingsContainer.updateStatus); break; - case "get_urls": RequestToSDL.SDL_GetURLS(0, settingsContainer.startPTExchange); break; - } - } - - Item { - anchors.fill: parent - ScrollableListView { - id: menu - model: dataContainer.settingsSourceModel - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: bottomPanel.top - delegate: OvalButton { - text: title - onReleased: { - if (qml) { - contentLoader.go(qml, appId); - } else { - itemActivated(action); - } - } - anchors.left: parent.left - anchors.right: parent.right - fontSize: Constants.fontSize - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} - - - diff --git a/src/components/qt_hmi/qml_model_qt5/views/SimulationView.qml b/src/components/qt_hmi/qml_model_qt5/views/SimulationView.qml deleted file mode 100644 index b79cddf8cf..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SimulationView.qml +++ /dev/null @@ -1,293 +0,0 @@ -/** - * @file SimulationView.qml - * @brief Area of screen responsible for simulation actions - * 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. - */ - -import QtQuick 2.0 -import QtQuick.Controls 1.0 -import QtQuick.Controls.Styles 1.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../views" -import "../popups" -import "../models/Constants.js" as Constants - -Rectangle { - width: controlArea.width + controlArea.anchors.margins - anchors.top: parent.top - anchors.bottom: parent.bottom - color: Constants.panelColor - - Item { - id: showArea - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - height: parent.height - (controlArea.childrenRect.height + controlArea.anchors.margins) - - ExitAllApplicationsPopup { - id: exitAllApplicationsPopup - anchors.fill: parent - visible: false - } - - VehicleInfoPopUp { - id: viPopUp - anchors.fill: parent - } - - TBTClientStatePopUp { - id: tbtClientStatePopUp - anchors.fill: parent - visible: false - } - } - - Item { - id: controlArea - anchors.bottom: parent.bottom - anchors.margins: Constants.panelPadding - anchors.horizontalCenter: parent.horizontalCenter - width: table.width - - ListModel { - id: languagesList - - Component.onCompleted: { - for (var name in Common.Language) { - if (settingsContainer.sdlLanguagesList.indexOf(Common.Language[name]) != -1) { - append({name: name.replace('_', '-')}); - } - } - } - } - - Text { - id: label - text: "Languages" - color: Constants.panelTextColor - anchors.bottom: table.top - anchors.horizontalCenter: parent.horizontalCenter - } - - Grid { - id: table - spacing: 5 - columns: 2 - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: globalProperties.top - - Text { - text: "HMI UI" - color: Constants.panelTextColor - } - - Text { - text: "HMI TTS + VR" - color: Constants.panelTextColor - } - - ComboBox { - width: table.width / table.columns - table.spacing - model: languagesList - onCurrentIndexChanged: { - dataContainer.hmiUILanguage = settingsContainer.sdlLanguagesList[currentIndex]; - sdlUI.onLanguageChange(dataContainer.hmiUILanguage); - } - z: 1000 - } - - ComboBox { - width: table.width / table.columns - table.spacing - model: languagesList - onCurrentIndexChanged: { - dataContainer.hmiTTSVRLanguage = settingsContainer.sdlLanguagesList[currentIndex]; - sdlTTS.onLanguageChange(dataContainer.hmiTTSVRLanguage); - sdlVR.onLanguageChange(dataContainer.hmiTTSVRLanguage); - } - z: 1000 - } - - Text { - text: "Application UI" - color: Constants.panelTextColor - } - - Text { - text: "Application TTS + VR" - color: Constants.panelTextColor - } - - Text { - id: uiLanguageLabel - color: Constants.panelTextColor - text: " " - Connections { - target: dataContainer - onCurrentApplicationChanged: { - for (var s in Common.Language) { - if (Common.Language[s] === dataContainer.currentApplication.hmiDisplayLanguageDesired) { - uiLanguageLabel.text = s; - } - } - } - } - } - - Text { - id: ttsLanguageLabel - color: Constants.panelTextColor - text: " " - Connections { - target: dataContainer - onCurrentApplicationChanged: { - for (var s in Common.Language) { - if (Common.Language[s] === dataContainer.currentApplication.languageTTSVR) { - ttsLanguageLabel.text = s; - } - } - } - } - } - - PushButton { - id: vehicleInfo - label: "Vehicle info" - toggleMode: true - onPressed: { - viPopUp.show(); - } - onUnpressed: { - viPopUp.hide(); - } - } - - PushButton { - id: tbtClientState - label: "TBT Client state" - toggleMode: true - onPressed: { - tbtClientStatePopUp.show(); - } - onUnpressed: { - tbtClientStatePopUp.hide(); - } - } - - PushButton { - label: "Exit application" - onClicked: { - if (dataContainer.applicationContext) { - sdlBasicCommunication.onExitApplication(dataContainer.currentApplication.appId) - } - } - } - - PushButton { - id: exitAllAppsButton - label: "Exit all apps" - toggleMode: true - onPressed: { - exitAllApplicationsPopup.show() - - } - onUnpressed: { - exitAllApplicationsPopup.hide() - } - Connections { - target: exitAllApplicationsPopup - onVisibleChanged: { - if (!exitAllApplicationsPopup.visible) { - exitAllAppsButton.state = "unpressed" - } - } - } - } - - CheckBox { - style: CheckBoxStyle { - label: Text { - color: Constants.panelTextColor - text: "Use URL" - } - } - } - - CheckBox { - style: CheckBoxStyle { - label: Text { - color: Constants.panelTextColor - text: "DD" - } - } - onClicked: { - if (checked) { - dataContainer.driverDistractionState = - Common.DriverDistractionState.DD_ON; - } else { - dataContainer.driverDistractionState = - Common.DriverDistractionState.DD_OFF; - } - } - } - } - - Rectangle { - id: globalProperties - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: listGlobalProperties.height + Constants.panelPadding - border.color: Constants.panelTextColor - border.width: 1 - color: Constants.panelColor - Column { - id: listGlobalProperties - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.panelPadding / 4 - Text { - text: "HELP_PROMPT: " + dataContainer.currentApplication.helpPrompt - color: Constants.panelTextColor - } - Text { - text: "TIMEOUT_PROMPT: " + dataContainer.currentApplication.timeoutPrompt - color: Constants.panelTextColor - } - Text { - text: "AUTOCOMPLETE_TEXT: " // TODO(ALeshin): Function didn' realized yet - color: Constants.panelTextColor - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/SiriusPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/SiriusPlayerView.qml deleted file mode 100644 index e5d2149542..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SiriusPlayerView.qml +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file SiriusPlayerView.qml - * @brief Sirius player screen view. - * 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. - */ -import QtQuick 2.0 -import "../controls" - -GeneralView { - RadioPlayer { - id: siriusRadioPlayer - anchors.fill: parent - radioType: "" - radioName: "Sirius" - - playerState: dataContainer.siriusPlayerState - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/StatisticsInfoView.qml b/src/components/qt_hmi/qml_model_qt5/views/StatisticsInfoView.qml deleted file mode 100644 index 75f76249d5..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/StatisticsInfoView.qml +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -import QtQuick 2.0 -import "../models" -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - Text { - id: title - text: "Statistics Info:" - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - height: Constants.fontSize + Constants.panelPadding - } - - ScrollableListView { - id: menu - model: statisticsTypeList - anchors.left: parent.left - anchors.right: parent.right - anchors.top: title.bottom - anchors.bottom: bottomPanel.top - delegate: OvalButton { - text: name - onClicked: sdlSDL.addStatisticsInfo(Common.StatisticsType[name]); - anchors.left: parent.left - anchors.right: parent.right - fontSize: Constants.fontSize - } - } - - ListModel { - id: statisticsTypeList - - Component.onCompleted: { - for (var name in Common.StatisticsType) { - append({name: name}); - } - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/SystemErrorView.qml b/src/components/qt_hmi/qml_model_qt5/views/SystemErrorView.qml deleted file mode 100644 index 058282ae00..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SystemErrorView.qml +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -import QtQuick 2.0 -import "../models" -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - Text { - id: title - text: "System Error:" - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - height: Constants.fontSize + Constants.panelPadding - } - - ScrollableListView { - id: menu - model: systemErrorList - anchors.left: parent.left - anchors.right: parent.right - anchors.top: title.bottom - anchors.bottom: bottomPanel.top - delegate: OvalButton { - text: name - onClicked: sdlSDL.onSystemError(Common.SystemError[name]); - anchors.left: parent.left - anchors.right: parent.right - fontSize: Constants.fontSize - } - } - - ListModel { - id: systemErrorList - - Component.onCompleted: { - for (var name in Common.SystemError) { - append({name: name}); - } - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/SystemRequestView.qml b/src/components/qt_hmi/qml_model_qt5/views/SystemRequestView.qml deleted file mode 100644 index 32a3987e74..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/SystemRequestView.qml +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2014, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -import QtQuick 2.0 -import "../models" -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants - -GeneralView { - Item { - anchors.fill: parent - Text { - id: title - text: "System Request:" - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - height: Constants.fontSize + Constants.panelPadding - } - - ScrollableListView { - id: menu - model: requestTypeList - anchors.left: parent.left - anchors.right: parent.right - anchors.top: title.bottom - anchors.bottom: bottomPanel.top - delegate: OvalButton { - text: name - onClicked: settingsContainer.systemRequest(Common.RequestType[name]); - anchors.left: parent.left - anchors.right: parent.right - fontSize: Constants.fontSize - } - } - - ListModel { - id: requestTypeList - - Component.onCompleted: { - for (var name in Common.RequestType) { - append({name: name}); - } - } - } - - Item { - id: bottomPanel - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - - BackButton { anchors.centerIn: parent } - } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/TurnByTurnView.qml b/src/components/qt_hmi/qml_model_qt5/views/TurnByTurnView.qml deleted file mode 100644 index a69a86a40a..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/TurnByTurnView.qml +++ /dev/null @@ -1,202 +0,0 @@ -/** - * @file TurnByTurnView.qml - * @brief View for TurnByTurn. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../models" - -GeneralView { - applicationContext: true - - Item { - id: turnByTurnView - anchors.fill: parent - - Item { - // top 3/4 of screen - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: parent.height * 3/4 - - Item { - // row of oval buttons - id: ovalButtonsRow - anchors.top: parent.top - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - - PagedFlickable { - id: buttonsRow - width: parent.width - spacing: (width - 4 * elementWidth) / 3 - anchors.verticalCenter: parent.verticalCenter - snapTo: Constants.ovalButtonWidth + spacing - elementWidth: Constants.ovalButtonWidth - - OvalButton { - id: turnListButton - text: "TurnList" - onClicked: { - console.log("Go to TurnListView"); - contentLoader.go("./views/TurnListView.qml"); - } - } - - Repeater { - model: dataContainer.currentApplication.navigationSoftButtons ? - dataContainer.currentApplication.navigationSoftButtons.count : - 0 - delegate: - SoftButton { - appId: dataContainer.currentApplication.appId - button: dataContainer.currentApplication.navigationSoftButtons.get(index) - } - } - } - } - - Column { - // Picture + text information + media clock - id: mediaContent - width: parent.width - height: 3/4 * parent.height - anchors.left: parent.left - anchors.top: ovalButtonsRow.bottom - - Row { - // picture + text info - width: parent.width - height: 3/4 * parent.height - spacing: Constants.margin - - Icon { - id: image - height: parent.height - width: height - source: dataContainer.currentApplication.navigationModel.turnIcon - } - - Column { - // text info - id: textInfo - height: parent.height - width: parent.width - image.width - parent.spacing - spacing: (height - 5 * navText1.height) / 4 - - Text { - id: navText1 - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: dataContainer.currentApplication.navigationModel.text1 - font.pixelSize: Constants.fontSize - visible: dataContainer.currentApplication.navigationModel.text1 - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: dataContainer.currentApplication.navigationModel.text2 - font.pixelSize: Constants.fontSize - visible: dataContainer.currentApplication.navigationModel.text2 - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: "Total distance: " + dataContainer.currentApplication.navigationModel.totalDistance - font.pixelSize: Constants.fontSize - visible: dataContainer.currentApplication.navigationModel.totalDistance - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: "Time to destination: " + dataContainer.currentApplication.navigationModel.timeToDestination - font.pixelSize: Constants.fontSize - visible: dataContainer.currentApplication.navigationModel.timeToDestination - } - - Text { - anchors.left: parent.left - anchors.right: parent.right - color: Constants.primaryColor - text: "ETA: " + dataContainer.currentApplication.navigationModel.eta - font.pixelSize: Constants.fontSize - visible: dataContainer.currentApplication.navigationModel.eta - } - } - } - - Row { - anchors.horizontalCenter: parent.horizontalCenter - height: 1/4 * parent.height - width: 2/3 * parent.width - - Rectangle { - id: coveredDistance - anchors.verticalCenter: parent.verticalCenter - height: Constants.distanceBarHeight - width: dataContainer.currentApplication.navigationModel.distanceToManeuver / - dataContainer.currentApplication.navigationModel.distanceToManeuverScale * parent.width - color: "white" - } - - Rectangle { - anchors.verticalCenter: parent.verticalCenter - height: Constants.distanceBarHeight - width: parent.width - coveredDistance.width - color: Constants.primaryColor - } - } - } - } - } - - Item { - // 1/4 bottom screen - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - BackButton { anchors.centerIn: parent } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/TurnListView.qml b/src/components/qt_hmi/qml_model_qt5/views/TurnListView.qml deleted file mode 100644 index bdd0b3d6cf..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/TurnListView.qml +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @file TurnListView.qml - * @brief View for TurnByTurn list. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models/Constants.js" as Constants -import "../hmi_api/Common.js" as Common - -GeneralView { - applicationContext: true - - Item { - anchors.left: parent.left - anchors.top: parent.top - width: parent.width - height: 3/4 * parent.height - - Item { - id: sotfButtons - width: parent.width - height: 1/4 * parent.height - - PagedFlickable { - anchors.verticalCenter: parent.verticalCenter - width: parent.width - elementWidth: Constants.ovalButtonWidth - snapTo: elementWidth + spacing - spacing: (width - 4 * elementWidth) / 3 - - Repeater { - model: dataContainer.currentApplication.turnListSoftButtons ? - dataContainer.currentApplication.turnListSoftButtons.count : - 0 - delegate: - SoftButton { - appId: dataContainer.currentApplication.appId - button: dataContainer.currentApplication.turnListSoftButtons.get(index) - } - } - } - } - - ScrollableListView { - id: scrollableList - anchors.top: sotfButtons.bottom - anchors.left: parent.left - width: parent.width - height: 3/4 * parent.height - - model: dataContainer.currentApplication.turnList - - delegate: - ListItem { - width: scrollableList.width - height: Constants.iconItemListSize - text: dataContainer.currentApplication.turnList.get(index).navigationText.fieldText - fontSize: Constants.fontSize - icon: dataContainer.currentApplication.turnList.get(index).turnIcon - } - } - } - - Item { - // 1/4 bottom screen - id: back - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - BackButton { anchors.centerIn: parent } - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/UsbPlayerView.qml b/src/components/qt_hmi/qml_model_qt5/views/UsbPlayerView.qml deleted file mode 100644 index f8a2d39806..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/UsbPlayerView.qml +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file UsbPlayerView.qml - * @brief USB player screen view. - * 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. - */ -import QtQuick 2.0 -import "../hmi_api/Common.js" as Common -import "../models/Constants.js" as Constants -import "../controls" - -GeneralView { - category: Common.DeactivateReason.AUDIO - MediaPlayer { - id: usbPlayer - playerName: "USB" - anchors.fill: parent - playerState: dataContainer.usbPlayerState - image: playerState.albumImage - - buttons: [ - OvalButton { - text: usbPlayer.playerName - onReleased: contentLoader.go("./views/MusicSourceView.qml") - fontSize: Constants.fontSize - }, - - OvalButton { - text: "Browse" - fontSize: Constants.fontSize - } - ] - } -} diff --git a/src/components/qt_hmi/qml_model_qt5/views/WarningInfo.qml b/src/components/qt_hmi/qml_model_qt5/views/WarningInfo.qml deleted file mode 100644 index 6228b63c79..0000000000 --- a/src/components/qt_hmi/qml_model_qt5/views/WarningInfo.qml +++ /dev/null @@ -1,135 +0,0 @@ -/** - * @file WarningInfo.qml - * @brief Screen with warning information. - * 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. - */ - -import QtQuick 2.0 -import "../controls" -import "../models/Constants.js" as Constants - -Rectangle { - id: warningInfo - anchors.fill: parent - color: Constants.secondaryColor - Text { - anchors.top: parent.top - anchors.left: parent.left - height: 1/4 * parent.height - width: parent.width - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - text: "WARNING!" - color: Constants.warningColor - font.pixelSize: Constants.titleFontSize - font.bold: true - style: Text.Raised - styleColor: "gray" - } - - Text { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.right: parent.right - anchors.margins: Constants.margin - height: 1/2 * parent.height - width: parent.width - verticalAlignment: Text.AlignVCenter - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - - text: "This application is intended to be used as a demonstrative aid only, " - + "while the vehicle is parked. Don't use it while driving. <br /><br />" - + "Use extreme caution when using any device that takes your attention off the road. " - + "Ford recommends against the use of any hand-held device while driving and that you comply " - + "with all applicable laws. Your primary responsibility is the safe operation of the vehicle." - color: "white" - font.pixelSize: 25 - font.bold: true - } - - function showOkButton() { - okButtonAnimation.start() - } - - Item { - id: ok - anchors.bottom: parent.bottom - anchors.left: parent.left - width: parent.width - height: 1/4 * parent.height - opacity: 0 - - SequentialAnimation - { - id: okButtonAnimation - // Decrease this value while debugging - PauseAnimation { duration: Constants.warningScreenDuration } - NumberAnimation { - target: ok - duration: Constants.animationDuration - property: "opacity" - from: 0; to: 1; - } - } - - Image { - id: okButton - anchors.centerIn: parent - source: "../res/buttons/longest_oval_btn.png" - - Text { - id: text - anchors.centerIn: parent - text: "OK" - font.pixelSize: Constants.fontSize - color: Constants.primaryColor - } - - MouseArea { - anchors.fill: parent - onPressed: { - parent.source = "../res/buttons/longest_oval_btn_pressed.png" - text.color = Constants.secondaryColor - } - onReleased: { - parent.source = "../res/buttons/longest_oval_btn.png" - text.color = Constants.primaryColor - } - onClicked: { - console.log("WarningInfo OkButton - on clicked enter"); - warningInfo.visible = false - } - } - } - } -} diff --git a/src/components/qt_hmi/qml_plugins/CMakeLists.txt b/src/components/qt_hmi/qml_plugins/CMakeLists.txt deleted file mode 100644 index 6ff595315c..0000000000 --- a/src/components/qt_hmi/qml_plugins/CMakeLists.txt +++ /dev/null @@ -1,41 +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. - -# --- DBus plugin -add_subdirectory(./dbus_adapter) - -# --- Hmi Framework plugin -add_subdirectory(./hw_buttons) - -# --- Log4cxx plugin -add_subdirectory(./log4cxx) - -# --- NamedPipeNotifier plugin -add_subdirectory(./named_pipe_notifier) diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/CMakeLists.txt b/src/components/qt_hmi/qml_plugins/dbus_adapter/CMakeLists.txt deleted file mode 100644 index 53d1144356..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/CMakeLists.txt +++ /dev/null @@ -1,164 +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. - -cmake_minimum_required(VERSION 2.8.11) - -set(components_dir ${CMAKE_CURRENT_SOURCE_DIR}/../../..) -set(dbus_dir ${components_dir}/dbus) -set(codegen_dir ${dbus_dir}/codegen) -set(codegen ${codegen_dir}/make_qml_dbus_cpp.py) -set(codegen_request_to_sdl ${codegen_dir}/make_request_to_sdl.py) -set(codegen_hmi_requests ${codegen_dir}/make_hmi_requests.py) -set(codegen_notification_qml ${codegen_dir}/make_notifications_qml.py) -set(parser ${codegen_dir}/ford_xml_parser.py) -set(interfaces_dir ${components_dir}/interfaces) -set(api_xml ${interfaces_dir}/QT_HMI_API.xml) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qml_dbus.cc ${CMAKE_CURRENT_BINARY_DIR}/qml_dbus.h - COMMAND python ${codegen} --infile ${api_xml} --version ${qt_version} --outdir ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${api_xml} ${codegen} ${parser} - COMMENT "Generating files: - ${CMAKE_CURRENT_BINARY_DIR}/qml_dbus.cc - ${CMAKE_CURRENT_BINARY_DIR}/qml_dbus.h - from: - ${api_xml} ..." -) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/request_to_sdl.cc ${CMAKE_CURRENT_BINARY_DIR}/request_to_sdl.h - COMMAND python ${codegen_request_to_sdl} --infile ${api_xml} --version ${qt_version} --outdir ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${api_xml} ${codegen_request_to_sdl} ${parser} - COMMENT "Generating files: - ${CMAKE_CURRENT_BINARY_DIR}/request_to_sdl.cc - ${CMAKE_CURRENT_BINARY_DIR}/request_to_sdl.h - from: - ${api_xml} ..." -) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hmi_requests.cc ${CMAKE_CURRENT_BINARY_DIR}/hmi_requests.h - COMMAND python ${codegen_hmi_requests} --infile ${api_xml} --version ${qt_version} --outdir ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${api_xml} ${codegen_hmi_requests} ${parser} - COMMENT "Generating files: - ${CMAKE_CURRENT_BINARY_DIR}/hmi_requests.cc - ${CMAKE_CURRENT_BINARY_DIR}/hmi_requests.h - from: - ${api_xml} ..." -) -add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sdl_proxy.cc ${CMAKE_CURRENT_BINARY_DIR}/sdl_proxy.h - COMMAND python ${codegen_notification_qml} --infile ${api_xml} --version ${qt_version} --outdir ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS ${api_xml} ${codegen_notification_qml} ${parser} - COMMENT "Generating files: - ${CMAKE_CURRENT_BINARY_DIR}/sdl_proxy.cc - ${CMAKE_CURRENT_BINARY_DIR}/sdl_proxy.h - from: - ${api_xml} ..." -) - -set(target DbusAdapter) -set(destination com/ford/sdl/hmi/dbus_adapter) -set(install_destination bin/hmi/plugins/${destination}) -set(library_name ${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}) - -set(CMAKE_AUTOMOC ON) -set(SOURCES - dbus_plugin.cc - ${CMAKE_CURRENT_BINARY_DIR}/qml_dbus.cc - moc_qml_dbus.cpp - sdl_proxy.cc - moc_sdl_proxy.cpp - hmi_proxy.cc - stream_qvariant.cc - moc_qml_dbus.cpp - dbus_controller.cc - request_to_sdl.cc - moc_request_to_sdl.cpp - hmi_requests.cc - moc_hmi_requests.cpp -) -include_directories( - ${LOG4CXX_INCLUDE_DIRECTORY} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_BINARY_DIR}/src/components - ${CMAKE_SOURCE_DIR}/src/components/utils/include/ -) - -add_library(${target} SHARED ${SOURCES}) - -if (${qt_version} MATCHES "4.8.5") - qt4_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/hmi_requests.h moc_hmi_requests.cpp) - qt4_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/request_to_sdl.h moc_request_to_sdl.cpp) - qt4_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/qml_dbus.h moc_qml_dbus.cpp) - qt4_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/sdl_proxy.h moc_sdl_proxy.cpp) - qt4_use_modules(${target} Core DBus Declarative) - set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt4/) - set(copy_destination ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt4/${destination}) -elseif (${qt_version} MATCHES "5.1.0") - qt5_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/hmi_requests.h moc_hmi_requests.cpp) - qt5_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/request_to_sdl.h moc_request_to_sdl.cpp) - qt5_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/qml_dbus.h moc_qml_dbus.cpp) - qt5_generate_moc(${CMAKE_CURRENT_BINARY_DIR}/sdl_proxy.h moc_sdl_proxy.cpp) - qt5_use_modules(${target} Core DBus Qml) - set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt5/) - set(copy_destination ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt5/${destination}) -endif () - -target_link_libraries(${target} log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) -target_link_libraries(${target} Utils) - -add_custom_target(copy_library_${target} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/${library_name} - ${copy_destination} - DEPENDS ${target} - COMMENT "Copying library ${library_name}") -file(COPY qmldir DESTINATION ${copy_destination}) - -install(TARGETS ${target} - DESTINATION ${install_destination} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE -) -install(FILES qmldir DESTINATION ${install_destination}) - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - add_custom_target(qmltypes_${target} ALL - COMMAND ${qmlplugindump_binary} -nonrelocatable com.ford.sdl.hmi.dbus_adapter 1.0 ${model_dir} > ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes 2>/dev/null || true - DEPENDS copy_library_${target} - ) - add_custom_target(copy_qmltypes_${target} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes - ${copy_destination} - DEPENDS qmltypes_${target} - ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes DESTINATION ${install_destination}) -endif () diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_controller.cc b/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_controller.cc deleted file mode 100644 index 60f07783a9..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_controller.cc +++ /dev/null @@ -1,95 +0,0 @@ -/* - * \file dbus_controller.cpp - * \brief DbusController class. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "dbus_controller.h" -#include "interfaces/QT_HMI_API.h" -#include <QtDBus/QDBusConnection> - -DBusController::DBusController(QObject* parent) - : QObject(parent), message(NULL) {} - -void DBusController::addMessage(const QDBusMessage& message, - fillRoutine fill, - int async_uid) { - delayedReply reply; - reply.message = message; - reply.fill = fill; - replies_[async_uid] = reply; -} - -void DBusController::sendReply(QVariant asyncObject, QVariant data) { - int uid = asyncObject.toMap()["__async_uid"].toInt(); - std::map<int, delayedReply>::iterator it = replies_.find(uid); - if (it != replies_.end()) { - QDBusMessage msg = it->second.message.createReply(); - if (!it->second.fill(msg, data.toMap())) { - QDBusConnection::sessionBus().send(it->second.message.createErrorReply( - QDBusError::InternalError, - QString::number(hmi_apis::Common_Result::INVALID_DATA))); - } else { - QDBusConnection::sessionBus().send(msg); - } - replies_.erase(it); - } -} - -void DBusController::sendReply(QVariant data) { - if (!message) - return; - QDBusMessage msg = message->createReply(); - if (!fill(msg, data.toMap())) { - QDBusConnection::sessionBus().send(message->createErrorReply( - QDBusError::InternalError, - QString::number(hmi_apis::Common_Result::INVALID_DATA))); - } else { - QDBusConnection::sessionBus().send(msg); - } -} - -void DBusController::sendError(QVariant asyncObject, - QVariant code, - QVariant message) { - int uid = asyncObject.toMap()["__async_uid"].toInt(); - std::map<int, delayedReply>::iterator it = replies_.find(uid); - if (it != replies_.end()) { - QDBusMessage msg = it->second.message.createErrorReply(code.toString(), - message.toString()); - QDBusConnection::sessionBus().send(msg); - replies_.erase(it); - } -} - -void DBusController::sendError(QVariant asyncObject, QVariant code) { - sendError(asyncObject, code, QVariant("")); -} diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_controller.h b/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_controller.h deleted file mode 100644 index 937bab5f90..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_controller.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * \file dbus_controller.h - * \brief DbusController class header file. - * 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_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_DBUS_CONTROLLER_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_DBUS_CONTROLLER_H_ - -#include <QtDBus/QDBusMessage> -#include <QtCore/QObject> -#include <map> - -typedef bool (*fillRoutine)(QDBusMessage&, const QVariantMap&); - -class DBusController : public QObject { - struct delayedReply { - QDBusMessage message; - fillRoutine fill; - }; - Q_OBJECT - - public: - explicit DBusController(QObject* parent = 0); - void addMessage(const QDBusMessage& message, fillRoutine fill, int async_uid); - Q_INVOKABLE void sendReply(QVariant asyncObject, QVariant data); - Q_INVOKABLE void sendReply(QVariant data); - Q_INVOKABLE void sendError(QVariant asyncObject, QVariant code); - Q_INVOKABLE void sendError(QVariant asyncObject, - QVariant code, - QVariant message); - const QDBusMessage* message; - fillRoutine fill; - - private: - std::map<int, delayedReply> replies_; -}; - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_DBUS_CONTROLLER_H_ diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_plugin.cc b/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_plugin.cc deleted file mode 100644 index 5cc4dadb1e..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_plugin.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* - * \file dbus_plugin.cpp - * \brief DbusPlugin class source file. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "dbus_plugin.h" - -#include "hmi_proxy.h" -#include "sdl_proxy.h" -#include "optional_argument.h" -#include "qml_dbus.h" -#include "dbus_controller.h" -#include "request_to_sdl.h" - -#include <log4cxx/logger.h> -#include <log4cxx/propertyconfigurator.h> - -#include <QtCore/QString> -#include <QtDBus/QDBusConnection> - -#if QT_4 -#include <QtDeclarative/QDeclarativeContext> -#include <QtDeclarative/QDeclarativeListReference> -#include <QtDeclarative/QDeclarativeEngine> -#elif QT_5 -#include <QtQml/QQmlContext> -#include <QtQml/QQmlListReference> -#include <QtQml/QQmlEngine> -#endif // QT_VERSION -log4cxx::LoggerPtr logger_ = - log4cxx::LoggerPtr(log4cxx::Logger::getLogger("DBusPlugin")); - -void DbusPlugin::registerTypes(const char* uri) { - log4cxx::PropertyConfigurator::configure("log4cxx.properties"); - - // @uri sdl.core.api - qmlRegisterType<HmiProxy>(uri, 1, 0, "HMIAdapter"); - qmlRegisterType<SdlProxy>(uri, 1, 0, "SDLAdapter"); - - RegisterDbusMetatypes(); - qDBusRegisterMetaType<OptionalArgument<int> >(); - qDBusRegisterMetaType<OptionalArgument<QList<int> > >(); - qDBusRegisterMetaType<OptionalArgument<QString> >(); - qDBusRegisterMetaType<OptionalArgument<QStringList> >(); - qDBusRegisterMetaType<OptionalArgument<bool> >(); - qDBusRegisterMetaType<OptionalArgument<QList<bool> > >(); - qDBusRegisterMetaType<OptionalArgument<double> >(); - qDBusRegisterMetaType<OptionalArgument<QList<double> > >(); - - HmiProxy::api_adaptors_.Init(this); - - QDBusConnection::sessionBus().registerObject("/", this); - QDBusConnection::sessionBus().registerService("com.ford.sdl.hmi"); - - dbusController_ = new DBusController(); - requestToSDL_ = new RequestToSDL(); - - HmiProxy::api_adaptors_.SetDBusController(dbusController_); -} - -void DbusPlugin::initializeEngine(Engine* engine, const char* uri) { - engine->rootContext()->setContextProperty("DBus", dbusController_); - engine->rootContext()->setContextProperty("RequestToSDL", requestToSDL_); -} - -#if QT_4 -Q_EXPORT_PLUGIN2(DbusAdapter, DbusPlugin) -#endif // QT_4 diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_plugin.h b/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_plugin.h deleted file mode 100644 index 2b5bba6235..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/dbus_plugin.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * \file dbus_plugin.h - * \brief DbusPlugin class header file. - * 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_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_DBUS_PLUGIN_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_DBUS_PLUGIN_H_ - -#include "qt_version.h" - -#if QT_4 -#include <QtDeclarative/QDeclarativeExtensionPlugin> -typedef QDeclarativeExtensionPlugin ExtensionPlugin; -typedef QDeclarativeEngine Engine; -#elif QT_5 -#include <QtQml/QQmlExtensionPlugin> -typedef QQmlExtensionPlugin ExtensionPlugin; -typedef QQmlEngine Engine; -#endif // QT_VERSION -#include <QtDBus/QDBusContext> - -class DBusController; -class RequestToSDL; - -class DbusPlugin : public ExtensionPlugin, public QDBusContext { - Q_OBJECT - -#if QT_5 - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") -#endif // QT_5 - - DBusController* dbusController_; - RequestToSDL* requestToSDL_; - - public: - void registerTypes(const char* uri); - void initializeEngine(Engine* engine, const char* uri); -}; - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_DBUS_PLUGIN_H_ diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/hmi_proxy.cc b/src/components/qt_hmi/qml_plugins/dbus_adapter/hmi_proxy.cc deleted file mode 100644 index e196e5c5de..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/hmi_proxy.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * \file hmiproxy.cpp - * \brief HmiProxy class source file. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "hmi_proxy.h" -#include <QtDBus/QDBusConnection> - -ApiAdaptors HmiProxy::api_adaptors_; - -HmiProxy::HmiProxy(Item* parent) : Item(parent) {} - -void HmiProxy::componentComplete() { - Item::componentComplete(); - api_adaptors_.SetApi(this); -} diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/optional_argument.h b/src/components/qt_hmi/qml_plugins/dbus_adapter/optional_argument.h deleted file mode 100644 index ea6f68bb31..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/optional_argument.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * \file optional_argument.h - * \brief OptionalArgument struct header file. - * 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_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_OPTIONAL_ARGUMENT_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_OPTIONAL_ARGUMENT_H_ - -#include "qt_version.h" -#include <QtDBus/QDBusArgument> - -template <class T> -struct OptionalArgument { - T val; - bool presence; - explicit OptionalArgument(const T& value) : val(value), presence(true) {} - OptionalArgument() : presence(false) {} -}; - -template <class T> -inline QDBusArgument& operator<<(QDBusArgument& arg, - const OptionalArgument<T>& o) { - arg.beginStructure(); - arg << o.presence << o.val; - arg.endStructure(); - return arg; -} - -template <class T> -inline const QDBusArgument& operator>>(const QDBusArgument& arg, - OptionalArgument<T>& o) { - arg.beginStructure(); - arg >> o.presence >> o.val; - arg.endStructure(); - return arg; -} - -template <class T> -inline bool VariantToValue(const QVariant& variant, OptionalArgument<T>& o) { - if (variant.isNull()) { - o.presence = false; - return true; - } - o.presence = true; - return VariantToValue(variant, o.val); -} - -#if QT_4 -Q_DECLARE_METATYPE(QList<int>) -#endif // QT_4 - -Q_DECLARE_METATYPE(OptionalArgument<int>) -Q_DECLARE_METATYPE(OptionalArgument<QString>) -Q_DECLARE_METATYPE(OptionalArgument<bool>) -Q_DECLARE_METATYPE(OptionalArgument<double>) - -Q_DECLARE_METATYPE(OptionalArgument<QList<int> >) -Q_DECLARE_METATYPE(OptionalArgument<QStringList>) -Q_DECLARE_METATYPE(OptionalArgument<QList<bool> >) -Q_DECLARE_METATYPE(OptionalArgument<QList<double> >) -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_OPTIONAL_ARGUMENT_H_ diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/qml_dbus_common.h b/src/components/qt_hmi/qml_plugins/dbus_adapter/qml_dbus_common.h deleted file mode 100644 index fa9692f9d9..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/qml_dbus_common.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * \file qml_dbus_common.h - * \brief Contain utilities for DBus plugin. - * 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_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_QML_DBUS_COMMON_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_QML_DBUS_COMMON_H_ - -#include <QtDBus/QDBusContext> -#include "optional_argument.h" -#include "stream_qvariant.h" -#include "metatype.h" - -enum ErrorCode { - Success = 0, - UnsupportedRequest, - UnsupportedResource, - Disallowed, - Rejected, - Aborted, - Ignored, - Retry, - InUse, - DataNotAvailable, - TimedOut, - InvalidData, - CharLimitExceeded, - InvalidId, - DuplicateName, - ApplicationNotRegistered, - WrongLanguage, - OutOfMemory, - TooManyPendingRequests, - NoAppsRegistered, - NoDevicesConnected, - Warnings, - GenericError, - UserDisallowed -}; - -inline void RaiseDbusError(QObject* adaptor, int code, const QString& message) { - QDBusContext* context = dynamic_cast<QDBusContext*>(adaptor->parent()); - if (context) { - context->sendErrorReply(QString::number(static_cast<int>(code)), message); - } -} - -inline void RaiseDbusError(QObject* adaptor, int code) { - RaiseDbusError(adaptor, code, ""); -} - -template <typename T> -inline void PutArgToMap(QVariantMap& map, const char* name, const T& v) { - map.insert(name, QVariant::fromValue(v)); -} - -inline bool GetArgFromMap(const QVariantMap& map, const char* name, int& v) { - QVariantMap::const_iterator it = map.find(name); - if (map.end() == it) - return false; - if (it->type() != QVariant::Int) - return false; - v = it->toInt(); - return true; -} - -inline bool GetArgFromMap(const QVariantMap& map, - const char* name, - QString& v) { - QVariantMap::const_iterator it = map.find(name); - if (map.end() == it) - return false; - if (it->type() != QVariant::String) - return false; - v = it->toString(); - return true; -} - -inline bool GetArgFromMap(const QVariantMap& map, const char* name, bool& v) { - QVariantMap::const_iterator it = map.find(name); - if (map.end() == it) - return false; - if (it->type() != QVariant::Bool) - return false; - v = it->toBool(); - return true; -} - -inline bool isNumber(QVariant v) { - QVariant::Type t = v.type(); - return (t == QVariant::Double) || (t == QVariant::Int) || - (t == QVariant::UInt) || (t == QVariant::LongLong) || - (t == QVariant::ULongLong); -} - -inline bool GetArgFromMap(const QVariantMap& map, const char* name, double& v) { - QVariantMap::const_iterator it = map.find(name); - if (map.end() == it) - return false; - if (!isNumber(*it)) - return false; - v = it->toDouble(); - return true; -} - -inline bool VariantToValue(const QVariant& variant, int& v) { - if (variant.type() != QVariant::Int) - return false; - v = variant.toInt(); - return true; -} - -inline bool VariantToValue(const QVariant& variant, QString& v) { - if (variant.type() != QVariant::String) - return false; - v = variant.toString(); - return true; -} - -inline bool VariantToValue(const QVariant& variant, bool& v) { - if (variant.type() != QVariant::Bool) - return false; - v = variant.toBool(); - return true; -} - -inline bool VariantToValue(const QVariant& variant, double& v) { - if (variant.type() != QVariant::Double) - return false; - v = variant.toDouble(); - return true; -} - -inline bool VariantToValue(const QVariant& variant, QStringList& v) { - if (variant.type() != QVariant::List) - return false; - QList<QVariant> list = variant.toList(); - for (QList<QVariant>::const_iterator i = list.begin(); i != list.end(); ++i) { - if (i->type() != QVariant::String) - return false; - v.append(i->toString()); - } - return true; -} - -template <typename T> -bool VariantToValue(const QVariant& variant, QList<T>& v) { - if (variant.type() != QVariant::List) - return false; - QList<T> spare; - QList<QVariant> list = variant.toList(); - for (QList<QVariant>::const_iterator i = list.begin(); i != list.end(); ++i) { - QVariant::Type type = i->type(); - // Although this function is declared as returning QVariant::Type(obsolete), - // the return value should be interpreted as QMetaType::Type. - // (http://qt-project.org/doc/qt-5.0/qtcore/qvariant.html#type) - QMetaType::Type type_casted = static_cast<QMetaType::Type>(type); - if (type_casted != metatype<T>()) { - return false; - } - spare.append(i->value<T>()); - } - v.swap(spare); - return true; -} - -template <typename T> -inline QVariant ValueToVariant(const T& v) { - return QVariant::fromValue(v); -} - -template <typename T> -inline QVariant ValueToVariant(const QList<T>& v) { - QList<QVariant> list; - for (typename QList<T>::const_iterator i = v.begin(); i != v.end(); ++i) - list.append(ValueToVariant(*i)); - return QVariant::fromValue(list); -} - -template <typename T> -inline void PutArgToMap(QVariantMap& map, const char* name, const QList<T>& v) { - QList<QVariant> list; - for (typename QList<T>::const_iterator i = v.begin(); i != v.end(); ++i) - list.append(ValueToVariant(*i)); - map.insert(name, QVariant::fromValue(list)); -} - -template <typename T> -inline bool GetArgFromMap(const QVariantMap& map, - const char* name, - QList<T>& v) { - QVariantMap::const_iterator it = map.find(name); - if (map.end() == it) - return false; - const QVariant& variant = *it; - if (variant.type() != QVariant::List) - return false; - QList<QVariant> list = variant.toList(); - for (QList<QVariant>::const_iterator i = list.begin(); i != list.end(); ++i) { - T t; - bool ok = VariantToValue(*i, t); - if (!ok) - return false; - v.append(t); - } - return true; -} - -template <typename T> -inline void PutArgToMap(QVariantMap& map, - const char* name, - const OptionalArgument<T>& v) { - if (v.presence) - map.insert(name, ValueToVariant(v.val)); -} - -template <typename T> -inline bool GetArgFromMap(const QVariantMap& map, - const char* name, - OptionalArgument<T>& v) { - QVariantMap::const_iterator it = map.find(name); - if (map.end() == it || !it->isValid()) { - v.presence = false; - return true; - } - v.presence = true; - return GetArgFromMap(map, name, v.val); -} - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_QML_DBUS_COMMON_H_ diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/qmldir b/src/components/qt_hmi/qml_plugins/dbus_adapter/qmldir deleted file mode 100644 index 5f426d357d..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.ford.sdl.hmi.dbus_adapter -plugin DbusAdapter - diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/qt_version.h b/src/components/qt_hmi/qml_plugins/dbus_adapter/qt_version.h deleted file mode 100644 index c41eea7403..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/qt_version.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @file qt_version.h - * @brief Defines for check Qt version. - * 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_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_QT_VERSION_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_QT_VERSION_H_ - -#include <qglobal.h> - -#define QT_4 \ - ((QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))) - -#define QT_5 \ - ((QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))) - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_QT_VERSION_H_ diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/stream_qvariant.cc b/src/components/qt_hmi/qml_plugins/dbus_adapter/stream_qvariant.cc deleted file mode 100644 index ec049b9533..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/stream_qvariant.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "stream_qvariant.h" - -std::basic_ostream<char>& operator<<(std::basic_ostream<char>& os, - const QVariant& value) { - switch (value.type()) { - case QVariant::Map: { - os << "{ "; - QVariantMap structure = value.toMap(); - QMapIterator<QString, QVariant> i(structure); - while (i.hasNext()) { - i.next(); - os << i.key() << ":" << i.value(); - if (i.hasNext()) { - os << ", "; - } - } - os << " }"; - } break; - case QVariant::List: { - os << "[ "; - QVariantList array = value.toList(); - QListIterator<QVariant> i(array); - while (i.hasNext()) { - os << i.next(); - if (i.hasNext()) { - os << ", "; - } - } - os << " ]"; - } break; - default: - os << value.toString().toLatin1().data(); - } - - return os; -} diff --git a/src/components/qt_hmi/qml_plugins/dbus_adapter/stream_qvariant.h b/src/components/qt_hmi/qml_plugins/dbus_adapter/stream_qvariant.h deleted file mode 100644 index 0d0e279b87..0000000000 --- a/src/components/qt_hmi/qml_plugins/dbus_adapter/stream_qvariant.h +++ /dev/null @@ -1,42 +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_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_STREAM_QVARIANT_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_STREAM_QVARIANT_H_ - -#include <QtCore/QVariant> -#include <sstream> - -std::basic_ostream<char>& operator<<(std::basic_ostream<char>& os, - const QVariant& value); - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_DBUS_ADAPTER_STREAM_QVARIANT_H_ diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/CMakeLists.txt b/src/components/qt_hmi/qml_plugins/hw_buttons/CMakeLists.txt deleted file mode 100644 index 56a64b48b3..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/CMakeLists.txt +++ /dev/null @@ -1,85 +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. - -cmake_minimum_required(VERSION 2.8.11) - -set(target HWButtons) -set(destination com/ford/sdl/hmi/hw_buttons) -set(install_destination bin/hmi/plugins/${destination}) -set(library_name ${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}) - -set(CMAKE_AUTOMOC ON) -set(SOURCES - attributed_mouse_event.cc - hmi_hwbuttons.cc - masked_container.cc -) - -add_library(${target} SHARED ${SOURCES}) - -if (${qt_version} MATCHES "4.8.5") - qt4_use_modules(${target} Core Gui Declarative) - set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt4/) - set(copy_destination ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt4/${destination}) -elseif (${qt_version} MATCHES "5.1.0") - qt5_use_modules(${target} Core Qml Quick) - set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt5/) - set(copy_destination ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt5/${destination}) -endif () - -add_custom_target(copy_library_${target} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/${library_name} - ${copy_destination} - DEPENDS ${target} - COMMENT "Copying library ${library_name}") -file(COPY qmldir DESTINATION ${copy_destination}) - -install(TARGETS ${target} - DESTINATION ${install_destination} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE -) -install(FILES qmldir DESTINATION ${install_destination}) - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - add_custom_target(qmltypes_${target} ALL - COMMAND ${qmlplugindump_binary} -nonrelocatable com.ford.sdl.hmi.hw_buttons 1.0 ${model_dir} > ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes 2>/dev/null - DEPENDS copy_library_${target} - ) - add_custom_target(copy_qmltypes_${target} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes - ${copy_destination} - DEPENDS qmltypes_${target} - ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes DESTINATION ${install_destination}) -endif () diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/attributed_mouse_event.cc b/src/components/qt_hmi/qml_plugins/hw_buttons/attributed_mouse_event.cc deleted file mode 100644 index 899fc5b615..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/attributed_mouse_event.cc +++ /dev/null @@ -1,39 +0,0 @@ -/* - * \file attributed_mouse_event.cpp - * \brief AttributedMouseEvent class source file. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "attributed_mouse_event.h" - -Item* AttributedMouseEvent::item() const { - return item_; -} diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/attributed_mouse_event.h b/src/components/qt_hmi/qml_plugins/hw_buttons/attributed_mouse_event.h deleted file mode 100644 index 0486397058..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/attributed_mouse_event.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * \file attributed_mouse_event.h - * \brief AttributedMouseEvent class header file. - * 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_QT_HMI_QML_PLUGINS_HW_BUTTONS_ATTRIBUTED_MOUSE_EVENT_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_HW_BUTTONS_ATTRIBUTED_MOUSE_EVENT_H_ - -#include "qt_version.h" - -#include <QtCore/QObject> -#if QT_4 -#include <QtDeclarative/QDeclarativeItem> -typedef QDeclarativeItem Item; -#elif QT_5 -#include <QtQuick/QQuickItem> -typedef QQuickItem Item; -#endif // QT_VERSION - -class AttributedMouseEvent : public QObject { - Q_OBJECT - Q_PROPERTY(Item* item READ item) - - public: - explicit AttributedMouseEvent(Item* item) : item_(item) {} - - Item* item() const; - - private: - Item* item_; - Q_DISABLE_COPY(AttributedMouseEvent) -}; - -QML_DECLARE_TYPE(AttributedMouseEvent) - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_HW_BUTTONS_ATTRIBUTED_MOUSE_EVENT_H_ diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/hmi_hwbuttons.cc b/src/components/qt_hmi/qml_plugins/hw_buttons/hmi_hwbuttons.cc deleted file mode 100644 index 62a090a509..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/hmi_hwbuttons.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * \file hmi_hwbuttons.cpp - * \brief HmiHWButtons class source file. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "hmi_hwbuttons.h" - -#if QT_4 -#include <QtDeclarative/qdeclarative.h> -#include <QtGui/QGraphicsColorizeEffect> -#elif QT_5 -#include <QtQml> -#endif // QT_VERSION - -#include "masked_container.h" -#include "attributed_mouse_event.h" - -void HmiHWButtons::registerTypes(const char* uri) { - // @uri com.ford.hmi_framework - qmlRegisterType<MaskedContainer>(uri, 1, 0, "MaskedContainer"); - qmlRegisterType<AttributedMouseEvent>(); -#if QT_4 - qmlRegisterType<QGraphicsColorizeEffect>(uri, 1, 0, "Colorize"); -#endif // QT_4 -} - -#if QT_4 -Q_EXPORT_PLUGIN2(HWButtons, HmiHWButtons) -#endif // QT_4 diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/hmi_hwbuttons.h b/src/components/qt_hmi/qml_plugins/hw_buttons/hmi_hwbuttons.h deleted file mode 100644 index 0cf71807c4..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/hmi_hwbuttons.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * \file hmi_hwbuttons.h - * \brief HmiHWButtons class header file. - * 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_QT_HMI_QML_PLUGINS_HW_BUTTONS_HMI_HWBUTTONS_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_HW_BUTTONS_HMI_HWBUTTONS_H_ - -#include "qt_version.h" - -#if QT_4 -#include <QtDeclarative/QDeclarativeExtensionPlugin> -typedef QDeclarativeExtensionPlugin ExtensionPlugin; -#elif QT_5 -#include <QtQml/QQmlExtensionPlugin> -typedef QQmlExtensionPlugin ExtensionPlugin; -#endif // QT_VERSION - -class HmiHWButtons : public ExtensionPlugin { - Q_OBJECT -#if QT_5 - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") -#endif // QT_5 - - public: - void registerTypes(const char* uri); -}; - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_HW_BUTTONS_HMI_HWBUTTONS_H_ diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/masked_container.cc b/src/components/qt_hmi/qml_plugins/hw_buttons/masked_container.cc deleted file mode 100644 index f80e80907e..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/masked_container.cc +++ /dev/null @@ -1,153 +0,0 @@ -/* - * \file masked_container.cpp - * \brief MaskedContainer class source file. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "masked_container.h" - -#if QT_4 -#include <QtCore/QPointF> -#include <QtGui/QGraphicsSceneMouseEvent> -#define IMAGE "QDeclarativeImage" -#elif QT_5 -#include <QtGui/QImage> -#include <QtCore/QEvent> -#define IMAGE "QQuickImage" -#endif // QT_VERSION - -MaskedContainer::MaskedContainer(Item* parent) : Item(parent), mask_(NULL) { - setAcceptedMouseButtons(Qt::LeftButton); -} - -void MaskedContainer::componentComplete() { - Item::componentComplete(); - - for (QObjectList::ConstIterator it = children().begin(); - it != children().end(); - ++it) { - Item* item = qobject_cast<Item*>(*it); - if (item && item->inherits(IMAGE) && item->isVisible()) { - images_.push_back(item); - } - } - - int height = this->height(); - int width = this->width(); - - for (size_t i = 0; i < images_.size(); ++i) { - Item* item = images_[i]; - int itemWidth = item->width(); - int itemHeight = item->height(); - int itemX = item->x(); - int itemY = item->y(); - if (height < itemHeight + itemY) - height = itemHeight + itemY; - if (width < itemWidth + itemX) - width = itemWidth + itemX; - } - - setHeight(height); - setWidth(width); - - mask_ = new int[height * width]; - std::fill(mask_, mask_ + height * width, -1); - - for (size_t i = 0; i < images_.size(); ++i) { - Item* item = images_[i]; - int itemWidth = item->width(); - int itemHeight = item->height(); - int itemX = item->x(); - int itemY = item->y(); - - QUrl url = item->property("source").toUrl(); - QImage img(url.path()); - const QRgb* bits = reinterpret_cast<const QRgb*>(img.constBits()); - for (int x = 0; x < itemWidth; ++x) { - for (int y = 0; y < itemHeight; ++y) { - if (qAlpha(bits[y * itemWidth + x]) > 128) { - mask_[(itemY + y) * width + (x + itemX)] = i; - } - } - } - } -} - -void MaskedContainer::mousePressEvent(MouseEvent* mouse) { -#if QT_4 - qreal x = mouse->pos().x(); - qreal y = mouse->pos().y(); -#elif QT_5 - int x = mouse->x(); - int y = mouse->y(); -#endif // QT_VERSION - - if (width() * y + x > width() * height()) { - mouse->ignore(); - } else { - int idx = mask_[indexOfMask(x, y)]; - if (idx >= 0) { - AttributedMouseEvent ev(images_[idx]); - emit pressed(&ev); - grabMouse(); - mouse->accept(); - } else { - mouse->ignore(); - } - } -} - -void MaskedContainer::mouseReleaseEvent(MouseEvent* mouse) { -#if QT_4 - qreal x = mouse->pos().x(); - qreal y = mouse->pos().y(); -#elif QT_5 - int x = mouse->x(); - int y = mouse->y(); -#endif // QT_VERSION - - if (width() * y + x > width() * height()) { - return; - } else { - int idx = mask_[indexOfMask(x, y)]; - if (idx >= 0) { - AttributedMouseEvent ev(images_[idx]); - emit released(&ev); - } else { - emit released(NULL); - } - } - ungrabMouse(); -} - -MaskedContainer::~MaskedContainer() { - delete[] mask_; -} diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/masked_container.h b/src/components/qt_hmi/qml_plugins/hw_buttons/masked_container.h deleted file mode 100644 index ae5303a693..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/masked_container.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * \file masked_container.h - * \brief MaskedContainer class header file. - * 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_QT_HMI_QML_PLUGINS_HW_BUTTONS_MASKED_CONTAINER_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_HW_BUTTONS_MASKED_CONTAINER_H_ - -#include <vector> -#include <QtCore/QString> - -#include "qt_version.h" - -#if QT_4 -#include <QtDeclarative/QDeclarativeItem> -typedef QDeclarativeItem Item; -typedef QGraphicsSceneMouseEvent MouseEvent; -#elif QT_5 -#include <QtQuick/QQuickItem> -typedef QQuickItem Item; -typedef QMouseEvent MouseEvent; -#endif - -#include "attributed_mouse_event.h" - -class MaskedContainer : public Item { - Q_OBJECT - Q_DISABLE_COPY(MaskedContainer) - - public: - explicit MaskedContainer(Item* parent = 0); - ~MaskedContainer(); - -signals: - void pressed(AttributedMouseEvent* attr); - void released(AttributedMouseEvent* attr); - - protected: - virtual void componentComplete(); - virtual void mousePressEvent(MouseEvent* event); - virtual void mouseReleaseEvent(MouseEvent* event); - - private: - std::vector<Item*> images_; - int* mask_; - -#if QT_4 - int indexOfMask(qreal x, qreal y) const { - return static_cast<int>(y * width() + x); - } -#elif QT_5 - int indexOfMask(int x, int y) const { - return y * static_cast<int>(width()) + x; - } -#endif // QT_VERSION -}; - -QML_DECLARE_TYPE(MaskedContainer) - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_HW_BUTTONS_MASKED_CONTAINER_H_ diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/qmldir b/src/components/qt_hmi/qml_plugins/hw_buttons/qmldir deleted file mode 100644 index a4bae8144b..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.ford.sdl.hmi.hw_buttons -plugin HWButtons - diff --git a/src/components/qt_hmi/qml_plugins/hw_buttons/qt_version.h b/src/components/qt_hmi/qml_plugins/hw_buttons/qt_version.h deleted file mode 100644 index a700a87919..0000000000 --- a/src/components/qt_hmi/qml_plugins/hw_buttons/qt_version.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @file qt_version.h - * @brief Defines for check Qt version. - * 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_QT_HMI_QML_PLUGINS_HW_BUTTONS_QT_VERSION_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_HW_BUTTONS_QT_VERSION_H_ - -#include <qglobal.h> - -#define QT_4 \ - ((QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))) - -#define QT_5 \ - ((QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))) - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_HW_BUTTONS_QT_VERSION_H_ diff --git a/src/components/qt_hmi/qml_plugins/log4cxx/CMakeLists.txt b/src/components/qt_hmi/qml_plugins/log4cxx/CMakeLists.txt deleted file mode 100644 index 1a5baadaa9..0000000000 --- a/src/components/qt_hmi/qml_plugins/log4cxx/CMakeLists.txt +++ /dev/null @@ -1,86 +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. - -cmake_minimum_required(VERSION 2.8.11) - -set(target QmlLog4cxx) -set(destination com/ford/sdl/hmi/log4cxx) -set(install_destination bin/hmi/plugins/${destination}) -set(library_name ${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}) -include_directories( - ${LOG4CXX_INCLUDE_DIRECTORY} -) - -set(CMAKE_AUTOMOC ON) -set(SOURCES log4cxx_plugin.cc) - -add_library(${target} SHARED ${SOURCES}) - -if (${qt_version} MATCHES "4.8.5") - qt4_use_modules(${target} Core Declarative) - set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt4/) - set(copy_destination ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt4/${destination}) -elseif (${qt_version} MATCHES "5.1.0") - qt5_use_modules(${target} Core Qml) - set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt5/) - set(copy_destination ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt5/${destination}) -endif () - -target_link_libraries(${target} log4cxx -L${LOG4CXX_LIBS_DIRECTORY}) - -add_custom_target(copy_library_${target} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/${library_name} - ${copy_destination} - DEPENDS ${target} - COMMENT "Copying library ${library_name}") -file(COPY qmldir DESTINATION ${copy_destination}) - -install(TARGETS ${target} - DESTINATION ${install_destination} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE -) -install(FILES qmldir DESTINATION ${install_destination}) - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - add_custom_target(qmltypes_${target} ALL - COMMAND LD_LIBRARY_PATH=${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib ${qmlplugindump_binary} -nonrelocatable com.ford.sdl.hmi.log4cxx 1.0 ${model_dir} > ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes 2>/dev/null - DEPENDS copy_library_${target} - ) - add_custom_target(copy_qmltypes_${target} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes - ${copy_destination} - DEPENDS qmltypes_${target} - ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes DESTINATION ${install_destination}) -endif () diff --git a/src/components/qt_hmi/qml_plugins/log4cxx/log4cxx_plugin.cc b/src/components/qt_hmi/qml_plugins/log4cxx/log4cxx_plugin.cc deleted file mode 100644 index 8b7efe23d7..0000000000 --- a/src/components/qt_hmi/qml_plugins/log4cxx/log4cxx_plugin.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* - * @file log4cxx_plugin.cpp - * @brief Log4cxxPlugin class header file. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "log4cxx_plugin.h" - -#include <log4cxx/log4cxx.h> -#include <log4cxx/propertyconfigurator.h> - -log4cxx::LoggerPtr logger_ = - log4cxx::LoggerPtr(log4cxx::Logger::getLogger("Log4cxxPlugin")); - -#if QT_4 -void smartLogger(QtMsgType type, const char* msg) { - log4cxx::spi::LocationInfo location("", "", -1); - - switch (type) { - case QtDebugMsg: - (*logger_).debug(msg, location); - break; - case QtWarningMsg: - (*logger_).warn(msg, location); - break; - case QtCriticalMsg: - (*logger_).error(msg, location); - break; - case QtFatalMsg: - (*logger_).fatal(msg, location); - break; - default: - (*logger_).info(msg, location); - break; - } -} -#elif QT_5 -void smartLogger(QtMsgType type, - const QMessageLogContext& context, - const QString& msg) { - log4cxx::spi::LocationInfo location( - context.file, context.function ? context.function : "", context.line); - switch (type) { - case QtDebugMsg: - (*logger_).debug(msg.toStdString(), location); - break; - case QtWarningMsg: - (*logger_).warn(msg.toStdString(), location); - break; - case QtCriticalMsg: - (*logger_).error(msg.toStdString(), location); - break; - case QtFatalMsg: - (*logger_).fatal(msg.toStdString(), location); - break; - default: - (*logger_).info(msg.toStdString(), location); - break; - } -} -#endif // QT_VERSION - -void Log4cxxPlugin::registerTypes(const char* uri) { - log4cxx::PropertyConfigurator::configure("log4cxx.properties"); - -#if QT_4 - qInstallMsgHandler(smartLogger); -#elif QT_5 - qInstallMessageHandler(smartLogger); -#endif // QT_VERSION - - // @uri com.ford.sdl.hmi.log4cxx - qmlRegisterType<Logger>(uri, 1, 0, "Logger"); - // Use standart console API Javascript - // See Debugging QML Applications in Qt documentation -} - -#if QT_4 -Q_EXPORT_PLUGIN2(QmlLog4cxx, Log4cxxPlugin) -#endif // QT_4 diff --git a/src/components/qt_hmi/qml_plugins/log4cxx/log4cxx_plugin.h b/src/components/qt_hmi/qml_plugins/log4cxx/log4cxx_plugin.h deleted file mode 100644 index e8d1ff3347..0000000000 --- a/src/components/qt_hmi/qml_plugins/log4cxx/log4cxx_plugin.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * @file log4cxx_plugin.h - * @brief Log4cxxPlugin class header file. - * 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_QT_HMI_QML_PLUGINS_LOG4CXX_LOG4CXX_PLUGIN_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_LOG4CXX_LOG4CXX_PLUGIN_H_ - -#include <qglobal.h> - -#define QT_4 \ - ((QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))) - -#define QT_5 \ - ((QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))) - -#if QT_4 -#include <QtDeclarative/qdeclarative.h> -#include <QtDeclarative/QDeclarativeExtensionPlugin> -typedef QDeclarativeExtensionPlugin ExtensionPlugin; -#elif QT_5 -#include <QtQml/qqml.h> -#include <QtQml/QQmlExtensionPlugin> -typedef QQmlExtensionPlugin ExtensionPlugin; -#endif // QT_VERSION - -class Logger : public QObject { - Q_OBJECT - Q_DISABLE_COPY(Logger) - - public: - explicit Logger(QObject* parent = 0) : QObject(parent) {} -}; - -class Log4cxxPlugin : public ExtensionPlugin { - Q_OBJECT -#if QT_5 - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") -#endif // QT_5 - - public: - void registerTypes(const char* uri); -}; - -QML_DECLARE_TYPE(Logger) - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_LOG4CXX_LOG4CXX_PLUGIN_H_ diff --git a/src/components/qt_hmi/qml_plugins/log4cxx/qmldir b/src/components/qt_hmi/qml_plugins/log4cxx/qmldir deleted file mode 100644 index ddd7bc99a5..0000000000 --- a/src/components/qt_hmi/qml_plugins/log4cxx/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.ford.sdl.hmi.log4cxx -plugin QmlLog4cxx - diff --git a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/CMakeLists.txt b/src/components/qt_hmi/qml_plugins/named_pipe_notifier/CMakeLists.txt deleted file mode 100644 index e777e95263..0000000000 --- a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/CMakeLists.txt +++ /dev/null @@ -1,84 +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. - -cmake_minimum_required(VERSION 2.8.11) - -set(target NamedPipeNotifier) -set(destination com/ford/sdl/hmi/named_pipe_notifier) -set(install_destination bin/hmi/plugins/${destination}) -set(library_name ${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX}) - -set(CMAKE_AUTOMOC ON) -set(SOURCES - named_pipe_notifier.cc - named_pipe_notifier_plugin.cc -) - -add_library(${target} SHARED ${SOURCES}) - -if (${qt_version} MATCHES "4.8.5") - qt4_use_modules(${target} Core Declarative) - set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt4/) - set(copy_destination ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt4/${destination}) -elseif (${qt_version} MATCHES "5.1.0") - qt5_use_modules(${target} Core Qml) - set(model_dir ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt5/) - set(copy_destination ${CMAKE_CURRENT_BINARY_DIR}/../../qml_model_qt5/${destination}) -endif () - -add_custom_target(copy_library_${target} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/${library_name} - ${copy_destination} - DEPENDS ${target} - COMMENT "Copying library ${library_name}") -file(COPY qmldir DESTINATION ${copy_destination}) - -install(TARGETS ${target} - DESTINATION ${install_destination} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE - GROUP_READ GROUP_EXECUTE - WORLD_READ WORLD_EXECUTE -) -install(FILES qmldir DESTINATION ${install_destination}) - -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - add_custom_target(qmltypes_${target} ALL - COMMAND ${qmlplugindump_binary} -nonrelocatable com.ford.sdl.hmi.named_pipe_notifier 1.0 ${model_dir} > ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes 2>/dev/null - DEPENDS copy_library_${target} - ) - add_custom_target(copy_qmltypes_${target} ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes - ${copy_destination} - DEPENDS qmltypes_${target} - ) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/plugins.qmltypes DESTINATION ${install_destination}) -endif () diff --git a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier.cc b/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier.cc deleted file mode 100644 index 46b057dcca..0000000000 --- a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * @file named_pipe_notifier.cc - * @brief NamedPipeNotifier class implementation file. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <fcntl.h> -#include <sys/select.h> -#include <sys/stat.h> -#include <errno.h> - -#include "named_pipe_notifier.h" - -void NamedPipeNotifier::run() { - int fd = ::open(name_.toLocal8Bit().constData(), O_RDONLY); - if (-1 == fd) { // if open() fails - if ((errno != ENOENT) // we can only manage lack of pipe - || - (-1 == ::mkfifo(name_.toLocal8Bit().constData(), 0666)) || - (-1 == (fd = ::open(name_.toLocal8Bit().constData(), O_RDONLY)))) { - emit openFailed(); - return; - } - } - ::fd_set readfds; - FD_ZERO(&readfds); - FD_SET(fd, &readfds); - // this select() is supposed to block till pipe is empty - if (::select(fd + 1, &readfds, 0, 0, 0) > 0) { - emit readyRead(); - } -} diff --git a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier.h b/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier.h deleted file mode 100644 index cdca06466f..0000000000 --- a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * \file named_pipe_notifier.h - * \brief NamedPipeNotifier class header file. - * 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_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_NAMED_PIPE_NOTIFIER_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_NAMED_PIPE_NOTIFIER_H_ - -#include <QThread> - -class NamedPipeNotifier : public QThread { - Q_OBJECT - Q_PROPERTY(QString name READ name WRITE set_name NOTIFY nameChanged) - QString name_; - - public: - explicit NamedPipeNotifier(QObject* parent = 0) : QThread(parent) {} - - const QString& name() const { - return name_; - } - void set_name(const QString& name) { - if (name_ != name) { - name_ = name; - emit nameChanged(); - } - } - - protected: - virtual void run(); - -signals: - void nameChanged(); - void readyRead(); - void openFailed(); -}; - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_NAMED_PIPE_NOTIFIER_H_ diff --git a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier_plugin.cc b/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier_plugin.cc deleted file mode 100644 index dacb11ad93..0000000000 --- a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier_plugin.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* - * \file named_pipe_notifier_plugin.cc - * \brief NamedPipeNotifierPlugin class implementation file. - * Copyright (c) 2013, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "named_pipe_notifier_plugin.h" - -#if QT_4 -#include <QtDeclarative/qdeclarative.h> -#elif QT_5 -#include <QtQml/qqml.h> -#endif // QT_VERSION - -#include "named_pipe_notifier.h" - -void NamedPipeNotifierPlugin::registerTypes(const char* uri) { - // @uri com.ford.sdl.hmi.named_pipe_notifier - qmlRegisterType<NamedPipeNotifier>(uri, 1, 0, "NamedPipeNotifier"); -} - -#if QT_4 -Q_EXPORT_PLUGIN2(NamedPipeNotifier, NamedPipeNotifierPlugin) -#endif // QT_4 diff --git a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier_plugin.h b/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier_plugin.h deleted file mode 100644 index 426df483a2..0000000000 --- a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/named_pipe_notifier_plugin.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * \file named_pipe_notifier_plugin.h - * \brief NamedPipeNotifierPlugin class header file. - * 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_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_NAMED_PIPE_NOTIFIER_PLUGIN_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_NAMED_PIPE_NOTIFIER_PLUGIN_H_ - -#include "qt_version.h" - -#if QT_4 -#include <QtDeclarative/QDeclarativeExtensionPlugin> -typedef QDeclarativeExtensionPlugin ExtensionPlugin; -#elif QT_5 -#include <QtQml/QQmlExtensionPlugin> -typedef QQmlExtensionPlugin ExtensionPlugin; -#endif // QT_5 - -class NamedPipeNotifierPlugin : public ExtensionPlugin { - Q_OBJECT - -#if QT_5 - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") -#endif // QT_5 - - public: - void registerTypes(const char* uri); -}; - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_NAMED_PIPE_NOTIFIER_PLUGIN_H_ diff --git a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/qmldir b/src/components/qt_hmi/qml_plugins/named_pipe_notifier/qmldir deleted file mode 100644 index 86ede716ee..0000000000 --- a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module com.ford.sdl.hmi.named_pipe_notifier -plugin NamedPipeNotifier diff --git a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/qt_version.h b/src/components/qt_hmi/qml_plugins/named_pipe_notifier/qt_version.h deleted file mode 100644 index 0e2456d732..0000000000 --- a/src/components/qt_hmi/qml_plugins/named_pipe_notifier/qt_version.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * @file qt_version.h - * @brief Defines for check Qt version. - * 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_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_QT_VERSION_H_ -#define SRC_COMPONENTS_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_QT_VERSION_H_ - -#include <qglobal.h> - -#define QT_4 \ - ((QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))) - -#define QT_5 \ - ((QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) && \ - (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))) - -#endif // SRC_COMPONENTS_QT_HMI_QML_PLUGINS_NAMED_PIPE_NOTIFIER_QT_VERSION_H_ diff --git a/src/components/qt_hmi/res/IVSU/PROPRIETARY_REQUEST b/src/components/qt_hmi/res/IVSU/PROPRIETARY_REQUEST deleted file mode 100644 index ab0a27b552..0000000000 --- a/src/components/qt_hmi/res/IVSU/PROPRIETARY_REQUEST +++ /dev/null @@ -1,2 +0,0 @@ -4Ezay^ק<yi'*';(*'-N)z:nx:Rǂi^^笴ǭO9$ySgږ爞ZDžYhږǜzۭקoj[nruZL -w>^7k͆ diff --git a/src/components/qt_hmi/res/SPT.png b/src/components/qt_hmi/res/SPT.png Binary files differdeleted file mode 100644 index efe0b43dc2..0000000000 --- a/src/components/qt_hmi/res/SPT.png +++ /dev/null diff --git a/src/components/qt_hmi/res/album_art.png b/src/components/qt_hmi/res/album_art.png Binary files differdeleted file mode 100644 index 9000680276..0000000000 --- a/src/components/qt_hmi/res/album_art.png +++ /dev/null diff --git a/src/components/qt_hmi/res/app_911_assist.png b/src/components/qt_hmi/res/app_911_assist.png Binary files differdeleted file mode 100644 index dc7d3c6630..0000000000 --- a/src/components/qt_hmi/res/app_911_assist.png +++ /dev/null diff --git a/src/components/qt_hmi/res/app_vehicle_info.png b/src/components/qt_hmi/res/app_vehicle_info.png Binary files differdeleted file mode 100644 index 1542c787db..0000000000 --- a/src/components/qt_hmi/res/app_vehicle_info.png +++ /dev/null diff --git a/src/components/qt_hmi/res/apps.png b/src/components/qt_hmi/res/apps.png Binary files differdeleted file mode 100644 index 48d8284b2a..0000000000 --- a/src/components/qt_hmi/res/apps.png +++ /dev/null diff --git a/src/components/qt_hmi/res/arrow.png b/src/components/qt_hmi/res/arrow.png Binary files differdeleted file mode 100644 index 4c215b2bf7..0000000000 --- a/src/components/qt_hmi/res/arrow.png +++ /dev/null diff --git a/src/components/qt_hmi/res/blue_ball.png b/src/components/qt_hmi/res/blue_ball.png Binary files differdeleted file mode 100644 index d4db3f96ae..0000000000 --- a/src/components/qt_hmi/res/blue_ball.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/long_oval_btn.png b/src/components/qt_hmi/res/buttons/long_oval_btn.png Binary files differdeleted file mode 100644 index 375195bec3..0000000000 --- a/src/components/qt_hmi/res/buttons/long_oval_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/long_oval_pressed_btn.png b/src/components/qt_hmi/res/buttons/long_oval_pressed_btn.png Binary files differdeleted file mode 100644 index bd4ba813d5..0000000000 --- a/src/components/qt_hmi/res/buttons/long_oval_pressed_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/longest_oval_btn.png b/src/components/qt_hmi/res/buttons/longest_oval_btn.png Binary files differdeleted file mode 100644 index 6ed0293aab..0000000000 --- a/src/components/qt_hmi/res/buttons/longest_oval_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/longest_oval_btn_pressed.png b/src/components/qt_hmi/res/buttons/longest_oval_btn_pressed.png Binary files differdeleted file mode 100644 index 73ee397da6..0000000000 --- a/src/components/qt_hmi/res/buttons/longest_oval_btn_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/oval_btn_bottom.png b/src/components/qt_hmi/res/buttons/oval_btn_bottom.png Binary files differdeleted file mode 100644 index 4964b4787a..0000000000 --- a/src/components/qt_hmi/res/buttons/oval_btn_bottom.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/oval_btn_left.png b/src/components/qt_hmi/res/buttons/oval_btn_left.png Binary files differdeleted file mode 100644 index 4818162a19..0000000000 --- a/src/components/qt_hmi/res/buttons/oval_btn_left.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/oval_btn_pressed_left.png b/src/components/qt_hmi/res/buttons/oval_btn_pressed_left.png Binary files differdeleted file mode 100644 index 29c47e189f..0000000000 --- a/src/components/qt_hmi/res/buttons/oval_btn_pressed_left.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/oval_btn_pressed_right.png b/src/components/qt_hmi/res/buttons/oval_btn_pressed_right.png Binary files differdeleted file mode 100644 index c7d7d53ab6..0000000000 --- a/src/components/qt_hmi/res/buttons/oval_btn_pressed_right.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/oval_btn_right.png b/src/components/qt_hmi/res/buttons/oval_btn_right.png Binary files differdeleted file mode 100644 index d566ac8ca5..0000000000 --- a/src/components/qt_hmi/res/buttons/oval_btn_right.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/oval_btn_top.png b/src/components/qt_hmi/res/buttons/oval_btn_top.png Binary files differdeleted file mode 100644 index 787e0990e2..0000000000 --- a/src/components/qt_hmi/res/buttons/oval_btn_top.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/player_next_btn.png b/src/components/qt_hmi/res/buttons/player_next_btn.png Binary files differdeleted file mode 100644 index c432068d4a..0000000000 --- a/src/components/qt_hmi/res/buttons/player_next_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/player_next_pressed_btn.png b/src/components/qt_hmi/res/buttons/player_next_pressed_btn.png Binary files differdeleted file mode 100644 index aab3df8914..0000000000 --- a/src/components/qt_hmi/res/buttons/player_next_pressed_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/player_pause_btn.png b/src/components/qt_hmi/res/buttons/player_pause_btn.png Binary files differdeleted file mode 100644 index a9443feb8b..0000000000 --- a/src/components/qt_hmi/res/buttons/player_pause_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/player_pause_pressed_btn.png b/src/components/qt_hmi/res/buttons/player_pause_pressed_btn.png Binary files differdeleted file mode 100644 index 9c409c8f17..0000000000 --- a/src/components/qt_hmi/res/buttons/player_pause_pressed_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/player_play_btn.png b/src/components/qt_hmi/res/buttons/player_play_btn.png Binary files differdeleted file mode 100644 index f185e94461..0000000000 --- a/src/components/qt_hmi/res/buttons/player_play_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/player_play_pressed_btn.png b/src/components/qt_hmi/res/buttons/player_play_pressed_btn.png Binary files differdeleted file mode 100644 index ecbb4f2ef0..0000000000 --- a/src/components/qt_hmi/res/buttons/player_play_pressed_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/player_prev_btn.png b/src/components/qt_hmi/res/buttons/player_prev_btn.png Binary files differdeleted file mode 100644 index acc2a71de3..0000000000 --- a/src/components/qt_hmi/res/buttons/player_prev_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/player_prev_pressed_btn.png b/src/components/qt_hmi/res/buttons/player_prev_pressed_btn.png Binary files differdeleted file mode 100644 index c6eefc09c9..0000000000 --- a/src/components/qt_hmi/res/buttons/player_prev_pressed_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/preset_btn.png b/src/components/qt_hmi/res/buttons/preset_btn.png Binary files differdeleted file mode 100644 index 58c296a4e4..0000000000 --- a/src/components/qt_hmi/res/buttons/preset_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/preset_pressed_btn.png b/src/components/qt_hmi/res/buttons/preset_pressed_btn.png Binary files differdeleted file mode 100644 index fd7606fbd6..0000000000 --- a/src/components/qt_hmi/res/buttons/preset_pressed_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/round_btn.png b/src/components/qt_hmi/res/buttons/round_btn.png Binary files differdeleted file mode 100644 index 3add8dd21c..0000000000 --- a/src/components/qt_hmi/res/buttons/round_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/round_pressed_btn.png b/src/components/qt_hmi/res/buttons/round_pressed_btn.png Binary files differdeleted file mode 100644 index b0f8863423..0000000000 --- a/src/components/qt_hmi/res/buttons/round_pressed_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/short_oval_btn.png b/src/components/qt_hmi/res/buttons/short_oval_btn.png Binary files differdeleted file mode 100644 index 99f5e90c3d..0000000000 --- a/src/components/qt_hmi/res/buttons/short_oval_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/short_oval_btn_pressed.png b/src/components/qt_hmi/res/buttons/short_oval_btn_pressed.png Binary files differdeleted file mode 100644 index 6b8bc61d80..0000000000 --- a/src/components/qt_hmi/res/buttons/short_oval_btn_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/zoom.png b/src/components/qt_hmi/res/buttons/zoom.png Binary files differdeleted file mode 100644 index 0df4d25109..0000000000 --- a/src/components/qt_hmi/res/buttons/zoom.png +++ /dev/null diff --git a/src/components/qt_hmi/res/buttons/zoom_pressed.png b/src/components/qt_hmi/res/buttons/zoom_pressed.png Binary files differdeleted file mode 100644 index c67d2c7c55..0000000000 --- a/src/components/qt_hmi/res/buttons/zoom_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/car.png b/src/components/qt_hmi/res/car.png Binary files differdeleted file mode 100644 index 18a21656d0..0000000000 --- a/src/components/qt_hmi/res/car.png +++ /dev/null diff --git a/src/components/qt_hmi/res/change_devices.png b/src/components/qt_hmi/res/change_devices.png Binary files differdeleted file mode 100644 index 24a43a0d32..0000000000 --- a/src/components/qt_hmi/res/change_devices.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/AC_off.png b/src/components/qt_hmi/res/climate/AC_off.png Binary files differdeleted file mode 100644 index 8554ddfb4c..0000000000 --- a/src/components/qt_hmi/res/climate/AC_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/AC_on.png b/src/components/qt_hmi/res/climate/AC_on.png Binary files differdeleted file mode 100644 index c549010d6b..0000000000 --- a/src/components/qt_hmi/res/climate/AC_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/climate_round_off_btn.png b/src/components/qt_hmi/res/climate/climate_round_off_btn.png Binary files differdeleted file mode 100644 index 411f003938..0000000000 --- a/src/components/qt_hmi/res/climate/climate_round_off_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/climate_round_on_btn.png b/src/components/qt_hmi/res/climate/climate_round_on_btn.png Binary files differdeleted file mode 100644 index 691f6e3bf8..0000000000 --- a/src/components/qt_hmi/res/climate/climate_round_on_btn.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/defrost_off.png b/src/components/qt_hmi/res/climate/defrost_off.png Binary files differdeleted file mode 100644 index 22e384dbc0..0000000000 --- a/src/components/qt_hmi/res/climate/defrost_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/defrost_on.png b/src/components/qt_hmi/res/climate/defrost_on.png Binary files differdeleted file mode 100644 index 9b0fc7aa43..0000000000 --- a/src/components/qt_hmi/res/climate/defrost_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/face_off.png b/src/components/qt_hmi/res/climate/face_off.png Binary files differdeleted file mode 100644 index 72448d6aaf..0000000000 --- a/src/components/qt_hmi/res/climate/face_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/face_on.png b/src/components/qt_hmi/res/climate/face_on.png Binary files differdeleted file mode 100644 index 4ed6089800..0000000000 --- a/src/components/qt_hmi/res/climate/face_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/feet_off.png b/src/components/qt_hmi/res/climate/feet_off.png Binary files differdeleted file mode 100644 index bac7bc9cfb..0000000000 --- a/src/components/qt_hmi/res/climate/feet_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/feet_on.png b/src/components/qt_hmi/res/climate/feet_on.png Binary files differdeleted file mode 100644 index 6d7a3b7a14..0000000000 --- a/src/components/qt_hmi/res/climate/feet_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/headed_dash_off.png b/src/components/qt_hmi/res/climate/headed_dash_off.png Binary files differdeleted file mode 100644 index cf5168b559..0000000000 --- a/src/components/qt_hmi/res/climate/headed_dash_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/headed_dash_on.png b/src/components/qt_hmi/res/climate/headed_dash_on.png Binary files differdeleted file mode 100644 index c46b690f7f..0000000000 --- a/src/components/qt_hmi/res/climate/headed_dash_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/heated_seat_off.png b/src/components/qt_hmi/res/climate/heated_seat_off.png Binary files differdeleted file mode 100644 index 11a32048c9..0000000000 --- a/src/components/qt_hmi/res/climate/heated_seat_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/heated_seat_on.png b/src/components/qt_hmi/res/climate/heated_seat_on.png Binary files differdeleted file mode 100644 index 8211eb79e5..0000000000 --- a/src/components/qt_hmi/res/climate/heated_seat_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/heated_wheel_off.png b/src/components/qt_hmi/res/climate/heated_wheel_off.png Binary files differdeleted file mode 100644 index 5956f5a3dc..0000000000 --- a/src/components/qt_hmi/res/climate/heated_wheel_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/climate/heated_wheel_on.png b/src/components/qt_hmi/res/climate/heated_wheel_on.png Binary files differdeleted file mode 100644 index af3c2598da..0000000000 --- a/src/components/qt_hmi/res/climate/heated_wheel_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/DownButton.png b/src/components/qt_hmi/res/controlButtons/DownButton.png Binary files differdeleted file mode 100644 index fd44c5438c..0000000000 --- a/src/components/qt_hmi/res/controlButtons/DownButton.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/DownButton_pressed.png b/src/components/qt_hmi/res/controlButtons/DownButton_pressed.png Binary files differdeleted file mode 100644 index 013672bbf9..0000000000 --- a/src/components/qt_hmi/res/controlButtons/DownButton_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/LeftButton.png b/src/components/qt_hmi/res/controlButtons/LeftButton.png Binary files differdeleted file mode 100644 index e65dd5ce04..0000000000 --- a/src/components/qt_hmi/res/controlButtons/LeftButton.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/LeftButton_pressed.png b/src/components/qt_hmi/res/controlButtons/LeftButton_pressed.png Binary files differdeleted file mode 100644 index 8df2e136ef..0000000000 --- a/src/components/qt_hmi/res/controlButtons/LeftButton_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/OkButton.png b/src/components/qt_hmi/res/controlButtons/OkButton.png Binary files differdeleted file mode 100644 index 9e82fe298b..0000000000 --- a/src/components/qt_hmi/res/controlButtons/OkButton.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/OkButton_pressed.png b/src/components/qt_hmi/res/controlButtons/OkButton_pressed.png Binary files differdeleted file mode 100644 index 478d9ef7e5..0000000000 --- a/src/components/qt_hmi/res/controlButtons/OkButton_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/RightButton.png b/src/components/qt_hmi/res/controlButtons/RightButton.png Binary files differdeleted file mode 100644 index 24e0f50a88..0000000000 --- a/src/components/qt_hmi/res/controlButtons/RightButton.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/RightButton_pressed.png b/src/components/qt_hmi/res/controlButtons/RightButton_pressed.png Binary files differdeleted file mode 100644 index 9e70d8d729..0000000000 --- a/src/components/qt_hmi/res/controlButtons/RightButton_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/UpButton.png b/src/components/qt_hmi/res/controlButtons/UpButton.png Binary files differdeleted file mode 100644 index 3547a7fc70..0000000000 --- a/src/components/qt_hmi/res/controlButtons/UpButton.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/UpButton_pressed.png b/src/components/qt_hmi/res/controlButtons/UpButton_pressed.png Binary files differdeleted file mode 100644 index 2cbcfbe679..0000000000 --- a/src/components/qt_hmi/res/controlButtons/UpButton_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/backGroundControllButtons.png b/src/components/qt_hmi/res/controlButtons/backGroundControllButtons.png Binary files differdeleted file mode 100644 index 041d49e7e9..0000000000 --- a/src/components/qt_hmi/res/controlButtons/backGroundControllButtons.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/vrButton.png b/src/components/qt_hmi/res/controlButtons/vrButton.png Binary files differdeleted file mode 100644 index af09282dff..0000000000 --- a/src/components/qt_hmi/res/controlButtons/vrButton.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/vrButton_pressed.png b/src/components/qt_hmi/res/controlButtons/vrButton_pressed.png Binary files differdeleted file mode 100644 index 9206e42a95..0000000000 --- a/src/components/qt_hmi/res/controlButtons/vrButton_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/controlButtons/vrImage.png b/src/components/qt_hmi/res/controlButtons/vrImage.png Binary files differdeleted file mode 100644 index 2f6bac2d9f..0000000000 --- a/src/components/qt_hmi/res/controlButtons/vrImage.png +++ /dev/null diff --git a/src/components/qt_hmi/res/find_apps.png b/src/components/qt_hmi/res/find_apps.png Binary files differdeleted file mode 100644 index 55a9a28676..0000000000 --- a/src/components/qt_hmi/res/find_apps.png +++ /dev/null diff --git a/src/components/qt_hmi/res/gear.png b/src/components/qt_hmi/res/gear.png Binary files differdeleted file mode 100644 index b1eeba091c..0000000000 --- a/src/components/qt_hmi/res/gear.png +++ /dev/null diff --git a/src/components/qt_hmi/res/hd_logo_off.png b/src/components/qt_hmi/res/hd_logo_off.png Binary files differdeleted file mode 100644 index 80c9d58b46..0000000000 --- a/src/components/qt_hmi/res/hd_logo_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/hd_logo_on.png b/src/components/qt_hmi/res/hd_logo_on.png Binary files differdeleted file mode 100644 index dfc3d4ccf1..0000000000 --- a/src/components/qt_hmi/res/hd_logo_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/initial.wav b/src/components/qt_hmi/res/initial.wav Binary files differdeleted file mode 100644 index 61a549fbc6..0000000000 --- a/src/components/qt_hmi/res/initial.wav +++ /dev/null diff --git a/src/components/qt_hmi/res/install_apps.png b/src/components/qt_hmi/res/install_apps.png Binary files differdeleted file mode 100644 index dc33c0965c..0000000000 --- a/src/components/qt_hmi/res/install_apps.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/compass.png b/src/components/qt_hmi/res/nav/compass.png Binary files differdeleted file mode 100644 index 15c73ee878..0000000000 --- a/src/components/qt_hmi/res/nav/compass.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/current_street.png b/src/components/qt_hmi/res/nav/current_street.png Binary files differdeleted file mode 100644 index e289c054ff..0000000000 --- a/src/components/qt_hmi/res/nav/current_street.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/delete_icon.png b/src/components/qt_hmi/res/nav/delete_icon.png Binary files differdeleted file mode 100644 index 826b5faacf..0000000000 --- a/src/components/qt_hmi/res/nav/delete_icon.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/delete_icon_black.png b/src/components/qt_hmi/res/nav/delete_icon_black.png Binary files differdeleted file mode 100644 index 56e35c759b..0000000000 --- a/src/components/qt_hmi/res/nav/delete_icon_black.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/dest_icon.png b/src/components/qt_hmi/res/nav/dest_icon.png Binary files differdeleted file mode 100644 index dadcfe25cf..0000000000 --- a/src/components/qt_hmi/res/nav/dest_icon.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/dest_icon_black.png b/src/components/qt_hmi/res/nav/dest_icon_black.png Binary files differdeleted file mode 100644 index 75c99bc4aa..0000000000 --- a/src/components/qt_hmi/res/nav/dest_icon_black.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/map.png b/src/components/qt_hmi/res/nav/map.png Binary files differdeleted file mode 100644 index 328bca44cf..0000000000 --- a/src/components/qt_hmi/res/nav/map.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/mute_off.png b/src/components/qt_hmi/res/nav/mute_off.png Binary files differdeleted file mode 100644 index f7306d96ae..0000000000 --- a/src/components/qt_hmi/res/nav/mute_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/mute_on.png b/src/components/qt_hmi/res/nav/mute_on.png Binary files differdeleted file mode 100644 index de2a2bb5bc..0000000000 --- a/src/components/qt_hmi/res/nav/mute_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/options.png b/src/components/qt_hmi/res/nav/options.png Binary files differdeleted file mode 100644 index 46887f1061..0000000000 --- a/src/components/qt_hmi/res/nav/options.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/options_in_active.png b/src/components/qt_hmi/res/nav/options_in_active.png Binary files differdeleted file mode 100644 index 601b242bbe..0000000000 --- a/src/components/qt_hmi/res/nav/options_in_active.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/options_pressed.png b/src/components/qt_hmi/res/nav/options_pressed.png Binary files differdeleted file mode 100644 index 42c352a7e8..0000000000 --- a/src/components/qt_hmi/res/nav/options_pressed.png +++ /dev/null diff --git a/src/components/qt_hmi/res/nav/turnArrow.png b/src/components/qt_hmi/res/nav/turnArrow.png Binary files differdeleted file mode 100644 index f37731f5af..0000000000 --- a/src/components/qt_hmi/res/nav/turnArrow.png +++ /dev/null diff --git a/src/components/qt_hmi/res/notes.png b/src/components/qt_hmi/res/notes.png Binary files differdeleted file mode 100644 index 8b4a92fffc..0000000000 --- a/src/components/qt_hmi/res/notes.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/contacts.png b/src/components/qt_hmi/res/phone/contacts.png Binary files differdeleted file mode 100644 index a16d518ba8..0000000000 --- a/src/components/qt_hmi/res/phone/contacts.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/dnd_off.png b/src/components/qt_hmi/res/phone/dnd_off.png Binary files differdeleted file mode 100644 index 04bb2476c1..0000000000 --- a/src/components/qt_hmi/res/phone/dnd_off.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/dnd_on.png b/src/components/qt_hmi/res/phone/dnd_on.png Binary files differdeleted file mode 100644 index 56b9fe7065..0000000000 --- a/src/components/qt_hmi/res/phone/dnd_on.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/keypad.png b/src/components/qt_hmi/res/phone/keypad.png Binary files differdeleted file mode 100644 index 1792c8fac8..0000000000 --- a/src/components/qt_hmi/res/phone/keypad.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/messages.png b/src/components/qt_hmi/res/phone/messages.png Binary files differdeleted file mode 100644 index b5cbb8e8af..0000000000 --- a/src/components/qt_hmi/res/phone/messages.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/more.png b/src/components/qt_hmi/res/phone/more.png Binary files differdeleted file mode 100644 index 908ebf654e..0000000000 --- a/src/components/qt_hmi/res/phone/more.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/phone.png b/src/components/qt_hmi/res/phone/phone.png Binary files differdeleted file mode 100644 index 346f36cc33..0000000000 --- a/src/components/qt_hmi/res/phone/phone.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/recent.png b/src/components/qt_hmi/res/phone/recent.png Binary files differdeleted file mode 100644 index db54c2f16e..0000000000 --- a/src/components/qt_hmi/res/phone/recent.png +++ /dev/null diff --git a/src/components/qt_hmi/res/phone/texts.png b/src/components/qt_hmi/res/phone/texts.png Binary files differdeleted file mode 100644 index 31c024b1df..0000000000 --- a/src/components/qt_hmi/res/phone/texts.png +++ /dev/null diff --git a/src/components/qt_hmi/res/snow.png b/src/components/qt_hmi/res/snow.png Binary files differdeleted file mode 100644 index 54756bb2f6..0000000000 --- a/src/components/qt_hmi/res/snow.png +++ /dev/null diff --git a/src/components/qt_hmi/res/vehicle/cal.png b/src/components/qt_hmi/res/vehicle/cal.png Binary files differdeleted file mode 100644 index 94d5d44b5a..0000000000 --- a/src/components/qt_hmi/res/vehicle/cal.png +++ /dev/null diff --git a/src/components/qt_hmi/res/vehicle/folders.png b/src/components/qt_hmi/res/vehicle/folders.png Binary files differdeleted file mode 100644 index c5985043df..0000000000 --- a/src/components/qt_hmi/res/vehicle/folders.png +++ /dev/null diff --git a/src/components/qt_hmi/res/vehicle/key_car.png b/src/components/qt_hmi/res/vehicle/key_car.png Binary files differdeleted file mode 100644 index a8e5d9d66c..0000000000 --- a/src/components/qt_hmi/res/vehicle/key_car.png +++ /dev/null diff --git a/src/components/qt_hmi/res/vehicle/sun.png b/src/components/qt_hmi/res/vehicle/sun.png Binary files differdeleted file mode 100644 index 6424d9d210..0000000000 --- a/src/components/qt_hmi/res/vehicle/sun.png +++ /dev/null diff --git a/src/components/qt_hmi/res/warning.png b/src/components/qt_hmi/res/warning.png Binary files differdeleted file mode 100644 index c91cd31d34..0000000000 --- a/src/components/qt_hmi/res/warning.png +++ /dev/null diff --git a/src/components/qt_hmi/res/white_ball.png b/src/components/qt_hmi/res/white_ball.png Binary files differdeleted file mode 100644 index 952714ebe6..0000000000 --- a/src/components/qt_hmi/res/white_ball.png +++ /dev/null diff --git a/src/components/qt_hmi/test/CMakeLists.txt b/src/components/qt_hmi/test/CMakeLists.txt deleted file mode 100644 index 91ec2cd20c..0000000000 --- a/src/components/qt_hmi/test/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -# Copyright (c) 2014, Ford Motor Company -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following -# disclaimer in the documentation and/or other materials provided with the -# distribution. -# -# Neither the name of the Ford Motor Company nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - - -cmake_minimum_required(VERSION 2.8.11) - -set(QT_HMI_TESTS_LIST - ${COMPONENTS_DIR}/qt_hmi/test/src/tst_AddCommand.qml - ${COMPONENTS_DIR}/qt_hmi/test/src/tst_AddSubMenu.qml - ${COMPONENTS_DIR}/qt_hmi/test/src/tst_DeleteCommand.qml - ${COMPONENTS_DIR}/qt_hmi/test/src/tst_ScrollableMessage.qml - ${COMPONENTS_DIR}/qt_hmi/test/src/tst_SetMediaClockTimer.qml - ${COMPONENTS_DIR}/qt_hmi/test/src/tst_Show.qml - ${COMPONENTS_DIR}/qt_hmi/test/src/tst_Slider.qml - ${COMPONENTS_DIR}/qt_hmi/test/readme.txt -) - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} -) - -set(CONFIG - warn_on - qmltestcase -) - -set(SOURCES - qt_hmi_test.cc -) - -set(target qt_hmi_test) - -create_test("qt_hmi_test" "${SOURCES}" "") -qt5_use_modules(${target} Core Qml Quick QuickTest) - -foreach( file_i ${QT_HMI_TESTS_LIST}) - file(COPY ${file_i} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -endforeach( file_i ) - diff --git a/src/components/qt_hmi/test/readme.txt b/src/components/qt_hmi/test/readme.txt deleted file mode 100644 index e169a4eb87..0000000000 --- a/src/components/qt_hmi/test/readme.txt +++ /dev/null @@ -1,14 +0,0 @@ -A few comments on test writting for QML Unit Testing - -- set TestCase inside Item - this allows to send Mouse and keyboard events to controls -- content of QML is reachable directly from tests. It is necessary to add getters into - source QML file to handle internal items -- test execution order is alfabetical. If you need manage this order use numbers in test function names -- all functions that starts with "test_" prefix is treated as test case -- all files that starts with "tst_" prefix will be executed as test set -- for async testing use timer -- each system's entity that changes during RPC must be tested -- test incoming arguments is not necessary as it will be verified by Qt abstraction layer -- run test with following command: - "./qt_hmi_test -import ../git push qml_model_qt5/" - diff --git a/src/components/qt_hmi/test/src/tst_AddCommand.qml b/src/components/qt_hmi/test/src/tst_AddCommand.qml deleted file mode 100644 index e71fb66b11..0000000000 --- a/src/components/qt_hmi/test/src/tst_AddCommand.qml +++ /dev/null @@ -1,320 +0,0 @@ -/** - * @file tst_AddSubMenu.qml - * @brief Test Case for OptionsView. - * 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. - */ - -import QtTest 1.0 -import QtQuick 2.0 -import QtMultimedia 5.0 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.hw_buttons 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import "../qml_model_qt5/controls" -import "../qml_model_qt5/views" -import "../qml_model_qt5/hmi_api" as HmiApi -import "../qml_model_qt5/models" -import "../qml_model_qt5/popups" -import "../qml_model_qt5/hmi_api/Common.js" as Common -import "../qml_model_qt5/models/Constants.js" as Constants -import "../qml_model_qt5/models/Internal.js" as Internal - -Item { - width : mainWindowLoader.width - height: mainWindowLoader.height - - Loader { - id: mainWindowLoader - asynchronous : false - } - - TestCase { - name: "AddCommand" - when: windowShown - property var dataContainer - property var sdlUIProxy - property var contentLoader - property var messageModel - - function createView(appID) { - mainWindowLoader.source = "../qml_model_qt5/MainWindow.qml" - var mainWindowObject = mainWindowLoader.item - sdlUIProxy = mainWindowObject.getUIProxy() - dataContainer = mainWindowObject.getDataStorage() - dataContainer.addApplication({appName:"TestAppName", appId:appID}) - } - - function destroyView() { - mainWindowLoader.source = "" - } - - /* - * Test Cases - */ - - function test_01_addCommand_Command_Positive() { - console.debug("enter") - - var initData = { - cmdID: 1, - cmdIcon: { - value: "123.jpg", - imageType: "DYNAMIC" - }, - menuParams: { - position: 500, - menuName: "Command positive" - }, - appID: 1 - } - - createView(initData.appID) - sdlUIProxy.addCommand(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.cmdID, "Command id") - compare(app.options.get(0).position, initData.menuParams.position, "Command position") - compare(app.options.get(0).name, initData.menuParams.menuName, "Command name") - compare(app.options.get(0).icon.value, initData.cmdIcon.value, "Image path") - - destroyView() - console.debug("exit") - } - - function test_02_addCommand_Without_Position() { - console.debug("enter") - var initData = { - appID: 1, - Commands: [] - } - initData.Commands.push({ - cmdID:1, - comIcon: { - value: "123.jpg", - imageType: "DYNAMIC" - }, - menuParams: { - menuName: "Command 1" - }, - appID: 1 - }) - initData.Commands.push({ - cmdID:2, - cmdIcon: { - value: "345.jpg", - imageType: "DYNAMIC" - }, - menuParams: { - position: 500, - menuName: "Command 1" - }, - appID: 1 - }) - createView(initData.appID) - sdlUIProxy.addCommand(initData.Commands[0]) - sdlUIProxy.addCommand(initData.Commands[1]) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(1).id, initData.Commands[0].cmdID, "Command id") - compare(app.options.get(1).name, initData.Commands[0].menuParams.menuName, "Command name") - compare(app.options.get(0).id, initData.Commands[1].cmdID, "Command id") - compare(app.options.get(0).name, initData.Commands[1].menuParams.menuName, "Command name") - - destroyView() - console.debug("exit") - } - - function test_03_1010_addCommands() { - console.debug("enter") - var initData = { - appID: 1, - Commands: [] - } - - for (var i = 0; i < 1010; i++) { - initData.Commands.push({ - cmdID: i, - cmdIcon: { - value: "", - imageType: "" - }, - menuParams: { - position: i, - menuName: "Command " + i - }, - appID: 1 - }) - } - - createView(initData.appID) - for (var i = 0; i < initData.Commands.length; i++) { - sdlUIProxy.addCommand(initData.Commands[i]) - } - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.count, 1000, "Command count") - - for (var i = 0; i < 1000; i++) { - compare(app.options.get(i).id, initData.Commands[i].cmdID, "Command id") - compare(app.options.get(i).position, initData.Commands[i].menuParams.position, "Command position") - compare(app.options.get(i).name, initData.Commands[i].menuParams.menuName, "Command name") - } - - destroyView() - console.debug("exit") - } - - function test_04_Command_Upper_Bound() { - console.debug("enter") - var initData = { - cmdID: 2000000000, - cmdIcon: { - value: "00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890aAaaaaaaaaaaaaaa", - imageType: "" - }, - menuParams: { - position: 100000, - menuName: "00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890aAaaaaaaaaaaaaaa" - }, - appID: 1 - } - - createView(initData.appID) - sdlUIProxy.addCommand(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.cmdID, "Command id") - compare(app.options.get(0).position, initData.menuParams.position, "Command position") - compare(app.options.get(0).name.length, initData.menuParams.menuName.length, "Command name") - compare(app.options.get(0).icon.value.length, initData.cmdIcon.value.length, "Image path") - - destroyView() - console.debug("exit") - } - - function test_05_addCommand_Lower_Bound() { - console.debug("enter") - var initData = { - cmdID: 0, - cmdIcon: { - value: "", - imageType: "" - }, - menuParams: { - position: 0, - menuName: "0", - parentID: 0 - }, - appID: 0 - } - - createView(initData.appID) - sdlUIProxy.addCommand(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.cmdID, "Command id") - compare(app.options.get(0).position, initData.menuParams.position, "Command position") - compare(app.options.get(0).name, initData.menuParams.menuName, "Command name") - compare(app.options.get(0).icon.value, initData.cmdIcon.value, "Image path") - - destroyView() - console.debug("exit") - } - - function test_06_addCommand_With_Fake_Parameter() { - console.debug("enter") - var initData = { - cmdID: 1, - cmdIcon: { - value: "345.jpg", - imageType: "DYNAMIC" - }, - menuParams: { - menuName: "Command fake param", - position: 1, - fakeParam: "fakeParam" - }, - appID: 1 - } - - createView(initData.appID) - sdlUIProxy.addCommand(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.cmdID, "Command id") - compare(app.options.get(0).position, initData.menuParams.position, "Command position") - compare(app.options.get(0).name, initData.menuParams.menuName, "Command name") - compare(app.options.get(0).icon.value, initData.cmdIcon.value, "Image path") - - destroyView() - console.debug("exit") - } - - function test_07_addCommand_No_Menu_Params() { - console.debug("enter") - - var initData = { - appID: 1, - Commands:[] - } - - var n = 10; - initData.Commands.push({ - cmdID: 123, - menuParams: {}, - appID: 1 - }) - for (var i = 0; i < n; i++) { - initData.Commands.push({ - cmdID: i, - menuParams: { - position: i, - menuName: "Command " + i - }, - appID: 1 - }) - } - - createView(initData.appID) - for (var i = 0; i < initData.Commands.length; i++) { - sdlUIProxy.addCommand(initData.Commands[i]) - } - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.count, initData.Commands.length, "Command count") - compare(app.options.get(n).id, initData.Commands[0].cmdID, "Command 11 id") - compare(app.options.get(0).id, initData.Commands[1].cmdID, "Command 12 id") - - destroyView() - console.debug("exit") - } - } -} diff --git a/src/components/qt_hmi/test/src/tst_AddSubMenu.qml b/src/components/qt_hmi/test/src/tst_AddSubMenu.qml deleted file mode 100644 index 7f9477cab1..0000000000 --- a/src/components/qt_hmi/test/src/tst_AddSubMenu.qml +++ /dev/null @@ -1,328 +0,0 @@ -/** - * @file tst_AddSubMenu.qml - * @brief Test Case for OptionsView. - * 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. - */ - - -import QtTest 1.0 -import QtQuick 2.0 -import QtMultimedia 5.0 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.hw_buttons 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import "../qml_model_qt5/controls" -import "../qml_model_qt5/views" -import "../qml_model_qt5/hmi_api" as HmiApi -import "../qml_model_qt5/models" -import "../qml_model_qt5/popups" -import "../qml_model_qt5/hmi_api/Common.js" as Common -import "../qml_model_qt5/models/Constants.js" as Constants -import "../qml_model_qt5/models/Internal.js" as Internal - -Item { - width : mainWindowLoader.width - height: mainWindowLoader.height - - Loader { - id: mainWindowLoader - asynchronous : false - } - - TestCase { - name: "AddSubMenu" - when: windowShown - property var dataContainer - property var sdlUIProxy - property var contentLoader - property var messageModel - - //initialization for each test - function createMessageView(appID) { - mainWindowLoader.source = "" - mainWindowLoader.source = "../qml_model_qt5/MainWindow.qml" - var mainWindowObject = mainWindowLoader.item - if(!mainWindowObject) - qtest_fail("mainWindowObject is undefined"); - var mainScreen = mainWindowObject.getMainScreen() - mainScreen.visible = true - var warningInfo = mainWindowObject.getWarningInfo() - warningInfo.visible = false - contentLoader = mainWindowObject.getContentLoader() - contentLoader.asynchronous = false - sdlUIProxy = mainWindowObject.getUIProxy() - dataContainer = mainWindowObject.getDataStorage() - dataContainer.addApplication({appName:"TestAppName", appId:appID}) - } - - //cleanup for each test - function destroyView() { - //Clear Loader with MainWindow, which delete own models and views - mainWindowLoader.source = "" - } - - /* - * Test Cases - */ - - //Positive case and in boundary conditions - function test_01_addSubMenu() { - console.debug("enter") - var initData = { - menuID: 1000, - menuParams: { - position: 500, - menuName: "SubMenu positive" - }, - appID: 1 - } - - createMessageView(initData.appID) - sdlUIProxy.addSubMenu(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.menuID, "SubMenu id") - compare(app.options.get(0).position, initData.menuParams.position, "SubMenu position") - compare(app.options.get(0).name, initData.menuParams.menuName, "SubMenu name") - - destroyView() - console.debug("exit") - } - - // Only mandatory - without Position - function test_02_addSubMenu_WithoutPosition() { - console.debug("enter") - var initData = { - menuID: 1001, - menuParams: { - menuName: "SubMenu mandatory only" - }, - appID: 1 - } - - createMessageView(initData.appID) - sdlUIProxy.addSubMenu(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.menuID, "SubMenu id") - //How to verify if value was not set? - //compare(app.options.get(0).position, initData.menuParams.position, "SubMenu position") - compare(app.options.get(0).name, initData.menuParams.menuName, "SubMenu name") - - destroyView() - console.debug("exit") - } - - //Create AddSubMenu and check data - function test_03_1000_SubMenu() { - console.debug("enter") - var initData = { - appID: 1, - subMenus: [] - } - - for (var i = 0; i < 1010; i++) { - - initData.subMenus.push({ - menuID: i, - menuParams: { - position: i, - menuName: "Submenu" + i - }, - appID: 1 - }) - } - - createMessageView(initData.appID) - for (var i = 0; i < initData.subMenus.length; i++) { - sdlUIProxy.addSubMenu(initData.subMenus[i]) - } - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.count, 1000, "SubMenus count") - - for (var i = 0; i < 1000; i++) { - compare(app.options.get(i).id, initData.subMenus[i].menuID, "SubMenu id") - compare(app.options.get(i).position, initData.subMenus[i].menuParams.position, "SubMenu position") - compare(app.options.get(i).name, initData.subMenus[i].menuParams.menuName, "SubMenu name") - } - - destroyView() - console.debug("exit") - } - - //Create AddSubMenu and check data - function test_04_addSubMenu_UpperBound() { - console.debug("enter") - var initData = { - menuID: 2000000000, - menuParams: { - position: 1000, - menuName: "00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890a00012å/678'90abc!def@ghi#jkl$mno%pqr^stu*vwx:yz()ABC-DEF_GHI=JKL+MNO|PQR~STU{}WXY[]Z,01234567890aAaaaaaaaaaaaaaa" - }, - appID: 1 - } - - createMessageView(initData.appID) - sdlUIProxy.addSubMenu(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.menuID, "SubMenu id") - compare(app.options.get(0).position, initData.menuParams.position, "SubMenu position") - compare(app.options.get(0).name.length, 500, "SubMenu name") - - destroyView() - console.debug("exit") - } - - //Create AddSubMenu and check data - function test_05_addSubMenu_LowerBound() { - console.debug("enter") - var initData = { - menuID: 0, - menuParams: { - position: 0, - menuName: "0" - }, - appID: 1 - } - - createMessageView(initData.appID) - sdlUIProxy.addSubMenu(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.menuID, "SubMenu id") - compare(app.options.get(0).position, initData.menuParams.position, "SubMenu position") - compare(app.options.get(0).name.length, 1, "SubMenu name") - - destroyView() - console.debug("exit") - } - - // With fake parameter - function test_06_addSubMenu_With_Fake_Parameter() { - console.debug("enter") - var initData = { - menuID: 1001, - menuParams: { - menuName: "SubMenu fake param", - position: 1, - fakeParam: "fakeParam" - }, - appID: 1 - } - - createMessageView(initData.appID) - sdlUIProxy.addSubMenu(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.get(0).id, initData.menuID, "SubMenu id") - compare(app.options.get(0).position, initData.menuParams.position, "SubMenu position") - compare(app.options.get(0).name, initData.menuParams.menuName, "SubMenu name") - - destroyView() - console.debug("exit") - } - - // With fake parameter - function test_07_addSubMenu_menuIDOutLowerBound() { - console.debug("enter") - var initData = { - menuID: -1, - menuParams: { - menuName: "100", - position: 1, - }, - appID: 1 - } - - createMessageView(initData.appID) - sdlUIProxy.addSubMenu(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.count, 0, "SubMenus count") - - compare(app.options.get(1), !undefined, "SubMenu duplicated") - - destroyView() - console.debug("exit") - } - - // With fake parameter - function test_08_addSubMenu_menuIDOutUpperBound() { - console.debug("enter") - var initData = { - menuID: 2000000001, - menuParams: { - menuName: "100", - position: 1, - }, - appID: 1 - } - - createMessageView(initData.appID) - sdlUIProxy.addSubMenu(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.count, 0, "SubMenus count") - - compare(app.options.get(1), !undefined, "SubMenu duplicated") - - destroyView() - console.debug("exit") - } - - // With fake parameter - function test_09_addSubMenu_duplicatedSubMenus() { - console.debug("enter") - var initData = { - menuID: 2000000001, - menuParams: { - menuName: "100", - position: 1, - }, - appID: 1 - } - - createMessageView(initData.appID) - sdlUIProxy.addSubMenu(initData) - sdlUIProxy.addSubMenu(initData) - var app = dataContainer.getApplication(initData.appID) - - compare(app.options.count, 1, "SubMenus count") - - compare(app.options.get(1), undefined, "SubMenu duplicated") - - destroyView() - console.debug("exit") - } - } -} diff --git a/src/components/qt_hmi/test/src/tst_DeleteCommand.qml b/src/components/qt_hmi/test/src/tst_DeleteCommand.qml deleted file mode 100644 index bf28be0282..0000000000 --- a/src/components/qt_hmi/test/src/tst_DeleteCommand.qml +++ /dev/null @@ -1,210 +0,0 @@ -/** - * @file tst_ScrollableMessage.qml - * @brief Test Case for ScrollableMessageView. - * 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. - */ - -import QtTest 1.0 -import QtQuick 2.0 -import QtMultimedia 5.0 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.hw_buttons 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import "../qml_model_qt5/controls" -import "../qml_model_qt5/views" -import "../qml_model_qt5/hmi_api" as HmiApi -import "../qml_model_qt5/models" -import "../qml_model_qt5/popups" -import "../qml_model_qt5/hmi_api/Common.js" as Common -import "../qml_model_qt5/models/Constants.js" as Constants -import "../qml_model_qt5/models/Internal.js" as Internal - -Item -{ - width : mainWindowLoader.width - height: mainWindowLoader.height - - Loader - { - id: mainWindowLoader - asynchronous : false - } - - TestCase - { - name: "DeleteCommand" - when: windowShown - property var dataContainer - property var sdlUIProxy - property var contentLoader - property var messageModel - - - //initialization for each test - function createMessageView(appID) - { - mainWindowLoader.source = "" - mainWindowLoader.source = "../qml_model_qt5/MainWindow.qml" - var mainWindowObject = mainWindowLoader.item - if(!mainWindowObject) - qtest_fail("mainWindowObject is undefined"); - var mainScreen = mainWindowObject.getMainScreen() - mainScreen.visible = true - var warningInfo = mainWindowObject.getWarningInfo() - warningInfo.visible = false - contentLoader = mainWindowObject.getContentLoader() - contentLoader.asynchronous = false - sdlUIProxy = mainWindowObject.getUIProxy() - dataContainer = mainWindowObject.getDataStorage() - dataContainer.addApplication({appName:"TestAppName", appId:appID}) - } - - //cleanup for each test - function destroyView() - { - //Clear Loader with MainWindow, which delete own models and views - mainWindowLoader.source = "" - } - - /* - * Test Cases - */ - - function test_01_deleteCommand() - { - console.debug("enter") - var initData = { - cmdID: 1, - menuParams: - { - menuName:"", - }, - cmdIcon:"", - appID: 1 - } - var initData2 = { - cmdID: 2, - menuParams: - { - menuName:"", - }, - cmdIcon:"", - appID: 1 - } - - createMessageView(initData.appID) - var app = dataContainer.getApplication(initData.appID) - var MenuCount = app.options.count - app.options.append( - { id: initData.cmdID, - name: initData.menuParams.menuName, - type: Internal.MenuItemType.MI_NODE, - position: Constants.positionOfElementWithoutPosition, - icon: initData.cmdIcon ? cmdIcon : {}, - subMenu: [] - } - ) - - compare(app.options.count, MenuCount+1, "Command into menu not added") - sdlUIProxy.deleteCommand(initData2) - - var a = 0 - for(var i = 0;((a === 0) && ( i < app.options.count)); i++) - { - if (app.options.get(i).id===initData2.menuID) - { - a = 1 - } - } - compare (a, 0, "Command in menu isn't removed") - - - destroyView() - console.debug("exit") - } - - function test_02_deleteCommand() { - console.debug("enter") - var initData = { - menuID: 1000, - menuParams: { - position: 1, - menuName: "SubMenu" - }, - appID: 1 - } - - var initData2 = { - cmdID: 1, - menuParams: { - menuName:"", - }, - cmdIcon:"", - appID: 1 - } - - createMessageView(initData.appID) - var app = dataContainer.getApplication(initData.appID) - var MenuCount = app.options.count - app.options.append ({ - "id": initData.menuID, - "name": initData.menuParams.menuName, - "position": initData.menuParams.position, - "type": Internal.MenuItemType.MI_SUBMENU, - "icon": undefined, - "subMenu":[{ - "id":initData2.cmdID, - "name": initData2.menuParams.menuName, - "position": Constants.positionOfElementWithoutPosition, - "type": Internal.MenuItemType.MI_PARENT, - "icon": { - "imageType": Common.ImageType.DYNAMIC, - "value": "../res/nav/turnArrow.png" - }, - - "subMenu": [] - }] - }) - - compare(app.options.count, MenuCount+1, "SubMenu into added") - var SubMenuCount = app.options.get(0).subMenu.count - compare( SubMenuCount, 1, "Command is not added into SubMenu") - - sdlUIProxy.deleteCommand(initData2) - - compare(app.options.count , MenuCount+1, "Menu is changed") - compare(app.options.get(0).subMenu.count, SubMenuCount-1, "Command into SubMenu is not removed") - - destroyView() - console.debug("exit") - } - } -} diff --git a/src/components/qt_hmi/test/src/tst_ScrollableMessage.qml b/src/components/qt_hmi/test/src/tst_ScrollableMessage.qml deleted file mode 100644 index abf3105b1a..0000000000 --- a/src/components/qt_hmi/test/src/tst_ScrollableMessage.qml +++ /dev/null @@ -1,421 +0,0 @@ -/** - * @file tst_ScrollableMessage.qml - * @brief Test Case for ScrollableMessageView. - * 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. - */ - - -import QtTest 1.0 -import QtQuick 2.0 -import QtMultimedia 5.0 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.hw_buttons 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import "../qml_model_qt5/controls" -import "../qml_model_qt5/views" -import "../qml_model_qt5/hmi_api" as HmiApi -import "../qml_model_qt5/models" -import "../qml_model_qt5/popups" -import "../qml_model_qt5/hmi_api/Common.js" as Common -import "../qml_model_qt5/models/Constants.js" as Constants -import "../qml_model_qt5/models/Internal.js" as Internal - -Item { - width : mainWindowLoader.width - height: mainWindowLoader.height - - Loader { - id: mainWindowLoader - asynchronous : false - } - - TestCase { - name: "ScrollableMessageView" - when: windowShown - property var dataContainer - property var sdlUIProxy - property var contentLoader - property var messageModel - property var messageView - property var timer - - property var softButtonsListExample : [ - {softButtonID:0, isHighlighted:true, systemAction:Common.SystemAction.DEFAULT_ACTION, - type:Common.SoftButtonType.SBT_TEXT, text:"Default Action"}, - {softButtonID:1, isHighlighted:false, systemAction:Common.SystemAction.STEAL_FOCUS, - type:Common.SoftButtonType.SBT_IMAGE, text:"Steal Focus"}, - {softButtonID:2, isHighlighted:false, systemAction:Common.SystemAction.KEEP_CONTEXT, - type:Common.SoftButtonType.SBT_BOTH, text:"Keep context"}] - - //initialization for each test - function createMessageView(appID) { - mainWindowLoader.source = "" - mainWindowLoader.source = "../qml_model_qt5/MainWindow.qml" - var mainWindowObject = mainWindowLoader.item - if(!mainWindowObject) - qtest_fail("mainWindowObject is undefined"); - var mainScreen = mainWindowObject.getMainScreen() - mainScreen.visible = true - var warningInfo = mainWindowObject.getWarningInfo() - warningInfo.visible = false - contentLoader = mainWindowObject.getContentLoader() - contentLoader.asynchronous = false - sdlUIProxy = mainWindowObject.getUIProxy() - dataContainer = mainWindowObject.getDataStorage() - dataContainer.addApplication({appName:"TestAppName", appId:appID}) - } - - //get messageModel and messageView after call @scrollableMessage - function getMessageViewModel() { - messageModel = dataContainer.scrollableMessageModel - if(!messageModel) - qtest_fail("messageModel is undefined"); - messageView = contentLoader.item - if(!messageView) - qtest_fail("messageView is undefined"); - } - - //cleanup for each test - function destroyView() { - //Clear Loader with MainWindow, which delete own models and views - mainWindowLoader.source = "" - } - - //return button from messageView by ommon.SystemAction - function findButtonByAction(systemAction){ - var listViewItems = messageView.getSoftButtonsListView() - for (var i = 0, len = listViewItems.count; i < len; i++) { - //get SoftButton by setting current item (ListView has no getter) - listViewItems.currentIndex = i - var buttonItem = listViewItems.currentItem - if (buttonItem.button.systemAction === systemAction) { - return buttonItem - } - } - } - - /* - * Test Cases - */ - - //Create ScrollableMessageView and check data - function test_01_create() { - console.debug("enter") - var initData = {appID:1, timeout:2000, - messageText:{fieldText:"Simple ScrollableMessage text"}, - softButtons:softButtonsListExample} - createMessageView(initData.appID) - - var result = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - verify(result.__errno === undefined, "ScrollableMessage return error state") - timer = messageView.getTimer() - if(!timer) - qtest_fail("timer is undefined"); - //check button equals to init data - compare(messageModel.softButtons.count, initData.softButtons.length, "wrong buttons count created") - for (var i = 0, len = messageModel.softButtons.count; i < len; i++) { - var act = messageModel.softButtons.get(i) - var exp = initData.softButtons[i] - compare(act.softButtonID, exp.softButtonID, "wrong softButtonID in button") - compare(act.isHighlighted, exp.isHighlighted, "wrong isHighlighted in button") - compare(act.systemAction, exp.systemAction, "wrong systemAction in button") - compare(act.text, exp.text, "wrong text in button") - } - //check model data equals to init data - compare(messageModel.running, true, "ScrollableMessage didn't start") - compare(messageModel.longMessageText, initData.messageText.fieldText, "wrong messageText") - compare(messageModel.appId, initData.appID, "wrong application ID") - compare(messageModel.timeout, initData.timeout, "wrong timeout") - verify(messageModel.async !== undefined, "async in undefined") - destroyView() - console.debug("exit") - } - - //Create ScrollableMessageView with empty data - function test_02_emptyInit() { - console.debug("enter") - var initData = {appID:1, timeout:0, messageText:{fieldText:""}, softButtons:[]} - createMessageView(initData.appID) - - var result = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - verify(result.__errno === undefined, "ScrollableMessage return error state") - //NOTE: don't check timer - it has been triggered immediately (timeout is 0) - //MessageView call @complete immediately - compare(messageModel.running, false, "ScrollableMessage didn't stop") - compare(messageModel.softButtons.count, initData.softButtons.length, "wrong buttons count") - compare(messageModel.longMessageText, initData.messageText.fieldText, "wrong messageText") - compare(messageModel.timeout, initData.timeout, "wrong timeout") - destroyView() - console.debug("exit") - } - - //call @scrollableMessage twice (after first view has closed) - function test_03_doubleCreate() { - console.debug("enter") - var initData = {appID:1, timeout:0, messageText:{fieldText:"Simple text"}, - softButtons:softButtonsListExample} - var initData2 = {appID:1, timeout:10000, messageText:{fieldText:"Simple text 2"}, - softButtons:[]} - createMessageView(initData.appID) - - //create view - var actualResult = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - //create new view - var actualResult2 = sdlUIProxy.scrollableMessage(initData2) - getMessageViewModel() - - verify(actualResult.__errno === undefined, "ScrollableMessage return error state") - verify(actualResult2.__errno === undefined, "ScrollableMessage return error state") - compare(messageModel.running, true, "ScrollableMessage didn't start") - compare(messageModel.longMessageText, initData2.messageText.fieldText, "wrong messageText") - compare(messageModel.timeout, initData2.timeout, "wrong timeout") - compare(messageModel.appId, initData2.appID, "wrong application ID") - verify(messageModel.async !== undefined, "async in undefined") - destroyView() - console.debug("exit") - } - - //call @scrollableMessage twice (before first view is closed) - function test_04_doubleCreateError() { - console.debug("enter") - var initData = {appID:1, timeout:20000, messageText:{fieldText:"Simple text"}, - softButtons:softButtonsListExample} - var initData2 = {appID:1, timeout:10000, messageText:{fieldText:"Simple text 2"}, - softButtons:[]} - createMessageView(initData.appID) - - //create view - var actualResult = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - var firstView = messageView; - - //create new view - var actualResult2 = sdlUIProxy.scrollableMessage(initData2) - getMessageViewModel() - verify(actualResult.__errno === undefined, "ScrollableMessage return error state") - verify(actualResult2.__errno !== undefined, "ScrollableMessage don't return error state") - compare(messageModel.running, true, "ScrollableMessage didn't start") - compare(messageView, firstView, "creating new view insteed stay first") - compare(messageModel.longMessageText, initData.messageText.fieldText, "wrong messageText") - compare(messageModel.timeout, initData.timeout, "wrong timeout") - compare(messageModel.appId, initData.appID, "wrong application ID") - verify(messageModel.async !== undefined, "async in undefined") - destroyView() - console.debug("exit") - } - - //call @scrollableMessage and check close - function test_05_ClickBackButton() { - console.debug("enter") - var initData = {appID:1, timeout:20000, - messageText:{fieldText:"Simple ScrollableMessage text"}, - softButtons:softButtonsListExample} - createMessageView(initData.appID) - - var result = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - compare(messageModel.running, true, "ScrollableMessage didn't start") - verify(result.__errno === undefined, "ScrollableMessage return error state") - //look for back button - var backButton = messageView.getBackButton() - verify(backButton !== undefined, "Not created back button") - //wait rendering for correct click position - waitForRendering(mainWindowLoader) - //Press back button - mouseClick(backButton, backButton.width/2, backButton.height/2, - Qt.LeftButton, Qt.NoModifier, 0) - //check that MessageView (in contentLoader) is unloaded and deleted - var isLoaded = (contentLoader.source.toString().indexOf("ScrollableMessageView.qml") > 0) - verify(!isLoaded, "MessageView should be unloaded") - //wait for delete messageView by GC - wait(0); - verify(messageView === null, "MessageView should be deleted") - destroyView() - console.debug("exit") - } - //call @scrollableMessage and check close - function test_06_ClickDefaultAction() { - console.debug("enter") - var initData = {appID:1, timeout:20000, - messageText:{fieldText:"Simple ScrollableMessage text"}, - softButtons:softButtonsListExample} - createMessageView(initData.appID) - - var result = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - compare(messageModel.running, true, "ScrollableMessage didn't start") - verify(result.__errno === undefined, "ScrollableMessage return error state") - //look for DEFAULT_ACTION button - var defaultActionButton = findButtonByAction(Common.SystemAction.DEFAULT_ACTION) - verify(defaultActionButton !== undefined, "Not created button with DEFAULT_ACTION") - //wait rendering for correct click position - waitForRendering(mainWindowLoader) - //Press default button - mouseClick(defaultActionButton, defaultActionButton.width/2, defaultActionButton.height/2, - Qt.LeftButton, Qt.NoModifier, 0) - //check that MessageView (in contentLoader) is unloaded and deleted - var isLoaded = (contentLoader.source.toString().indexOf("ScrollableMessageView.qml") > 0) - verify(!isLoaded, "MessageView should be unloaded") - //wait for delete messageView by GC - wait(0); - verify(messageView === null, "MessageView should be deleted") - destroyView() - console.debug("exit") - } - - //call @scrollableMessage and check restart timer - function test_07_ClickStealFocus() { - console.debug("enter") - var initData = {appID:1, timeout:20000, messageText:{fieldText:"Simple ScrollableMessage text"}, - softButtons:softButtonsListExample} - createMessageView(initData.appID) - - var result = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - //check - compare(messageModel.running, true, "ScrollableMessage didn't start") - verify(result.__errno === undefined, "ScrollableMessage return error state") - //look for STEAL_FOCUS button - var stealFocusButton = findButtonByAction(Common.SystemAction.STEAL_FOCUS) - verify(stealFocusButton !== undefined, "Not created button with STEAL_FOCUS") - //wait rendering for correct buttons size for correct click position - waitForRendering(mainWindowLoader) - mouseClick(stealFocusButton, stealFocusButton.width/2, stealFocusButton.height/2, - Qt.LeftButton, Qt.NoModifier, 0) - //check that MediaView loaded in loade - var viewQMlFileName = dataContainer.currentApplication.isMediaApplication ? - "SDLPlayerView.qml" : "SDLNonMediaView.qml" - var isLoaded = (contentLoader.source.toString().indexOf(viewQMlFileName) > 0) - verify(isLoaded, "SDLPlayerView/SDLNonMediaView should be loaded") - destroyView() - console.debug("exit") - } - - //call @scrollableMessage and check restart timer - function test_08_ClickKeepContex() { - console.debug("enter") - var initData = {appID:1, timeout:20000, messageText:{fieldText:"Simple ScrollableMessage text"}, - softButtons:softButtonsListExample} - createMessageView(initData.appID) - - var result = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - //check - compare(messageModel.running, true, "ScrollableMessage didn't start") - verify(result.__errno === undefined, "ScrollableMessage return error state") - //look for KEEP_CONTEXT button - var keepContexButton = findButtonByAction(Common.SystemAction.KEEP_CONTEXT) - verify(keepContexButton !== undefined, "Not created button with KEEP_CONTEXT") - //wait rendering for correct click position - waitForRendering(mainWindowLoader) - //Press button - mouseClick(keepContexButton, keepContexButton.width/2, keepContexButton.height/2, - Qt.LeftButton, Qt.NoModifier, 0) - //check that MessageView is still unloaded loaded - var isLoaded = (contentLoader.source.toString().indexOf("ScrollableMessageView.qml") > 0) - verify(isLoaded, "MessageView should be loaded") - //verify restarted timer - timer = messageView.getTimer() - verify(timer.running === true, "Timer is not restarted by KEEP_CONTEXT button") - destroyView() - console.debug("exit") - } - - //add long text to model and check scrollBar visibility - function test_09_ScrollBarShown() { - console.debug("enter") - //generate string with (10!) lines - var longText = "It is very long text!\n" - for(var i = 1; i < 10; ++i) - longText += longText - var initData = {appID:1, timeout:20000, messageText:{fieldText:longText}, softButtons:[]} - createMessageView(initData.appID) - - var result = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - //check - compare(messageModel.running, true, "ScrollableMessage didn't start") - verify(result.__errno === undefined, "ScrollableMessage return error state") - - //wait rendering - waitForRendering(mainWindowLoader) - var scrollBar = messageView.getScrollbar() - verify(scrollBar.visible === true, "ScrollBar is not shown for long text") - - destroyView() - console.debug("exit") - } - - //compare text width with and without buttons at top of SrollableMessage - function test_10_MessageTextHeight() { - console.debug("enter") - var initData = {appID:1, timeout:500, messageText:{fieldText:"Simple text"}, softButtons:[]} - createMessageView(initData.appID) - - var result = sdlUIProxy.scrollableMessage(initData) - getMessageViewModel() - - //check - compare(messageModel.running, true, "ScrollableMessage didn't start") - verify(result.__errno === undefined, "ScrollableMessage return error state") - - var textAreaHeight = messageView.getTextArea().height - wait(initData.timeout) - - var initData2 = {appID:1, timeout:20000, messageText:{fieldText:"Simple text"}, - softButtons:softButtonsListExample} - createMessageView(initData.appID) - - var result2 = sdlUIProxy.scrollableMessage(initData2) - getMessageViewModel() - - //wait rendering - waitForRendering(mainWindowLoader) - var textAreaHeight2 = messageView.getTextArea().height - console.debug("messageTextH", textAreaHeight, textAreaHeight2) - verify(textAreaHeight2 <= textAreaHeight, "Height of text area shoud be less with buttons") - - destroyView() - console.debug("exit") - } - } -} diff --git a/src/components/qt_hmi/test/src/tst_SetMediaClockTimer.qml b/src/components/qt_hmi/test/src/tst_SetMediaClockTimer.qml deleted file mode 100644 index 212cdfc143..0000000000 --- a/src/components/qt_hmi/test/src/tst_SetMediaClockTimer.qml +++ /dev/null @@ -1,292 +0,0 @@ -/** - * @file tst_Slider.qml - * @brief Test Case for Slider. - * 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. - */ - -import QtTest 1.0 -import QtQuick 2.0 -import QtMultimedia 5.0 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.hw_buttons 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import "../qml_model_qt5/controls" -import "../qml_model_qt5/views" -import "../qml_model_qt5/hmi_api" as HmiApi -import "../qml_model_qt5/models" -import "../qml_model_qt5/popups" -import "../qml_model_qt5/hmi_api/Common.js" as Common -import "../qml_model_qt5/models/Constants.js" as Constants -import "../qml_model_qt5/models/Internal.js" as Internal - -Item { - id:item123 - TestCase { - name: "time" - property var mainWindowComponent : Qt.createComponent("../qml_model_qt5/MainWindow.qml") - property var mainObject - property var sdlUI - property var dataContainer - - function createTime() { - mainObject = mainWindowComponent.createObject(parent) - sdlUI = mainObject.getUIProxy() - dataContainer = mainObject.getDataStorage() - } - - function destroyTime() { - mainObject.destroy() - } - - //No end time, works like a timer - function test_01_noEndTimeInCountUp() { - console.debug("enter") - - var initData = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:undefined , updateMode: 0, appID: 1} - - var expectedResult = {endTimeResult:-1, resultCode : Common.Result.SUCCESS} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - var actualResult = sdlUI.setMediaClockTimer(initData) - - try { - compare(dataContainer.getApplication(initData.appID).mediaClock.endTime, expectedResult.endTimeResult, "time position") - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - - //No start time. Function process error - function test_02_noStartTime() { - console.debug("enter") - - var initData = {startTime:undefined, endTime:{hours: 4, minutes: 0, seconds: 0} , updateMode: 1, appID: 1} - var expectedResult = {resultCode : Common.Result.INVALID_DATA} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - var actualResult = sdlUI.setMediaClockTimer(initData) - - try { - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - - //Receive "pause", when onready paused - function test_03_pauseAfterPause() { - console.debug("enter") - - var initData = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:{hours: 12, minutes: 00, seconds: 00}, updateMode: 0, appID: 1} - var expectedResult = {resultCode : Common.Result.IGNORED} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - sdlUI.setMediaClockTimer(initData) - - initData.updateMode=2 - sdlUI.setMediaClockTimer(initData) - - var actualResult = sdlUI.setMediaClockTimer(initData) - - try { - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - - //Receive "RESUME" after "CLEAR" - function test_04_resumeAfterClear() { - console.debug("enter") - - var initData = {startTime:{hours: 10, minutes: 0, seconds: 0},endTime:{ }, updateMode:0, appID:1} - - var expectedResult = {resultCode : Common.Result.IGNORED} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - sdlUI.setMediaClockTimer(initData) - - initData.updateMode=4 - sdlUI.setMediaClockTimer(initData) - - initData.updateMode=3 - sdlUI.setMediaClockTimer(initData) - - var actualResult = sdlUI.setMediaClockTimer(initData) - try { - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - - function test_05_resumeAfterEnd() { - console.debug("enter") - - var initData = {startTime:{hours: 0, minutes: 12, seconds: 33},endTime:{hours: 0, minutes: 12, seconds: 33}, updateMode:0, appID:1} - - var expectedResult = {resultCode : Common.Result.IGNORED} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - sdlUI.setMediaClockTimer(initData) - - dataContainer.setApplicationProperties(initData.appID, { - "mediaClock": { - "updateMode": 0, - "runningMode": 1, - "startTime": initData.StartTime, - "endTime": initData.EndTime, - "startTimeForProgress": 753 - } - }) - initData.updateMode=3 - var actualResult = sdlUI.setMediaClockTimer(initData) - - try { - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - - //Launch "COUNTUP" twice - function test_06_twoCountUp() { - console.debug("enter") - - var initData1 = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:{hours: 12, minutes: 00, seconds: 00}, updateMode: 0, appID: 1} - var initData2 = {startTime:{hours: 5, minutes: 0, seconds: 0}, endTime:{hours: 18, minutes: 00, seconds: 00}, updateMode: 0, appID: 1} - var expectedResult = {startTime:18000, endTime: 64800, updateMode: 0, resultCode : Common.Result.SUCCESS} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData1.appID}) - - sdlUI.setMediaClockTimer(initData1) - - var actualResult = sdlUI.setMediaClockTimer(initData2) - - try { - compare(dataContainer.getApplication(initData1.appID).mediaClock.startTime, expectedResult.startTime, "startTime") - compare(dataContainer.getApplication(initData1.appID).mediaClock.endTime, expectedResult.endTime, "endTime") - compare(dataContainer.getApplication(initData1.appID).mediaClock.updateMode, expectedResult.updateMode, "updateMode") - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - - //Get "RESUME", when clock is paused - function test_07_resumeAfterResume() { - console.debug("enter") - - var initData = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:{hours: 12, minutes: 00, seconds: 00}, updateMode: 0, appID: 1} - var expectedResult = {resultCode : Common.Result.IGNORED} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - sdlUI.setMediaClockTimer(initData) - - initData.updateMode=3 - var actualResult = sdlUI.setMediaClockTimer(initData) - - try { - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - - - function test_08_countDownAfterCountUp() { - console.debug("enter") - - var initData1 = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:{hours: 12, minutes: 00, seconds: 00}, updateMode: 0, appID: 1} - var initData2 = {startTime:{hours: 18, minutes: 0, seconds: 0}, endTime:{hours: 5, minutes: 00, seconds: 00}, updateMode: 1, appID: 1} - var expectedResult = {startTime:64800, endTime: 18000, updateMode: 1, resultCode : Common.Result.SUCCESS} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData1.appID}) - - sdlUI.setMediaClockTimer(initData1) - - var actualResult = sdlUI.setMediaClockTimer(initData2) - - try { - compare(dataContainer.getApplication(initData1.appID).mediaClock.startTime, expectedResult.startTime, "startTime") - compare(dataContainer.getApplication(initData1.appID).mediaClock.endTime, expectedResult.endTime, "endTime") - compare(dataContainer.getApplication(initData1.appID).mediaClock.updateMode, expectedResult.updateMode, "updateMode") - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - - function test_09_noEndTimeInCountDown() { - console.debug("enter") - - var initData = {startTime:{hours: 4, minutes: 0, seconds: 0}, endTime:undefined, updateMode: 0, appID: 1} - - var expectedResult = {startTimeForProgress:14400, resultCode : Common.Result.SUCCESS} - - createTime() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - var actualResult = sdlUI.setMediaClockTimer(initData) - - try { - compare(dataContainer.getApplication(initData.appID).mediaClock.startTimeForProgress, expectedResult.startTimeForProgress, "time position") - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - - destroyTime() - console.debug("exit") - } - } -} diff --git a/src/components/qt_hmi/test/src/tst_Show.qml b/src/components/qt_hmi/test/src/tst_Show.qml deleted file mode 100644 index cce2e7de49..0000000000 --- a/src/components/qt_hmi/test/src/tst_Show.qml +++ /dev/null @@ -1,363 +0,0 @@ -/** - * @file tst_Slider.qml - * @brief Test Case for Slider. - * 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. - */ - -import QtTest 1.0 -import QtQuick 2.0 -import QtMultimedia 5.0 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.hw_buttons 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import "../qml_model_qt5/controls" -import "../qml_model_qt5/views" -import "../qml_model_qt5/hmi_api" as HmiApi -import "../qml_model_qt5/models" -import "../qml_model_qt5/popups" -import "../qml_model_qt5/hmi_api/Common.js" as Common -import "../qml_model_qt5/models/Constants.js" as Constants -import "../qml_model_qt5/models/Internal.js" as Internal - -Item { - width : mainWindowLoader.width - height: mainWindowLoader.height - Loader { - id: mainWindowLoader - asynchronous : false - } - - TestCase { - name: "Show" - when: windowShown - property var mainWindowComponent : Qt.createComponent("../qml_model_qt5/MainWindow.qml") - property var mainObject - property var sldUI - property var dataContainer - property var contentLoader - - property var softButtonsListExample : [ - {softButtonID:0, isHighlighted:true, systemAction:Common.SystemAction.DEFAULT_ACTION, - type:Common.SoftButtonType.SBT_TEXT, text:"Default Action"}, - {softButtonID:1, isHighlighted:false, systemAction:Common.SystemAction.STEAL_FOCUS, - type:Common.SoftButtonType.SBT_IMAGE, text:"Steal Focus"}, - {softButtonID:2, isHighlighted:false, systemAction:Common.SystemAction.KEEP_CONTEXT, - type:Common.SoftButtonType.SBT_BOTH, text:"Keep context"}] - - - //initialization for each test - function createShow(appID) { - mainWindowLoader.source = "" - mainWindowLoader.source = "../../../../src/components/qt_hmi/qml_model_qt5/MainWindow.qml" - var mainWindowObject = mainWindowLoader.item - if(!mainWindowObject) - qtest_fail("mainWindowObject is undefined"); - var mainScreen = mainWindowObject.getMainScreen() - mainScreen.visible = true - var warningInfo = mainWindowObject.getWarningInfo() - warningInfo.visible = false - contentLoader = mainWindowObject.getContentLoader() - contentLoader.asynchronous = false - sldUI = mainWindowObject.getUIProxy() - dataContainer = mainWindowObject.getDataStorage() - dataContainer.addApplication({appName:"TestAppName", appId:appID}) - } - - - - //cleanup for each test - function destroyShow() { - //Clear Loader with MainWindow, which delete own models and views - mainWindowLoader.source = "" - } - - - //Fill up all fields, check save process to dataContainer - function test_01_create() { - console.debug("enter") - var initData = { - appID:1, - showStrings:[ - {fieldName:Common.TextFieldName.mainField1 ,fieldText:"showString1"}, - {fieldName:Common.TextFieldName.mainField2,fieldText:"showString2"}, - {fieldName:Common.TextFieldName.mainField3,fieldText:"showString3"}, - {fieldName:Common.TextFieldName.mainField4,fieldText:"showString4"}, - {fieldName:Common.TextFieldName.mediaTrack,fieldText:"mediaTrack"}, - {fieldName:Common.TextFieldName.statusBar,fieldText:"StatusBar"}, - {fieldName:Common.TextFieldName.mediaClock,fieldText:"12:34"} - ], - softButtons:softButtonsListExample, - alignment:2, - graphic:{value:"/home/user/applink/bin/SPTAlice9675308/action.png",imageType: "DYNAMIC"}, - secondaryGraphic:{value:"/home/user/applink/bin/SPTAlice9675308/action.png",imageType: "DYNAMIC"}, - customPresets:["GEN0","GEN1","GEN2","GEN3"] - } - - createShow(1) - var app = dataContainer.getApplication(initData.appID) - sldUI.show (initData) - - try { - - compare(app.hmiUIText.mainField1 , initData.showStrings[0].fieldText, "mainField1") - compare(app.hmiUIText.mainField2 , initData.showStrings[1].fieldText, "mainField2") - compare(app.hmiUIText.mainField3 , initData.showStrings[2].fieldText, "mainField3") - compare(app.hmiUIText.mainField4 , initData.showStrings[3].fieldText, "mainField4") - compare(app.hmiUIText.mediaTrack , initData.showStrings[4].fieldText, "mediaTrack") - compare(app.hmiUIText.statusBar , initData.showStrings[5].fieldText, "StatusBar" ) - compare(app.hmiUIText.mediaClock , initData.showStrings[6].fieldText, "mediaClock") - var a; - if(app.hmiUITextAlignment === 1) a=0; - if(app.hmiUITextAlignment === 2) a=1; - if(app.hmiUITextAlignment === 4) a=2; - compare(initData.alignment, a, "Alignment") - compare(app.hmiUIText.image, initData.graphic.value, "image") - compare(app.hmiUIText.secondaryImage, initData.secondaryGraphic.value, "secdondImage") - compare(app.softButtons.count, initData.softButtons.length, "wrong buttons count created") - for (var i = 0, len = app.softButtons.count; i < len; i++) - { - var act = app.softButtons.get(i) - var exp = initData.softButtons[i] - compare(act.softButtonID, exp.softButtonID, "wrong softButtonID in button") - compare(act.isHighlighted, exp.isHighlighted, "wrong isHighlighted in button") - compare(act.systemAction, exp.systemAction, "wrong systemAction in button") - compare(act.text, exp.text, "wrong text in button") - } - compare(app.customPresets.count, initData.customPresets.length, "wrong buttons count created") - for (var j = 0, len2 = app.customPresets.count; j < len; j++) - { - var act2 = app.customPresets.get(j) - var exp2 = initData.customPresets[j] - compare(act2.text, exp2, "wrong text in button") - } - } - catch (e) {} - destroyShow() - console.debug("exit") - } - //All fields are empty - function test_02_emptyInit() - { - console.debug("enter") - var initData = { - appID:1, - showStrings:[ - {fieldName:Common.TextFieldName.mainField1 ,fieldText:""}, - {fieldName:Common.TextFieldName.mainField2,fieldText:""}, - {fieldName:Common.TextFieldName.mainField3,fieldText:""}, - {fieldName:Common.TextFieldName.mainField4,fieldText:""}, - {fieldName:Common.TextFieldName.mediaTrack,fieldText:""}, - {fieldName:Common.TextFieldName.statusBar,fieldText:""}, - {fieldName:Common.TextFieldName.mediaClock,fieldText:""} - ], - softButtons:[], - alignment:0, - graphic:{value:"",imageType: "DYNAMIC"}, - secondaryGraphic:{value:"",imageType: "DYNAMIC"}, - customPresets:[] - } - - createShow(1) - var app = dataContainer.getApplication(initData.appID) - sldUI.show (initData) - - try { - - compare(app.hmiUIText.mainField1 , initData.showStrings[0].fieldText, "mainField1") - compare(app.hmiUIText.mainField2 , initData.showStrings[1].fieldText, "mainField2") - compare(app.hmiUIText.mainField3 , initData.showStrings[2].fieldText, "mainField3") - compare(app.hmiUIText.mainField4 , initData.showStrings[3].fieldText, "mainField4") - compare(app.hmiUIText.mediaTrack , initData.showStrings[4].fieldText, "mediaTrack") - compare(app.hmiUIText.statusBar , initData.showStrings[5].fieldText, "StatusBar" ) - compare(app.hmiUIText.mediaClock , initData.showStrings[6].fieldText, "mediaClock") - var a; - if(app.hmiUITextAlignment === 1) a=0; - if(app.hmiUITextAlignment === 2) a=1; - if(app.hmiUITextAlignment === 4) a=2; - compare(initData.alignment, a, "Alignment") - compare(app.hmiUIText.image, initData.graphic.value, "image") - compare(app.hmiUIText.secondaryImage, initData.secondaryGraphic.value, "secdondImage") - compare(app.softButtons.count, initData.softButtons.length, "wrong buttons count created") - for (var i = 0, len = app.softButtons.count; i < len; i++) - { - var act = app.softButtons.get(i) - var exp = initData.softButtons[i] - compare(act.softButtonID, exp.softButtonID, "wrong softButtonID in button") - compare(act.isHighlighted, exp.isHighlighted, "wrong isHighlighted in button") - compare(act.systemAction, exp.systemAction, "wrong systemAction in button") - compare(act.text, exp.text, "wrong text in button") - } - compare(app.customPresets.count, initData.customPresets.length, "wrong buttons count created") - for (var j = 0, len2 = app.customPresets.count; j < len; j++) - { - var act2 = app.customPresets.get(j) - var exp2 = initData.customPresets[j] - compare(act2.text, exp2, "wrong text in button") - } - } - catch (e) {} - destroyShow() - console.debug("exit") - } - - //Mandatory fields only - function test_03_create_mandatory_only() { - console.debug("enter") - var initData = { - appID:1, - showStrings:[ - {fieldName:Common.TextFieldName.mainField1 ,fieldText:"showString1"}, - {fieldName:Common.TextFieldName.mainField2,fieldText:"showString2"}, - {fieldName:Common.TextFieldName.mainField3,fieldText:"showString3"}, - {fieldName:Common.TextFieldName.mainField4,fieldText:"showString4"}, - {fieldName:Common.TextFieldName.mediaTrack,fieldText:"mediaTrack"}, - {fieldName:Common.TextFieldName.statusBar,fieldText:"StatusBar"}, - {fieldName:Common.TextFieldName.mediaClock,fieldText:"12:34"} - ] - } - - createShow(1) - var app = dataContainer.getApplication(initData.appID) - sldUI.show (initData) - - try { - - compare(app.hmiUIText.mainField1 , initData.showStrings[0].fieldText, "mainField1") - compare(app.hmiUIText.mainField2 , initData.showStrings[1].fieldText, "mainField2") - compare(app.hmiUIText.mainField3 , initData.showStrings[2].fieldText, "mainField3") - compare(app.hmiUIText.mainField4 , initData.showStrings[3].fieldText, "mainField4") - compare(app.hmiUIText.mediaTrack , initData.showStrings[4].fieldText, "mediaTrack") - compare(app.hmiUIText.statusBar , initData.showStrings[5].fieldText, "StatusBar" ) - compare(app.hmiUIText.mediaClock , initData.showStrings[6].fieldText, "mediaClock") - - } - catch (e) {} - destroyShow() - console.debug("exit") - } - //Field with extra param - function test_04_fake_param() { - console.debug("enter") - var initData = { - appID:1, - showStrings:[ - {fieldName:Common.TextFieldName.mainField1 ,fieldText:"showString1"}, - {fieldName:Common.TextFieldName.mainField2,fieldText:"showString2"}, - {fieldName:Common.TextFieldName.mainField3,fieldText:"showString3"}, - {fieldName:Common.TextFieldName.mainField4,fieldText:"showString4"}, - {fieldName:Common.TextFieldName.mediaTrack,fieldText:"mediaTrack"}, - {fieldName:Common.TextFieldName.statusBar,fieldText:"StatusBar",fakeParam:"FakeParam"}, - {fieldName:Common.TextFieldName.mediaClock,fieldText:"12:34"} - ] - } - - createShow(1) - var app = dataContainer.getApplication(initData.appID) - sldUI.show (initData) - - try { - - compare(app.hmiUIText.mainField1 , initData.showStrings[0].fieldText, "mainField1") - compare(app.hmiUIText.mainField2 , initData.showStrings[1].fieldText, "mainField2") - compare(app.hmiUIText.mainField3 , initData.showStrings[2].fieldText, "mainField3") - compare(app.hmiUIText.mainField4 , initData.showStrings[3].fieldText, "mainField4") - compare(app.hmiUIText.mediaTrack , initData.showStrings[4].fieldText, "mediaTrack") - compare(app.hmiUIText.statusBar , initData.showStrings[5].fieldText, "StatusBar" ) - compare(app.hmiUIText.mediaClock , initData.showStrings[6].fieldText, "mediaClock") - - } - catch (e) {} - destroyShow() - console.debug("exit") - } - //aligment of mainField1, mainField2 - function test_05_alignment() { - console.debug("enter") - var initData = { - appID:1, - showStrings:[], - alignment:0, - } - - createShow(1) - var app = dataContainer.getApplication(initData.appID) - sldUI.show (initData) - - try { - //Magic with digits - because enum of text.Alighnment enum and sdl alignment doesn't match - var a; - if(app.hmiUITextAlignment === 1) a=0; - if(app.hmiUITextAlignment === 2) a=1; - if(app.hmiUITextAlignment === 4) a=2; - compare(initData.alignment, a, "Alignment") - initData.alignment=1 - sldUI.show (initData) - var b; - if(app.hmiUITextAlignment === 1) b=0; - if(app.hmiUITextAlignment === 2) b=1; - if(app.hmiUITextAlignment === 4) b=2; - compare(initData.alignment, b, "Alignment") - initData.alignment=2 - sldUI.show (initData) - var c; - if(app.hmiUITextAlignment === 1) c=0; - if(app.hmiUITextAlignment === 2) c=1; - if(app.hmiUITextAlignment === 4) c=2; - compare(initData.alignment, c, "Alignment") - } - catch (e) {} - destroyShow() - console.debug("exit") - } - //pole bez parametra - function test_06_no_param() { - console.debug("enter") - var initData = { - appID:1, - showStrings:[], - graphic:{imageType: "DYNAMIC"}, - } - - createShow(1) - var app = dataContainer.getApplication(initData.appID) - sldUI.show (initData) - - try { - - compare(app.hmiUIText.image, undefined, "image") - - } - catch (e) {} - destroyShow() - console.debug("exit") - } -} -} diff --git a/src/components/qt_hmi/test/src/tst_Slider.qml b/src/components/qt_hmi/test/src/tst_Slider.qml deleted file mode 100644 index 0e6acef078..0000000000 --- a/src/components/qt_hmi/test/src/tst_Slider.qml +++ /dev/null @@ -1,204 +0,0 @@ -/** - * @file tst_Slider.qml - * @brief Test Case for Slider. - * 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. - */ - -import QtTest 1.0 -import QtQuick 2.0 -import QtMultimedia 5.0 -import com.ford.sdl.hmi.dbus_adapter 1.0 -import com.ford.sdl.hmi.hw_buttons 1.0 -import com.ford.sdl.hmi.log4cxx 1.0 -import "../qml_model_qt5/controls" -import "../qml_model_qt5/views" -import "../qml_model_qt5/hmi_api" as HmiApi -import "../qml_model_qt5/models" -import "../qml_model_qt5/popups" -import "../qml_model_qt5/hmi_api/Common.js" as Common -import "../qml_model_qt5/models/Constants.js" as Constants -import "../qml_model_qt5/models/Internal.js" as Internal - -Item { - TestCase { - name: "Slider" - when: windowShown - property var mainWindowComponent : Qt.createComponent("../qml_model_qt5/MainWindow.qml") - property var mainObject - property var sldUI - property var dataContainer - property var sliderPopup - property var timer - - function createSlider() { - mainObject = mainWindowComponent.createObject(parent) - var mainScreen = mainObject.getMainScreen() - mainScreen.visible = true - sldUI = mainObject.getUIProxy() - dataContainer = mainObject.getDataStorage() - sliderPopup = mainObject.getSlider() - timer = sliderPopup.getTimer() - } - - - function destroySlider() { - mainObject.destroy() - } - - function test_01_timeoutZero() { - console.debug("enter") - var initData = {numTicks:9, position:4, sliderHeader:"header", sliderFooter:["footer"], timeout:0, appID:1} - createSlider() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - var actualResult = sldUI.slider(initData) - try { - compare(actualResult.sliderPosition, initData.position, "slider position") - } catch(e){} - destroySlider() - console.debug("exit") - } - - function test_02_changePosition() { - console.debug("enter") - var initData = {numTicks:9, position:4, sliderHeader:"header", sliderFooter:["footer"], timeout:1, appID:1} - var expectedResult = {position : 2, resultCode : Common.Result.SUCCESS} - createSlider() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - sliderPopup.onReady.connect(function simulateUserAction(){sliderPopup.position = expectedResult.position}) - - sldUI.slider(initData) - - timer.onTriggered() - try { - compare(dataContainer.uiSlider.position, expectedResult.position, "slider position") - compare(sliderPopup.resultCode, expectedResult.resultCode, "result code") - } catch (e) {} - destroySlider() - console.debug("exit") - } - - function test_03_unChangedPosition() { - console.debug("enter") - var initData = {numTicks:9, position:4, sliderHeader:"header", sliderFooter:["footer"], timeout:1, appID:1} - var expectedResult = {position : 4, resultCode : Common.Result.SUCCESS} - createSlider() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - sldUI.slider(initData) - - timer.onTriggered() - try { - compare(dataContainer.uiSlider.position, expectedResult.position, "slider position") - compare(sliderPopup.resultCode, expectedResult.resultCode, "result code") - } catch (e) {} - destroySlider() - console.debug("exit") - } - - - function test_04_changePositionBackPressed() { - console.debug("enter") - var initData = {numTicks:9, position:4, sliderHeader:"header", sliderFooter:["footer"], timeout:1, appID:1} - var expectedResult = {position : 4, resultCode : Common.Result.ABORTED} - createSlider() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - sliderPopup.onReady.connect(function simulateUserAction(){sliderPopup.position = expectedResult.position}) - - sldUI.slider(initData) - sliderPopup.getBackButton().clicked() - - try { - compare(dataContainer.uiSlider.position, expectedResult.position, "slider position") - compare(sliderPopup.resultCode, expectedResult.resultCode, "result code") - } catch (e) {} - destroySlider() - console.debug("exit") - } - - function test_05_secondCall() { - console.debug("enter") - var initData = {numTicks:9, position:4, sliderHeader:"header", sliderFooter:["footer"], timeout:1, appID:1} - var expectedResult = {position : 5, resultCode : Common.Result.ABORTED} - createSlider() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - sliderPopup.onReady.connect(function simulateUserAction(){sliderPopup.position = expectedResult.position}) - - sldUI.slider(initData) - initData.position = 5 - var actualResult = sldUI.slider(initData) - - try { - compare(actualResult.sliderPosition, expectedResult.position, "slider position") - compare(actualResult.__retCode, expectedResult.resultCode, "result code") - } catch (e) {} - destroySlider() - console.debug("exit") - } - - function test_06_footerValueNoChange() { - console.debug("enter") - var initData = {numTicks:4, position:3, sliderHeader:"header", sliderFooter:["footer1", "footer2", "footer3", "footer4"], timeout:1, appID:1} - var expectedResult = {position: 3, footers:["footer1", "footer2", "footer3", "footer4"]} - createSlider() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - - sldUI.slider(initData) - - try { - compare(sliderPopup.getFooterText().text, expectedResult.footers[expectedResult.position - 1], "current footer") - } catch (e) {} - destroySlider() - console.debug("exit") - } - - function test_07_footerValueChange() { - console.debug("enter") - var initData = {numTicks:4, position:2, sliderHeader:"header", sliderFooter:["footer1", "footer2", "footer3", "footer4"], timeout:1, appID:1} - var expectedResult = {position: 3, footers:["footer1", "footer2", "footer3", "footer4"]} - createSlider() - dataContainer.addApplication({appName:"TestAppName", appId:initData.appID}) - sliderPopup.onReady.connect(function simulateUserAction(){ - var rect = sliderPopup.getBorderRectangle() - console.debug("visible", sliderPopup.visible) - mouseClick(rect, rect.width / initData.numTicks * expectedResult.position, 1) - }) - - sldUI.slider(initData) - - try { - compare(sliderPopup.getFooterText().text, expectedResult.footers[expectedResult.position - 1], "current footer") - } catch (e) {} - destroySlider() - console.debug("exit") - } - - } -} diff --git a/src/components/remote_control/test/include/mock_application.h b/src/components/remote_control/test/include/mock_application.h index 2c4ce641ee..e50a869be7 100644 --- a/src/components/remote_control/test/include/mock_application.h +++ b/src/components/remote_control/test/include/mock_application.h @@ -59,8 +59,11 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(curHash, const std::string&()); MOCK_METHOD0(UpdateHash, void()); - MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool()); - MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag)); + DEPRECATED MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool()); + DEPRECATED MOCK_METHOD1(set_flag_sending_hash_change_after_awake, + void(bool flag)); + MOCK_CONST_METHOD0(IsHashChangedDuringSuspend, bool()); + MOCK_METHOD1(SetHashChangedDuringSuspend, void(const bool state)); MOCK_CONST_METHOD0(is_application_data_changed, bool()); MOCK_METHOD1(set_is_application_data_changed, void(bool state_application_data)); @@ -160,6 +163,7 @@ class MockApplication : public ::application_manager::Application { bool(mobile_apis::FunctionID::eType cmd_id, ::application_manager::TLimitSource source)); MOCK_METHOD0(usage_report, ::application_manager::UsageStatistics&()); + MOCK_METHOD1(SetInitialState, void(::application_manager::HmiStatePtr state)); MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state)); MOCK_METHOD1(SetPostponedState, void(::application_manager::HmiStatePtr state)); @@ -323,7 +327,8 @@ class MockApplication : public ::application_manager::Application { bool(application_manager::AppExtensionPtr extention)); MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid)); MOCK_METHOD0(RemoveExtensions, void()); - MOCK_CONST_METHOD0(SubscribesIVI, const std::set<uint32_t>&()); + MOCK_CONST_METHOD0(SubscribesIVI, + const application_manager::VehicleInfoSubscriptions&()); #endif // SDL_REMOTE_CONTROL }; diff --git a/src/components/remote_control/test/src/rc_module_test.cc b/src/components/remote_control/test/src/rc_module_test.cc index 57efb90551..7bdf9fb9dd 100644 --- a/src/components/remote_control/test/src/rc_module_test.cc +++ b/src/components/remote_control/test/src/rc_module_test.cc @@ -169,7 +169,8 @@ TEST_F(RCModuleTest, ProcessMessagePass) { application_manager::BinaryData* data = &buf; data->push_back(1); - message_->set_binary_data(data); + message_->set_binary_data( + static_cast<const application_manager::BinaryData*>(data)); Json::Value json_value = MessageHelper::StringToValue(json); Json::Value module_type = @@ -226,7 +227,6 @@ TEST_F(RCModuleTest, IsAppForPluginSuccess) { mobile_apis::HMILevel::eType hmi = mobile_apis::HMILevel::eType::HMI_FULL; EXPECT_CALL(*app0_, hmi_level()).WillRepeatedly(Return(hmi)); ON_CALL(*app0_, device()).WillByDefault(Return(1)); - EXPECT_CALL(*mock_service_, NotifyHMIAboutHMILevel(Eq(app0_), _)); EXPECT_CALL(*mock_service_, IsRemoteControlApplication(Eq(app0_))) .WillOnce(Return(true)); ASSERT_TRUE(module_.IsAppForPlugin(app0_)); diff --git a/src/components/rpc_base/test/rpc_base_test.cc b/src/components/rpc_base/test/rpc_base_test.cc index c4ffbc321e..d81e01db6c 100644 --- a/src/components/rpc_base/test/rpc_base_test.cc +++ b/src/components/rpc_base/test/rpc_base_test.cc @@ -320,7 +320,7 @@ TEST(ValidatedTypes, ReportUninitializedIntType) { ASSERT_FALSE(val.is_valid()); ValidationReport report("val"); val.ReportErrors(&report); - ASSERT_EQ("val: value is not initialized\n", PrettyFormat(report)); + ASSERT_EQ("val: value is not initialized", PrettyFormat(report)); } TEST(ValidatedTypes, ReportIncorrectInitializedIntType) { @@ -328,7 +328,7 @@ TEST(ValidatedTypes, ReportIncorrectInitializedIntType) { ASSERT_FALSE(val.is_valid()); ValidationReport report("val"); val.ReportErrors(&report); - ASSERT_EQ("val: value initialized incorrectly\n", PrettyFormat(report)); + ASSERT_EQ("val: value initialized incorrectly", PrettyFormat(report)); } TEST(ValidatedTypes, ReportUninitializedOptionalType) { @@ -344,7 +344,7 @@ TEST(ValidatedTypes, ReportIncorrectInitializedOptionalType) { ASSERT_FALSE(val.is_valid()); ValidationReport report("val"); val.ReportErrors(&report); - ASSERT_EQ("val: value initialized incorrectly\n", PrettyFormat(report)); + ASSERT_EQ("val: value initialized incorrectly", PrettyFormat(report)); } TEST(ValidatedTypes, ReportUninitializedNullableIntType) { @@ -352,7 +352,7 @@ TEST(ValidatedTypes, ReportUninitializedNullableIntType) { ASSERT_FALSE(val.is_valid()); ValidationReport report("val"); val.ReportErrors(&report); - ASSERT_EQ("val: value is not initialized\n", PrettyFormat(report)); + ASSERT_EQ("val: value is not initialized", PrettyFormat(report)); } TEST(ValidatedTypes, ReportNullInitializedNullableIntType) { @@ -369,7 +369,7 @@ TEST(ValidatedTypes, ReportNoninitializedIntArray) { ASSERT_FALSE(array.is_valid()); ValidationReport report("array"); array.ReportErrors(&report); - ASSERT_EQ("array: object is not initialized\n", PrettyFormat(report)); + ASSERT_EQ("array: object is not initialized", PrettyFormat(report)); } TEST(ValidatedTypes, ReportIncorrectlyInitializedIntArray1) { @@ -378,7 +378,7 @@ TEST(ValidatedTypes, ReportIncorrectlyInitializedIntArray1) { ASSERT_FALSE(array.is_valid()); ValidationReport report("array"); array.ReportErrors(&report); - ASSERT_EQ("array[0]: value initialized incorrectly\n", PrettyFormat(report)); + ASSERT_EQ("array[0]: value initialized incorrectly", PrettyFormat(report)); } TEST(ValidatedTypes, ReportIncorrectlyInitializedIntArray2) { @@ -390,7 +390,7 @@ TEST(ValidatedTypes, ReportIncorrectlyInitializedIntArray2) { ASSERT_FALSE(array.is_valid()); ValidationReport report("array"); array.ReportErrors(&report); - ASSERT_EQ("array: array has invalid size\n", PrettyFormat(report)); + ASSERT_EQ("array: array has invalid size", PrettyFormat(report)); } TEST(ValidatedTypes, ReportIncorrectlyInitializedArray3) { @@ -403,7 +403,7 @@ TEST(ValidatedTypes, ReportIncorrectlyInitializedArray3) { array.ReportErrors(&report); ASSERT_EQ( "array: array has invalid size\n" - "array[2]: value initialized incorrectly\n", + "array[2]: value initialized incorrectly", PrettyFormat(report)); } @@ -411,7 +411,7 @@ TEST(ValidatedTypes, ReportUninitializedMap) { Map<Integer<int8_t, 1, 10>, 1, 3> map; ValidationReport report("map"); map.ReportErrors(&report); - ASSERT_EQ("map: object is not initialized\n", PrettyFormat(report)); + ASSERT_EQ("map: object is not initialized", PrettyFormat(report)); } TEST(ValidatedTypes, ReportIncorrectlyInitializedMap1) { @@ -419,7 +419,7 @@ TEST(ValidatedTypes, ReportIncorrectlyInitializedMap1) { map["aha"] = 42; ValidationReport report("map"); map.ReportErrors(&report); - ASSERT_EQ("map[\"aha\"]: value initialized incorrectly\n", + ASSERT_EQ("map[\"aha\"]: value initialized incorrectly", PrettyFormat(report)); } @@ -433,7 +433,7 @@ TEST(ValidatedTypes, ReportIncorrectlyInitializedMap2) { map.ReportErrors(&report); ASSERT_EQ( "map[\"haha\"]: value initialized incorrectly\n" - "map[\"muhahaha\"]: value initialized incorrectly\n", + "map[\"muhahaha\"]: value initialized incorrectly", PrettyFormat(report)); } diff --git a/src/components/rpc_base/test/validation_report_test.cc b/src/components/rpc_base/test/validation_report_test.cc index 596bfdb20d..10effe7dd2 100644 --- a/src/components/rpc_base/test/validation_report_test.cc +++ b/src/components/rpc_base/test/validation_report_test.cc @@ -75,7 +75,7 @@ class ValidationReportTest : public testing::Test { } else { temp = ""; } - result = parent_name + temp + obj_name + ":" + " " + val_info + "\n"; + result = parent_name + temp + obj_name + ":" + " " + val_info; } void ClearValidationInfo() { diff --git a/src/components/security_manager/include/security_manager/crypto_manager_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_impl.h index 4daf58b004..4e48858e5c 100644 --- a/src/components/security_manager/include/security_manager/crypto_manager_impl.h +++ b/src/components/security_manager/include/security_manager/crypto_manager_impl.h @@ -137,6 +137,11 @@ class CryptoManagerImpl : public CryptoManager { int pull_number_from_buf(char* buf, int* idx); void asn1_time_to_tm(ASN1_TIME* time); + /** + * @brief Sets initial certificate datetime + */ + void InitCertExpTime(); + const utils::SharedPtr<const CryptoManagerSettings> settings_; SSL_CTX* context_; mutable struct tm expiration_time_; diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h index d4231ffaa0..469b97d1e1 100644 --- a/src/components/security_manager/include/security_manager/security_manager_impl.h +++ b/src/components/security_manager/include/security_manager/security_manager_impl.h @@ -141,6 +141,12 @@ class SecurityManagerImpl : public SecurityManager, void StartHandshake(uint32_t connection_key) OVERRIDE; /** + * @brief Checks whether certificate should be updated + * @return true if certificate should be updated otherwise false + */ + bool IsCertificateUpdateRequired() OVERRIDE; + + /** * \brief Add/Remove for SecurityManagerListener */ void AddListener(SecurityManagerListener* const listener) OVERRIDE; @@ -158,7 +164,19 @@ class SecurityManagerImpl : public SecurityManager, * @brief Notifiers for listeners. * Allows to notify that certificate should be updated */ - void NotifyOnCertififcateUpdateRequired(); + DEPRECATED void NotifyOnCertififcateUpdateRequired(); + + /** + * @brief Notifiers for listeners. + * Allows to notify that certificate should be updated + */ + void NotifyOnCertificateUpdateRequired() OVERRIDE; + + /** + * @brief Check is policy certificate data is empty + * @return true if policy certificate data is not empty otherwise false + */ + bool IsPolicyCertificateDataEmpty() OVERRIDE; /** * @brief SecurityConfigSection diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc index 00fcb1385a..6bee28a976 100644 --- a/src/components/security_manager/src/crypto_manager_impl.cc +++ b/src/components/security_manager/src/crypto_manager_impl.cc @@ -93,6 +93,7 @@ CryptoManagerImpl::CryptoManagerImpl( OpenSSL_add_all_algorithms(); SSL_library_init(); } + InitCertExpTime(); } CryptoManagerImpl::~CryptoManagerImpl() { @@ -295,6 +296,8 @@ const CryptoManagerSettings& CryptoManagerImpl::get_settings() const { } bool CryptoManagerImpl::set_certificate(const std::string& cert_data) { + LOG4CXX_AUTO_TRACE(logger_); + if (cert_data.empty()) { LOG4CXX_WARN(logger_, "Empty certificate"); return false; @@ -324,20 +327,35 @@ bool CryptoManagerImpl::set_certificate(const std::string& cert_data) { } if (!SSL_CTX_use_certificate(context_, cert)) { - LOG4CXX_WARN(logger_, "Could not use certificate"); + LOG4CXX_WARN(logger_, "Could not use certificate: " << LastError()); return false; } asn1_time_to_tm(X509_get_notAfter(cert)); if (!SSL_CTX_use_PrivateKey(context_, pkey)) { - LOG4CXX_ERROR(logger_, "Could not use key"); + LOG4CXX_ERROR(logger_, "Could not use key: " << LastError()); return false; } + if (!SSL_CTX_check_private_key(context_)) { - LOG4CXX_ERROR(logger_, "Could not use certificate "); + LOG4CXX_ERROR(logger_, "Could not use certificate: " << LastError()); return false; } + + X509_STORE* store = SSL_CTX_get_cert_store(context_); + if (store) { + X509* extra_cert = NULL; + while ((extra_cert = PEM_read_bio_X509(bio_cert, NULL, 0, 0))) { + if (extra_cert != cert) { + LOG4CXX_DEBUG(logger_, + "Added new certificate to store: " << extra_cert); + X509_STORE_add_cert(store, extra_cert); + } + } + } + + LOG4CXX_DEBUG(logger_, "Certificate and key successfully updated"); return true; } @@ -384,4 +402,8 @@ void CryptoManagerImpl::asn1_time_to_tm(ASN1_TIME* time) { } } +void CryptoManagerImpl::InitCertExpTime() { + strptime("1 Jan 1970 00:00:00", "%d %b %Y %H:%M:%S", &expiration_time_); +} + } // namespace security_manager diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc index 556cc291d1..1853b218b4 100644 --- a/src/components/security_manager/src/security_manager_impl.cc +++ b/src/components/security_manager/src/security_manager_impl.cc @@ -188,10 +188,6 @@ void SecurityManagerImpl::StartHandshake(uint32_t connection_key) { return; } - if (crypto_manager_->IsCertificateUpdateRequired()) { - NotifyOnCertififcateUpdateRequired(); - } - if (ssl_context->IsInitCompleted()) { NotifyListenersOnHandshakeDone(connection_key, SSLContext::Handshake_Result_Success); @@ -219,14 +215,22 @@ void SecurityManagerImpl::StartHandshake(uint32_t connection_key) { SendHandshakeBinData(connection_key, data, data_size); } } + +bool SecurityManagerImpl::IsCertificateUpdateRequired() { + LOG4CXX_AUTO_TRACE(logger_); + return crypto_manager_->IsCertificateUpdateRequired(); +} + void SecurityManagerImpl::AddListener(SecurityManagerListener* const listener) { if (!listener) { LOG4CXX_ERROR(logger_, "Invalid (NULL) pointer to SecurityManagerListener."); return; } + LOG4CXX_DEBUG(logger_, "Adding listener " << listener); listeners_.push_back(listener); } + void SecurityManagerImpl::RemoveListener( SecurityManagerListener* const listener) { if (!listener) { @@ -236,13 +240,15 @@ void SecurityManagerImpl::RemoveListener( } listeners_.remove(listener); } + void SecurityManagerImpl::NotifyListenersOnHandshakeDone( const uint32_t& connection_key, SSLContext::HandshakeResult error) { LOG4CXX_AUTO_TRACE(logger_); std::list<SecurityManagerListener*>::iterator it = listeners_.begin(); while (it != listeners_.end()) { if ((*it)->OnHandshakeDone(connection_key, error)) { - // On get notification remove listener + LOG4CXX_DEBUG(logger_, "Destroying listener: " << *it); + delete (*it); it = listeners_.erase(it); } else { ++it; @@ -251,6 +257,10 @@ void SecurityManagerImpl::NotifyListenersOnHandshakeDone( } void SecurityManagerImpl::NotifyOnCertififcateUpdateRequired() { + NotifyOnCertificateUpdateRequired(); +} + +void SecurityManagerImpl::NotifyOnCertificateUpdateRequired() { LOG4CXX_AUTO_TRACE(logger_); std::list<SecurityManagerListener*>::iterator it = listeners_.begin(); while (it != listeners_.end()) { @@ -259,6 +269,19 @@ void SecurityManagerImpl::NotifyOnCertififcateUpdateRequired() { } } +bool SecurityManagerImpl::IsPolicyCertificateDataEmpty() { + LOG4CXX_AUTO_TRACE(logger_); + + std::string certificate_data; + for (auto it = listeners_.begin(); it != listeners_.end(); ++it) { + if ((*it)->GetPolicyCertificateData(certificate_data)) { + LOG4CXX_DEBUG(logger_, "Certificate data received from listener"); + return certificate_data.empty(); + } + } + return false; +} + bool SecurityManagerImpl::ProccessHandshakeData( const SecurityMessage& inMessage) { LOG4CXX_INFO(logger_, "SendHandshakeData processing"); diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc index 1178efbc0d..b334e78e19 100644 --- a/src/components/security_manager/test/security_manager_test.cc +++ b/src/components/security_manager/test/security_manager_test.cc @@ -31,6 +31,7 @@ */ #include <string> +#include <memory> #include "gtest/gtest.h" #include "utils/byte_order.h" @@ -98,7 +99,9 @@ class SecurityManagerTest : public ::testing::Test { security_manager_.reset(new SecurityManagerImpl()); security_manager_->set_session_observer(&mock_session_observer); security_manager_->set_protocol_handler(&mock_protocol_handler); - security_manager_->AddListener(&mock_sm_listener); + mock_sm_listener.reset(new testing::StrictMock< + security_manager_test::MockSecurityManagerListener>()); + security_manager_->AddListener(mock_sm_listener.get()); } void SetMockCryptoManager() { @@ -161,8 +164,8 @@ class SecurityManagerTest : public ::testing::Test { mock_ssl_context_new; testing::StrictMock<security_manager_test::MockSSLContext> mock_ssl_context_exists; - testing::StrictMock<security_manager_test::MockSecurityManagerListener> - mock_sm_listener; + std::unique_ptr<testing::StrictMock< + security_manager_test::MockSecurityManagerListener> > mock_sm_listener; }; // Test Bodies @@ -190,15 +193,15 @@ TEST_F(SecurityManagerTest, Listeners_NULL) { * Twice remove listener */ TEST_F(SecurityManagerTest, Listeners_TwiceRemoveListeners) { - security_manager_->RemoveListener(&mock_sm_listener); - security_manager_->RemoveListener(&mock_sm_listener); + security_manager_->RemoveListener(mock_sm_listener.get()); + security_manager_->RemoveListener(mock_sm_listener.get()); } /* * Add and remove listeners */ TEST_F(SecurityManagerTest, Listeners_NoListeners) { // Check correct removing listener - security_manager_->RemoveListener(&mock_sm_listener); + security_manager_->RemoveListener(mock_sm_listener.get()); // Expect no calls testing::StrictMock<MockSecurityManagerListener> mock_listener2; @@ -215,49 +218,51 @@ TEST_F(SecurityManagerTest, Listeners_NoListeners) { */ TEST_F(SecurityManagerTest, Listeners_Notifying) { // Check correct removing listener - security_manager_->RemoveListener(&mock_sm_listener); + security_manager_->RemoveListener(mock_sm_listener.get()); - testing::StrictMock<MockSecurityManagerListener> mock_listener1; - testing::StrictMock<MockSecurityManagerListener> mock_listener2; + testing::StrictMock<MockSecurityManagerListener>* mock_listener1 = + new testing::StrictMock<MockSecurityManagerListener>(); + testing::StrictMock<MockSecurityManagerListener>* mock_listener2 = + new testing::StrictMock<MockSecurityManagerListener>(); const SSLContext::HandshakeResult first_call_value = SSLContext::Handshake_Result_Success; // Expect call both listeners on 1st call - EXPECT_CALL(mock_listener1, OnHandshakeDone(key, first_call_value)) + EXPECT_CALL(*mock_listener1, OnHandshakeDone(key, first_call_value)) . // Emulate false (reject) result WillOnce(Return(false)); - EXPECT_CALL(mock_listener2, OnHandshakeDone(key, first_call_value)) + EXPECT_CALL(*mock_listener2, OnHandshakeDone(key, first_call_value)) . // Emulate true (accept) result WillOnce(Return(true)); // First listener was not removed from listener list // So this callback wil lbe either call. - EXPECT_CALL(mock_listener1, OnCertificateUpdateRequired()); + EXPECT_CALL(*mock_listener1, OnCertificateUpdateRequired()); const SSLContext::HandshakeResult second_call_value = SSLContext::Handshake_Result_Fail; // Expect call last listener on 2d call - EXPECT_CALL(mock_listener1, OnHandshakeDone(key, second_call_value)) + EXPECT_CALL(*mock_listener1, OnHandshakeDone(key, second_call_value)) . // Emulate false (reject) result WillOnce(Return(true)); // Expect no call 3d call - security_manager_->AddListener(&mock_listener1); - security_manager_->AddListener(&mock_listener2); + security_manager_->AddListener(mock_listener1); + security_manager_->AddListener(mock_listener2); // 1st call security_manager_->NotifyListenersOnHandshakeDone(key, first_call_value); - security_manager_->NotifyOnCertififcateUpdateRequired(); + security_manager_->NotifyOnCertificateUpdateRequired(); // 2nd call security_manager_->NotifyListenersOnHandshakeDone(key, second_call_value); - security_manager_->NotifyOnCertififcateUpdateRequired(); + security_manager_->NotifyOnCertificateUpdateRequired(); // 3nd call security_manager_->NotifyListenersOnHandshakeDone( key, SSLContext::Handshake_Result_Fail); - security_manager_->NotifyOnCertififcateUpdateRequired(); + security_manager_->NotifyOnCertificateUpdateRequired(); } /* @@ -495,7 +500,7 @@ TEST_F(SecurityManagerTest, StartHandshake_ServiceStillUnprotected) { SendMessageToMobileApp( InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), is_final)); // Expect notifying listeners (unsuccess) - EXPECT_CALL(mock_sm_listener, + EXPECT_CALL(*mock_sm_listener, OnHandshakeDone(key, SSLContext::Handshake_Result_Fail)) .WillOnce(Return(true)); @@ -504,6 +509,9 @@ TEST_F(SecurityManagerTest, StartHandshake_ServiceStillUnprotected) { .WillOnce(ReturnNull()); security_manager_->StartHandshake(key); + + // Listener was destroyed after OnHandshakeDone call + mock_sm_listener.release(); } /* * Shall send InternallError on SSL error and notify listeners @@ -527,7 +535,7 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInternalError) { SendMessageToMobileApp( InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), is_final)); // Expect notifying listeners (unsuccess) - EXPECT_CALL(mock_sm_listener, + EXPECT_CALL(*mock_sm_listener, OnHandshakeDone(key, SSLContext::Handshake_Result_Fail)) .WillOnce(Return(true)); @@ -543,6 +551,9 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInternalError) { Return(SSLContext::Handshake_Result_Fail))); security_manager_->StartHandshake(key); + + // Listener was destroyed after OnHandshakeDone call + mock_sm_listener.release(); } /* * Shall send data on call StartHandshake @@ -598,7 +609,7 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInitIsComplete) { SetMockCryptoManager(); // Expect no message send // Expect notifying listeners (success) - EXPECT_CALL(mock_sm_listener, + EXPECT_CALL(*mock_sm_listener, OnHandshakeDone(key, SSLContext::Handshake_Result_Success)) .WillOnce(Return(true)); @@ -607,10 +618,11 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInitIsComplete) { .WillOnce(Return(&mock_ssl_context_exists)); EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted()) .WillOnce(Return(true)); - EXPECT_CALL(mock_crypto_manager, IsCertificateUpdateRequired()) - .WillOnce(Return(false)); security_manager_->StartHandshake(key); + + // Listener was destroyed after OnHandshakeDone call + mock_sm_listener.release(); } /* * Shall send InternallError on @@ -667,7 +679,7 @@ TEST_F(SecurityManagerTest, times++; // Expect notifying listeners (unsuccess) - EXPECT_CALL(mock_sm_listener, + EXPECT_CALL(*mock_sm_listener, OnHandshakeDone(key, SSLContext::Handshake_Result_Fail)) .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true))); times++; @@ -681,6 +693,9 @@ TEST_F(SecurityManagerTest, EmulateMobileMessageHandshake(data, sizeof(data) / sizeof(data[0])); EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout)); + + // Listener was destroyed after OnHandshakeDone call + mock_sm_listener.release(); } /* * Shall send InternallError on getting @@ -718,7 +733,7 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_InvalidData) { .WillRepeatedly(NotifyTestAsyncWaiter(&waiter)); times += handshake_emulates; // Expect notifying listeners (unsuccess) - EXPECT_CALL(mock_sm_listener, + EXPECT_CALL(*mock_sm_listener, OnHandshakeDone(key, SSLContext::Handshake_Result_Fail)) .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true))); times++; @@ -761,6 +776,9 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_InvalidData) { handshake_data, handshake_data_size, handshake_emulates); EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout)); + + // Listener was destroyed after OnHandshakeDone call + mock_sm_listener.release(); } /* * Shall send HandshakeData on getting SEND_HANDSHAKE_DATA from mobile side @@ -796,7 +814,7 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_Answer) { times += handshake_emulates; // Expect notifying listeners (unsuccess) - EXPECT_CALL(mock_sm_listener, + EXPECT_CALL(*mock_sm_listener, OnHandshakeDone(key, SSLContext::Handshake_Result_Fail)) .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true))); times++; @@ -833,6 +851,9 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_Answer) { handshake_data, handshake_data_size, handshake_emulates); EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout)); + + // Listener was destroyed after OnHandshakeDone call + mock_sm_listener.release(); } /* * Shall call all listeners on success end handshake @@ -848,7 +869,7 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_HandshakeFinished) { uint32_t times = 0; // Expect no errors // Expect notifying listeners (success) - EXPECT_CALL(mock_sm_listener, + EXPECT_CALL(*mock_sm_listener, OnHandshakeDone(key, SSLContext::Handshake_Result_Success)) .WillOnce(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true))); times++; @@ -924,6 +945,9 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_HandshakeFinished) { handshake_data, handshake_data_size, handshake_emulates); EXPECT_TRUE(waiter.WaitFor(times, kAsyncExpectationsTimeout)); + + // Listener was destroyed after OnHandshakeDone call + mock_sm_listener.release(); } /* * Shall not any query on getting empty SEND_INTERNAL_ERROR diff --git a/src/components/security_manager/test/ssl_certificate_handshake_test.cc b/src/components/security_manager/test/ssl_certificate_handshake_test.cc index 9375d6cc32..dc335c8da2 100644 --- a/src/components/security_manager/test/ssl_certificate_handshake_test.cc +++ b/src/components/security_manager/test/ssl_certificate_handshake_test.cc @@ -372,11 +372,8 @@ TEST_F(SSLHandshakeTest, CAVerification_ServerSide) { } TEST_F(SSLHandshakeTest, CAVerification_ServerSide_NoCACertificate) { - ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2, - server_certificate, - "ALL", - verify_peer, - "unex")) + ASSERT_TRUE(InitServerManagers( + security_manager::TLSv1_2, "", "ALL", verify_peer, "unex")) << server_manager->LastError(); ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2, client_certificate, @@ -423,7 +420,7 @@ TEST_F(SSLHandshakeTest, CAVerification_ClientSide_NoCACertificate) { "")) << server_manager->LastError(); ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2, - client_certificate, + "", "ALL", verify_peer, "client_ca_cert_filename")) diff --git a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h index dfbf4ba43e..cdddcfed55 100644 --- a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h @@ -49,11 +49,20 @@ class CAlwaysFalseSchemaItem : public ISchemaItem { **/ static utils::SharedPtr<CAlwaysFalseSchemaItem> create(); /** + * @deprecated * @brief Validate smart object. * @param Object Object to validate. * @return Errors::ERROR **/ Errors::eType validate(const SmartObject& Object) OVERRIDE; + /** + * @brief Validate smart object. + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * @return Errors::ERROR + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) OVERRIDE; private: CAlwaysFalseSchemaItem(); diff --git a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h index 3dd598d7bd..e078ae3240 100644 --- a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h @@ -49,11 +49,20 @@ class CAlwaysTrueSchemaItem : public ISchemaItem { **/ static utils::SharedPtr<CAlwaysTrueSchemaItem> create(); /** + * @deprecated * @brief Validate smart object. * @param Object Object to validate. * @return NsSmartObjects::Errors::eType **/ Errors::eType validate(const SmartObject& Object) OVERRIDE; + /** + * @brief Validate smart object. + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * @return NsSmartObjects::Errors::eType + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) OVERRIDE; private: CAlwaysTrueSchemaItem(); diff --git a/src/components/smart_objects/include/smart_objects/array_schema_item.h b/src/components/smart_objects/include/smart_objects/array_schema_item.h index 0d3a651d56..937979f2fa 100644 --- a/src/components/smart_objects/include/smart_objects/array_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/array_schema_item.h @@ -63,6 +63,8 @@ class CArraySchemaItem : public ISchemaItem { TSchemaItemParameter<size_t>()); /** + * @deprecated + * * @brief Validate smart object. * * @param Object Object to validate. @@ -72,6 +74,18 @@ class CArraySchemaItem : public ISchemaItem { Errors::eType validate(const SmartObject& Object) OVERRIDE; /** + * @brief Validate smart object. + * + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * message if an error occurs + * + * @return NsSmartObjects::Errors::eType + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) OVERRIDE; + + /** * @brief Apply schema. * * @param Object Object to apply schema. diff --git a/src/components/smart_objects/include/smart_objects/default_shema_item.h b/src/components/smart_objects/include/smart_objects/default_shema_item.h index 857354a4e6..56952dbac1 100644 --- a/src/components/smart_objects/include/smart_objects/default_shema_item.h +++ b/src/components/smart_objects/include/smart_objects/default_shema_item.h @@ -50,11 +50,20 @@ class CDefaultSchemaItem : public ISchemaItem { public: typedef TSchemaItemParameter<Type> ParameterType; /** + * @deprecated * @brief Validate smart object. * @param Object Object to validate. - * @return NsSmartObjects::Errors::eType + * @return Errors::ERROR **/ Errors::eType validate(const SmartObject& Object) OVERRIDE; + /** + * @brief Validate smart object. + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * @return Errors::ERROR + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) OVERRIDE; /** * @brief Set default value to an object. @@ -99,8 +108,23 @@ CDefaultSchemaItem<Type>::CDefaultSchemaItem(const ParameterType& DefaultValue) template <typename Type> Errors::eType CDefaultSchemaItem<Type>::validate(const SmartObject& Object) { - return (getSmartType() == Object.getType()) ? Errors::OK - : Errors::INVALID_VALUE; + rpc::ValidationReport report("RPC"); + return validate(Object, &report); +} + +template <typename Type> +Errors::eType CDefaultSchemaItem<Type>::validate( + const SmartObject& Object, rpc::ValidationReport* report__) { + if (getSmartType() != Object.getType()) { + std::string validation_info = "Incorrect type, expected: " + + SmartObject::typeToString(getSmartType()) + + ", got: " + + SmartObject::typeToString(Object.getType()); + report__->set_validation_info(validation_info); + return Errors::INVALID_VALUE; + } else { + return Errors::OK; + } } template <typename Type> diff --git a/src/components/smart_objects/include/smart_objects/enum_schema_item.h b/src/components/smart_objects/include/smart_objects/enum_schema_item.h index a0d6d94017..524d966188 100644 --- a/src/components/smart_objects/include/smart_objects/enum_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/enum_schema_item.h @@ -65,12 +65,21 @@ class TEnumSchemaItem : public CDefaultSchemaItem<EnumType> { const TSchemaItemParameter<EnumType>& DefaultValue = TSchemaItemParameter<EnumType>()); /** + * @deprecated * @brief Validate smart object. * @param Object Object to validate. * @return NsSmartObjects::Errors::eType **/ Errors::eType validate(const SmartObject& Object) OVERRIDE; /** + * @brief Validate smart object. + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * @return NsSmartObjects::Errors::eType + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) OVERRIDE; + /** * @brief Apply schema. * This implementation checks if enumeration is represented as string * and tries to convert it to integer according to element-to-string @@ -207,11 +216,32 @@ utils::SharedPtr<TEnumSchemaItem<EnumType> > TEnumSchemaItem<EnumType>::create( template <typename EnumType> Errors::eType TEnumSchemaItem<EnumType>::validate(const SmartObject& Object) { + rpc::ValidationReport report("RPC"); + return validate(Object, &report); +} + +template <typename EnumType> +Errors::eType TEnumSchemaItem<EnumType>::validate( + const SmartObject& Object, rpc::ValidationReport* report__) { if (SmartType_Integer != Object.getType()) { + std::string validation_info; + if (SmartType_String == Object.getType()) { + validation_info = "Invalid enum value: " + Object.asString(); + } else { + validation_info = "Incorrect type, expected: " + + SmartObject::typeToString(SmartType_Integer) + + " (enum), got: " + + SmartObject::typeToString(Object.getType()); + } + report__->set_validation_info(validation_info); return Errors::INVALID_VALUE; } if (mAllowedElements.find(static_cast<EnumType>(Object.asInt())) == mAllowedElements.end()) { + std::stringstream stream; + stream << "Invalid enum value: " << Object.asInt(); + std::string validation_info = stream.str(); + report__->set_validation_info(validation_info); return Errors::OUT_OF_RANGE; } return Errors::OK; diff --git a/src/components/smart_objects/include/smart_objects/number_schema_item.h b/src/components/smart_objects/include/smart_objects/number_schema_item.h index 01d6c08daa..d549b9891a 100644 --- a/src/components/smart_objects/include/smart_objects/number_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/number_schema_item.h @@ -65,11 +65,20 @@ class TNumberSchemaItem : public CDefaultSchemaItem<NumberType> { TSchemaItemParameter<NumberType>()); /** + * @deprecated * @brief Validate smart object. * @param Object Object to validate. - * @return NsSmartObjects::Errors::eType + * @return Errors::ERROR **/ Errors::eType validate(const SmartObject& Object) OVERRIDE; + /** + * @brief Validate smart object. + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * @return Errors::ERROR + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) OVERRIDE; private: /** @@ -128,7 +137,21 @@ bool TNumberSchemaItem<NumberType>::isValidNumberType(SmartType type) { template <typename NumberType> Errors::eType TNumberSchemaItem<NumberType>::validate( const SmartObject& Object) { + rpc::ValidationReport report("RPC"); + return validate(Object, &report); +} + +template <typename NumberType> +Errors::eType TNumberSchemaItem<NumberType>::validate( + const SmartObject& Object, rpc::ValidationReport* report__) { if (!isValidNumberType(Object.getType())) { + SmartType expectedType = (typeid(double) == typeid(Object.getType())) + ? SmartType_Double + : SmartType_Integer; + std::string validation_info = + "Incorrect type, expected: " + SmartObject::typeToString(expectedType) + + ", got: " + SmartObject::typeToString(Object.getType()); + report__->set_validation_info(validation_info); return Errors::INVALID_VALUE; } NumberType value(0); @@ -148,10 +171,20 @@ Errors::eType TNumberSchemaItem<NumberType>::validate( NumberType rangeLimit; if (mMinValue.getValue(rangeLimit) && (value < rangeLimit)) { + std::stringstream stream; + stream << "Value too small, got: " << value + << ", minimum allowed: " << rangeLimit; + std::string validation_info = stream.str(); + report__->set_validation_info(validation_info); return Errors::OUT_OF_RANGE; } if (mMaxValue.getValue(rangeLimit) && (value > rangeLimit)) { + std::stringstream stream; + stream << "Value too large, got: " << value + << ", maximum allowed: " << rangeLimit; + std::string validation_info = stream.str(); + report__->set_validation_info(validation_info); return Errors::OUT_OF_RANGE; } return Errors::OK; diff --git a/src/components/smart_objects/include/smart_objects/object_schema_item.h b/src/components/smart_objects/include/smart_objects/object_schema_item.h index 549166e723..8922caba45 100644 --- a/src/components/smart_objects/include/smart_objects/object_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/object_schema_item.h @@ -84,12 +84,21 @@ class CObjectSchemaItem : public ISchemaItem { **/ static utils::SharedPtr<CObjectSchemaItem> create(const Members& Members); /** + * @deprecated * @brief Validate smart object. * @param Object Object to validate. * @return NsSmartObjects::Errors::eType **/ Errors::eType validate(const SmartObject& Object) OVERRIDE; /** + * @brief Validate smart object. + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * @return NsSmartObjects::Errors::eType + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) OVERRIDE; + /** * @brief Apply schema. * @param Object Object to apply schema. * @param RemoveFakeParameters contains true if need to remove fake parameters diff --git a/src/components/smart_objects/include/smart_objects/schema_item.h b/src/components/smart_objects/include/smart_objects/schema_item.h index 08610f244e..446c7fa65f 100644 --- a/src/components/smart_objects/include/smart_objects/schema_item.h +++ b/src/components/smart_objects/include/smart_objects/schema_item.h @@ -34,6 +34,7 @@ #include <stdlib.h> #include "utils/shared_ptr.h" +#include "rpc_base/validation_report.h" #include "smart_objects/errors.h" @@ -47,13 +48,27 @@ class SmartObject; class ISchemaItem { public: /** - * @brief Validate object. + * @deprecated + * + * @brief Validate smart object. + * + * @param Object Object to validate. + * + * @return NsSmartObjects::Errors::eType + **/ + DEPRECATED virtual Errors::eType validate(const SmartObject& Object); + + /** + * @brief Validate smart object. * * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * message if an error occurs * * @return NsSmartObjects::Errors::eType **/ - virtual Errors::eType validate(const SmartObject& Object); + virtual Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__); /** * @brief Set default value to an object. diff --git a/src/components/smart_objects/include/smart_objects/smart_object.h b/src/components/smart_objects/include/smart_objects/smart_object.h index 98e58fffd1..cc2bc7e22c 100644 --- a/src/components/smart_objects/include/smart_objects/smart_object.h +++ b/src/components/smart_objects/include/smart_objects/smart_object.h @@ -40,6 +40,7 @@ #include "smart_objects/smart_schema.h" #include "utils/custom_string.h" +#include "rpc_base/validation_report.h" namespace NsSmartDeviceLink { namespace NsSmartObjects { @@ -670,11 +671,20 @@ class SmartObject FINAL { bool isValid() const; /** + * @deprecated * @brief Validates object according to attached schema. * * @return Result of validation. */ - Errors::eType validate(); + DEPRECATED Errors::eType validate(); + + /** + * @brief Validates object according to attached schema. + * + * @param report__ object for reporting errors during validation + * @return Result of validation. + */ + Errors::eType validate(rpc::ValidationReport* report__); /** * @brief Sets new schema @@ -727,6 +737,35 @@ class SmartObject FINAL { return !(*this == Other); } + static std::string typeToString(SmartType type) { + switch (type) { + case SmartType_Null: + return "Null"; + case SmartType_Boolean: + return "Boolean"; + case SmartType_Integer: + return "Integer"; + case SmartType_Character: + return "Character"; + case SmartType_String: + return "String"; + case SmartType_Double: + return "Double"; + case SmartType_Map: + return "Object"; + case SmartType_Array: + return "Array"; + case SmartType_Binary: + return "Binary_Data"; + case SmartType_UInteger: + return "Unsigned_Integer"; + case SmartType_Invalid: + return "Invalid_Type"; + default: + return "Unknown_Type"; + } + } + protected: static std::string OperatorToTransform(const SmartMap::value_type& pair); /** diff --git a/src/components/smart_objects/include/smart_objects/smart_schema.h b/src/components/smart_objects/include/smart_objects/smart_schema.h index 52dfa12004..ada5646043 100644 --- a/src/components/smart_objects/include/smart_objects/smart_schema.h +++ b/src/components/smart_objects/include/smart_objects/smart_schema.h @@ -61,13 +61,26 @@ class CSmartSchema FINAL { explicit CSmartSchema(const ISchemaItemPtr SchemaItem); /** + * @deprecated + * * @brief Validate smart object. * - * @param Object SmartObject to validate. + * @param Object Object to validate. * - * @return Result of validation. - */ - Errors::eType validate(const SmartObject& Object) const; + * @return NsSmartObjects::Errors::eType + **/ + DEPRECATED Errors::eType validate(const SmartObject& Object) const; + + /** + * @brief Validate smart object. + * + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * + * @return NsSmartObjects::Errors::eType + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) const; /** * @brief Set new root schema item. diff --git a/src/components/smart_objects/include/smart_objects/string_schema_item.h b/src/components/smart_objects/include/smart_objects/string_schema_item.h index 7fad8491a5..6c98dcc3b3 100644 --- a/src/components/smart_objects/include/smart_objects/string_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/string_schema_item.h @@ -62,11 +62,20 @@ class CStringSchemaItem : public CDefaultSchemaItem<std::string> { const TSchemaItemParameter<std::string>& DefaultValue = TSchemaItemParameter<std::string>()); /** + * @deprecated * @brief Validate smart object. * @param Object Object to validate. * @return NsSmartObjects::Errors::eType **/ Errors::eType validate(const SmartObject& Object) OVERRIDE; + /** + * @brief Validate smart object. + * @param Object Object to validate. + * @param report__ object for reporting errors during validation + * @return NsSmartObjects::Errors::eType + **/ + Errors::eType validate(const SmartObject& Object, + rpc::ValidationReport* report__) OVERRIDE; private: /** diff --git a/src/components/smart_objects/src/always_false_schema_item.cc b/src/components/smart_objects/src/always_false_schema_item.cc index 59e50e10c2..1893ed24d1 100644 --- a/src/components/smart_objects/src/always_false_schema_item.cc +++ b/src/components/smart_objects/src/always_false_schema_item.cc @@ -42,6 +42,13 @@ utils::SharedPtr<CAlwaysFalseSchemaItem> CAlwaysFalseSchemaItem::create() { } Errors::eType CAlwaysFalseSchemaItem::validate(const SmartObject& object) { + rpc::ValidationReport report("RPC"); + return validate(object, &report); +} + +Errors::eType CAlwaysFalseSchemaItem::validate( + const SmartObject& object, rpc::ValidationReport* report__) { + report__->set_validation_info("Generic error"); return Errors::ERROR; } } // namespace NsSmartObjects diff --git a/src/components/smart_objects/src/always_true_schema_item.cc b/src/components/smart_objects/src/always_true_schema_item.cc index a474b0e157..1e7115316d 100644 --- a/src/components/smart_objects/src/always_true_schema_item.cc +++ b/src/components/smart_objects/src/always_true_schema_item.cc @@ -43,5 +43,10 @@ Errors::eType CAlwaysTrueSchemaItem::validate(const SmartObject& object) { return Errors::OK; } +Errors::eType CAlwaysTrueSchemaItem::validate(const SmartObject& object, + rpc::ValidationReport* report__) { + return Errors::OK; +} + } // namespace NsSmartObjects } // namespace NsSmartDeviceLink diff --git a/src/components/smart_objects/src/array_schema_item.cc b/src/components/smart_objects/src/array_schema_item.cc index 105cacb25c..dca0a815e0 100644 --- a/src/components/smart_objects/src/array_schema_item.cc +++ b/src/components/smart_objects/src/array_schema_item.cc @@ -42,22 +42,45 @@ utils::SharedPtr<CArraySchemaItem> CArraySchemaItem::create( } Errors::eType CArraySchemaItem::validate(const SmartObject& Object) { + rpc::ValidationReport report("RPC"); + return validate(Object, &report); +} + +Errors::eType CArraySchemaItem::validate(const SmartObject& Object, + rpc::ValidationReport* report__) { if (SmartType_Array != Object.getType()) { + std::string validation_info = "Incorrect type, expected: " + + SmartObject::typeToString(SmartType_Array) + + ", got: " + + SmartObject::typeToString(Object.getType()); + report__->set_validation_info(validation_info); return Errors::INVALID_VALUE; } size_t sizeLimit; const size_t array_len = Object.length(); if (mMinSize.getValue(sizeLimit) && (array_len < sizeLimit)) { + std::stringstream stream; + stream << "Got array of size: " << array_len + << ", minimum allowed: " << sizeLimit; + std::string validation_info = stream.str(); + report__->set_validation_info(validation_info); return Errors::OUT_OF_RANGE; } if (mMaxSize.getValue(sizeLimit) && (array_len > sizeLimit)) { + std::stringstream stream; + stream << "Got array of size: " << array_len + << ", maximum allowed: " << sizeLimit; + std::string validation_info = stream.str(); + report__->set_validation_info(validation_info); return Errors::OUT_OF_RANGE; } for (size_t i = 0u; i < array_len; ++i) { - const Errors::eType result = - mElementSchemaItem->validate(Object.getElement(i)); + std::stringstream strVal; + strVal << i; + const Errors::eType result = mElementSchemaItem->validate( + Object.getElement(i), &report__->ReportSubobject(strVal.str())); if (Errors::OK != result) { return result; } diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc index f0c17faaea..2bed3d9a26 100644 --- a/src/components/smart_objects/src/object_schema_item.cc +++ b/src/components/smart_objects/src/object_schema_item.cc @@ -57,7 +57,18 @@ utils::SharedPtr<CObjectSchemaItem> CObjectSchemaItem::create( } Errors::eType CObjectSchemaItem::validate(const SmartObject& object) { + rpc::ValidationReport report("RPC"); + return validate(object, &report); +} + +Errors::eType CObjectSchemaItem::validate(const SmartObject& object, + rpc::ValidationReport* report__) { if (SmartType_Map != object.getType()) { + std::string validation_info = "Incorrect type, expected: " + + SmartObject::typeToString(SmartType_Map) + + ", got: " + + SmartObject::typeToString(object.getType()); + report__->set_validation_info(validation_info); return Errors::INVALID_VALUE; } @@ -71,12 +82,15 @@ Errors::eType CObjectSchemaItem::validate(const SmartObject& object) { std::set<std::string>::const_iterator key_it = object_keys.find(key); if (object_keys.end() == key_it) { if (member.mIsMandatory) { + std::string validation_info = "Missing mandatory parameter: " + key; + report__->set_validation_info(validation_info); return Errors::MISSING_MANDATORY_PARAMETER; } continue; } const SmartObject& field = object.getElement(key); - const Errors::eType result = member.mSchemaItem->validate(field); + const Errors::eType result = + member.mSchemaItem->validate(field, &report__->ReportSubobject(key)); if (Errors::OK != result) { return result; } diff --git a/src/components/smart_objects/src/schema_item.cc b/src/components/smart_objects/src/schema_item.cc index 8c0bc0edb3..22735d40d5 100644 --- a/src/components/smart_objects/src/schema_item.cc +++ b/src/components/smart_objects/src/schema_item.cc @@ -35,7 +35,12 @@ namespace NsSmartDeviceLink { namespace NsSmartObjects { -Errors::eType ISchemaItem::validate(const SmartObject& object) { +Errors::eType ISchemaItem::validate(const SmartObject& Object) { + return Errors::ERROR; +} + +Errors::eType ISchemaItem::validate(const SmartObject& object, + rpc::ValidationReport* report__) { return Errors::ERROR; } diff --git a/src/components/smart_objects/src/smart_object.cc b/src/components/smart_objects/src/smart_object.cc index 5c90de5671..a0925eef05 100644 --- a/src/components/smart_objects/src/smart_object.cc +++ b/src/components/smart_objects/src/smart_object.cc @@ -869,11 +869,17 @@ bool SmartObject::erase(const std::string& Key) { } bool SmartObject::isValid() const { - return (Errors::OK == m_schema.validate(*this)); + rpc::ValidationReport report("RPC"); + return (Errors::OK == m_schema.validate(*this, &report)); } Errors::eType SmartObject::validate() { - return m_schema.validate(*this); + rpc::ValidationReport report("RPC"); + return validate(&report); +} + +Errors::eType SmartObject::validate(rpc::ValidationReport* report__) { + return m_schema.validate(*this, report__); } void SmartObject::setSchema(const CSmartSchema& schema) { diff --git a/src/components/smart_objects/src/smart_schema.cc b/src/components/smart_objects/src/smart_schema.cc index be24ceb076..7509ea80f1 100644 --- a/src/components/smart_objects/src/smart_schema.cc +++ b/src/components/smart_objects/src/smart_schema.cc @@ -40,8 +40,14 @@ CSmartSchema::CSmartSchema() : mSchemaItem(CAlwaysTrueSchemaItem::create()) {} CSmartSchema::CSmartSchema(const ISchemaItemPtr SchemaItem) : mSchemaItem(SchemaItem) {} -Errors::eType CSmartSchema::validate(const SmartObject& object) const { - return mSchemaItem->validate(object); +Errors::eType CSmartSchema::validate(const SmartObject& Object) const { + rpc::ValidationReport report("RPC"); + return validate(Object, &report); +} + +Errors::eType CSmartSchema::validate(const SmartObject& object, + rpc::ValidationReport* report__) const { + return mSchemaItem->validate(object, report__); } void CSmartSchema::setSchemaItem(const ISchemaItemPtr schemaItem) { diff --git a/src/components/smart_objects/src/string_schema_item.cc b/src/components/smart_objects/src/string_schema_item.cc index 3fac3a6cde..1e4c8372f0 100644 --- a/src/components/smart_objects/src/string_schema_item.cc +++ b/src/components/smart_objects/src/string_schema_item.cc @@ -46,7 +46,18 @@ utils::SharedPtr<CStringSchemaItem> CStringSchemaItem::create( } Errors::eType CStringSchemaItem::validate(const SmartObject& Object) { + rpc::ValidationReport report("RPC"); + return validate(Object, &report); +} + +Errors::eType CStringSchemaItem::validate(const SmartObject& Object, + rpc::ValidationReport* report__) { if (SmartType_String != Object.getType()) { + std::string validation_info = "Incorrect type, expected: " + + SmartObject::typeToString(SmartType_String) + + ", got: " + + SmartObject::typeToString(Object.getType()); + report__->set_validation_info(validation_info); return Errors::INVALID_VALUE; } @@ -54,9 +65,19 @@ Errors::eType CStringSchemaItem::validate(const SmartObject& Object) { size_t length; if (mMinLength.getValue(length) && (value.size() < length)) { + std::stringstream stream; + stream << "Got string of size: " << value.size() + << ", minimum allowed: " << length; + std::string validation_info = stream.str(); + report__->set_validation_info(validation_info); return Errors::OUT_OF_RANGE; } if (mMaxLength.getValue(length) && (value.size() > length)) { + std::stringstream stream; + stream << "Got string of size: " << value.size() + << ", maximum allowed: " << length; + std::string validation_info = stream.str(); + report__->set_validation_info(validation_info); return Errors::OUT_OF_RANGE; } return Errors::OK; diff --git a/src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc b/src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc index 85615d4911..9d88178598 100644 --- a/src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc +++ b/src/components/smart_objects/test/AlwaysFalseSchemaItem_test.cc @@ -52,38 +52,39 @@ TEST(test_AlwaysFalseSchemaItemTest, simple_test) { ISchemaItemPtr item = CAlwaysFalseSchemaItem::create(); obj = 5; - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::ERROR, resultType); EXPECT_EQ(5, obj.asInt()); obj = true; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::ERROR, resultType); EXPECT_TRUE(obj.asBool()); obj = "Test"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::ERROR, resultType); EXPECT_EQ(std::string("Test"), obj.asString()); obj["First"] = "Some string"; obj["Second"] = 555; - resultType = item->validate(obj["First"]); + resultType = item->validate(obj["First"], &report); EXPECT_EQ(Errors::ERROR, resultType); - resultType = item->validate(obj["Second"]); + resultType = item->validate(obj["Second"], &report); EXPECT_EQ(Errors::ERROR, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::ERROR, resultType); EXPECT_EQ(std::string("Some string"), obj["First"].asString()); EXPECT_EQ(555, obj["Second"].asInt()); obj[0] = true; obj[1] = false; - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(Errors::ERROR, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(Errors::ERROR, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::ERROR, resultType); EXPECT_TRUE(obj[0].asBool()); EXPECT_FALSE(obj[1].asBool()); diff --git a/src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc b/src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc index 7a87108cb0..40c827e17b 100644 --- a/src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc +++ b/src/components/smart_objects/test/AlwaysTrueSchemaItem_test.cc @@ -52,38 +52,39 @@ TEST(test_AlwaysTrueSchemaItemTest, simple_test) { ISchemaItemPtr item = CAlwaysTrueSchemaItem::create(); obj = 5; - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(5, obj.asInt()); obj = true; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_TRUE(obj.asBool()); obj = "Test"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(std::string("Test"), obj.asString()); obj["First"] = "Some string"; obj["Second"] = 555; - resultType = item->validate(obj["First"]); + resultType = item->validate(obj["First"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["Second"]); + resultType = item->validate(obj["Second"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(std::string("Some string"), obj["First"].asString()); EXPECT_EQ(555, obj["Second"].asInt()); obj[0] = true; obj[1] = false; - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_TRUE(obj[0].asBool()); EXPECT_FALSE(obj[1].asBool()); diff --git a/src/components/smart_objects/test/ArraySchemaItem_test.cc b/src/components/smart_objects/test/ArraySchemaItem_test.cc index fa42813f8d..9831f08442 100644 --- a/src/components/smart_objects/test/ArraySchemaItem_test.cc +++ b/src/components/smart_objects/test/ArraySchemaItem_test.cc @@ -66,28 +66,29 @@ TEST(test_no_default_value, test_ArraySchemaItemTest) { EXPECT_FALSE(obj[3][1].asBool()); EXPECT_EQ(std::string("Another String"), obj[3][2].asString()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[2]); + resultType = item->validate(obj[2], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[3]); + resultType = item->validate(obj[3], &report); EXPECT_EQ(Errors::OK, resultType); item->applySchema(obj, false); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[2]); + resultType = item->validate(obj[2], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[3]); + resultType = item->validate(obj[3], &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(38, obj[0].asInt()); @@ -101,19 +102,19 @@ TEST(test_no_default_value, test_ArraySchemaItemTest) { obj = "New valid string"; ASSERT_EQ(std::string("New valid string"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); // Obj - bool obj = true; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); // Object - number obj = 3.1415926; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); } @@ -137,24 +138,25 @@ TEST(test_item_with_default_value, test_ArraySchemaItemTest) { EXPECT_EQ(std::string("true"), obj[1].asString()); EXPECT_EQ(std::string("New String"), obj[2].asString()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[2]); + resultType = item->validate(obj[2], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); item->applySchema(obj, false); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[2]); + resultType = item->validate(obj[2], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); EXPECT_EQ(std::string("Some String"), obj[0].asString()); @@ -169,14 +171,14 @@ TEST(test_item_with_default_value, test_ArraySchemaItemTest) { EXPECT_EQ(std::string("false"), obj[3][1].asString()); EXPECT_EQ(std::string("Another String"), obj[3][2].asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[3]); + resultType = item->validate(obj[3], &report); EXPECT_EQ(Errors::OK, resultType); obj[3][3] = "Another very very loooooong String"; - resultType = item->validate(obj[3]); + resultType = item->validate(obj[3], &report); EXPECT_EQ(Errors::OK, resultType); } @@ -193,17 +195,18 @@ TEST(test_array_with_min_size, test_ArraySchemaItemTest) { obj[0] = "Some String"; - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); obj[1] = "true"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); obj[2] = "New String"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); EXPECT_EQ(std::string("Some String"), obj[0].asString()); @@ -226,22 +229,23 @@ TEST(test_array_with_max_size, test_ArraySchemaItemTest) { obj[0] = "Some String"; - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); obj[1] = "true"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); obj[2] = "New String"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); obj[3] = "Another String"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); EXPECT_EQ(std::string("Some String"), obj[0].asString()); @@ -265,27 +269,28 @@ TEST(test_array_with_min_and_max_size, test_ArraySchemaItemTest) { obj[0] = "Some String"; - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); obj[1] = "true"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); obj[2] = "New String"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); obj[3] = "Another String"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); obj[4] = "Out of array"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); EXPECT_EQ(std::string("Some String"), obj[0].asString()); @@ -307,29 +312,30 @@ TEST(test_map_validate, test_ArraySchemaItemTest) { obj["array"][0] = "Some String"; - int resultType = item->validate(obj["array"]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj["array"], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); obj["array"][1] = "true"; - resultType = item->validate(obj["array"]); + resultType = item->validate(obj["array"], &report); EXPECT_EQ(Errors::OK, resultType); obj["array"][2] = "New String"; - resultType = item->validate(obj["array"]); + resultType = item->validate(obj["array"], &report); EXPECT_EQ(Errors::OK, resultType); obj["array"][3] = "Another String"; - resultType = item->validate(obj["array"]); + resultType = item->validate(obj["array"], &report); EXPECT_EQ(Errors::OK, resultType); obj["array"][4] = "Out of array"; - resultType = item->validate(obj["array"]); + resultType = item->validate(obj["array"], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); EXPECT_EQ(std::string("Some String"), obj["array"][0].asString()); diff --git a/src/components/smart_objects/test/BoolSchemaItem_test.cc b/src/components/smart_objects/test/BoolSchemaItem_test.cc index 8e39af8e08..8d67aa59b2 100644 --- a/src/components/smart_objects/test/BoolSchemaItem_test.cc +++ b/src/components/smart_objects/test/BoolSchemaItem_test.cc @@ -63,14 +63,15 @@ TEST(test_no_default_value, test_BoolSchemaItemTest) { obj = 5; ASSERT_EQ(5, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); obj = true; ASSERT_TRUE(obj.asBool()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); bool resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); @@ -79,12 +80,12 @@ TEST(test_no_default_value, test_BoolSchemaItemTest) { obj = "Test"; ASSERT_EQ(std::string("Test"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); } @@ -109,14 +110,15 @@ TEST(test_item_with_default_value, test_BoolSchemaItemTest) { obj = 5; ASSERT_EQ(5, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); obj = true; ASSERT_TRUE(obj.asBool()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); @@ -125,14 +127,14 @@ TEST(test_item_with_default_value, test_BoolSchemaItemTest) { obj = "Test"; ASSERT_EQ(std::string("Test"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); EXPECT_FALSE(obj.asBool()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); EXPECT_FALSE(obj.asBool()); } @@ -147,10 +149,11 @@ TEST(test_map_validate, test_BoolSchemaItemTest) { obj["aa"] = true; ASSERT_TRUE(obj["aa"].asBool()); - int resultType = item->validate(obj["aa"]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj["aa"], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); @@ -162,11 +165,11 @@ TEST(test_map_validate, test_BoolSchemaItemTest) { EXPECT_TRUE(resDefault); EXPECT_FALSE(obj.asBool()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); obj["ind"] = true; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); } @@ -182,13 +185,14 @@ TEST(test_array_validate, test_BoolSchemaItemTest) { ASSERT_TRUE(obj[0].asBool()); ASSERT_FALSE(obj[1].asBool()); - int resultType = item->validate(obj[0]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj[0], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); @@ -200,13 +204,13 @@ TEST(test_array_validate, test_BoolSchemaItemTest) { EXPECT_FALSE(resDefault); EXPECT_FALSE(obj[1].asBool()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); obj = false; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); } diff --git a/src/components/smart_objects/test/CObjectSchemaItem_test.cc b/src/components/smart_objects/test/CObjectSchemaItem_test.cc index 7dd63ae6eb..523b25a8d8 100644 --- a/src/components/smart_objects/test/CObjectSchemaItem_test.cc +++ b/src/components/smart_objects/test/CObjectSchemaItem_test.cc @@ -155,7 +155,9 @@ TEST_F(ObjectSchemaItemTest, validation_correct) { obj[S_MSG_PARAMS][Keys::INFO] = "0123456789"; obj[S_MSG_PARAMS][Keys::SUCCESS] = true; - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); } TEST_F(ObjectSchemaItemTest, validation_correct_skip_not_mandatory) { @@ -167,7 +169,9 @@ TEST_F(ObjectSchemaItemTest, validation_correct_skip_not_mandatory) { // skip non-mandatory obj[S_MSG_PARAMS][Keys::INFO] obj[S_MSG_PARAMS][Keys::SUCCESS] = false; - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); } TEST_F(ObjectSchemaItemTest, validation_invalid_param) { @@ -175,7 +179,9 @@ TEST_F(ObjectSchemaItemTest, validation_invalid_param) { obj[S_PARAMS] = "some parameters"; obj[S_MSG_PARAMS] = "some message parameters"; - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_PARAMS][S_FUNCTION_ID] = "some function"; obj[S_PARAMS][S_CORRELATION_ID] = "some correlation id"; @@ -183,23 +189,35 @@ TEST_F(ObjectSchemaItemTest, validation_invalid_param) { obj[S_MSG_PARAMS][Keys::RESULT_CODE] = "some result"; obj[S_MSG_PARAMS][Keys::SUCCESS] = 0xABC; - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_PARAMS][S_FUNCTION_ID] = 1; - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_PARAMS][S_CORRELATION_ID] = -0xFF1; - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_PARAMS][S_PROTOCOL_VERSION] = 2; - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_MSG_PARAMS][Keys::RESULT_CODE] = 1; - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_MSG_PARAMS][Keys::SUCCESS] = false; - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); } TEST_F(ObjectSchemaItemTest, validation_invalid_not_mandatory_param) { SmartObject obj; @@ -211,18 +229,26 @@ TEST_F(ObjectSchemaItemTest, validation_invalid_not_mandatory_param) { // invalid non-mandatory obj[S_MSG_PARAMS][Keys::INFO] obj[S_MSG_PARAMS][Keys::INFO] = 0x10; - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); // invalid non-mandatory obj[S_MSG_PARAMS][Keys::INFO] obj[S_MSG_PARAMS][Keys::INFO] = true; - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); // invalid non-mandatory obj[S_MSG_PARAMS][Keys::INFO] obj[S_MSG_PARAMS][Keys::INFO] = SmartObject(); - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_MSG_PARAMS][Keys::INFO] = "info"; - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); } TEST_F(ObjectSchemaItemTest, validation_missing_mandatory) { @@ -234,18 +260,29 @@ TEST_F(ObjectSchemaItemTest, validation_missing_mandatory) { obj[S_MSG_PARAMS][Keys::INFO] = "123"; obj[S_MSG_PARAMS][Keys::SUCCESS] = false; - EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER, schema_item->validate(obj)); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER, + schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_PARAMS][S_FUNCTION_ID] = 2; // S_CORRELATION_ID and S_PROTOCOL_VERSION is still missed - EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER, + schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_PARAMS][S_CORRELATION_ID] = 0XFF2; // S_PROTOCOL_VERSION is still missed - EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::MISSING_MANDATORY_PARAMETER, + schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); obj[S_PARAMS][S_PROTOCOL_VERSION] = 1; - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); } TEST_F(ObjectSchemaItemTest, validation_unexpected_param) { @@ -263,15 +300,21 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param) { obj[fake1] = SmartObject(static_cast<int64_t>(0)); // any fake parameter is OK - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); obj[S_PARAMS][fake2] = SmartObject("123"); // any fake parameters are OK - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); obj[S_MSG_PARAMS][fake3] = true; // any fake parameters are OK - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); } TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) { @@ -297,7 +340,9 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) { EXPECT_TRUE(obj.keyExists(fake1)); EXPECT_TRUE(obj[S_PARAMS].keyExists(fake2)); EXPECT_TRUE(obj[S_MSG_PARAMS].keyExists(fake3)); - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); // Check apply schema, remove fake parameter schema_item->applySchema(obj, true); @@ -310,7 +355,9 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) { EXPECT_TRUE(obj[S_MSG_PARAMS].keyExists(Keys::RESULT_CODE)); EXPECT_TRUE(obj[S_MSG_PARAMS].keyExists(Keys::INFO)); EXPECT_TRUE(obj[S_MSG_PARAMS].keyExists(Keys::SUCCESS)); - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); obj[fake1] = SmartObject(static_cast<int64_t>(0)); obj[S_PARAMS][fake2] = SmartObject("123"); @@ -324,7 +371,9 @@ TEST_F(ObjectSchemaItemTest, validation_unexpected_param_remove) { EXPECT_FALSE(obj[S_PARAMS].keyExists(fake2)); EXPECT_FALSE(obj[S_MSG_PARAMS].keyExists(fake3)); // Invalide state after enum convertion - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); } TEST_F(ObjectSchemaItemTest, validation_empty_params) { @@ -338,14 +387,20 @@ TEST_F(ObjectSchemaItemTest, validation_empty_params) { obj[S_MSG_PARAMS]["FAKE_PARAM2"] = SmartObject(0x1); obj[S_MSG_PARAMS]["FAKE_PARAM3"] = SmartObject("2"); - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + rpc::ValidationReport report("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); schema_item->applySchema(obj, false); - EXPECT_EQ(Errors::OK, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(obj, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); schema_item->unapplySchema(obj); // Invalide state after enum convertion - EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::INVALID_VALUE, schema_item->validate(obj, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); } TEST_F(ObjectSchemaItemTest, test_strings_to_enum_conversion) { @@ -380,10 +435,14 @@ TEST_F(ObjectSchemaItemTest, test_strings_to_enum_conversion) { object[S_MSG_PARAMS][Keys::RESULT_CODE] = result_type_str; // S_FUNCTION_ID and RESULT_CODE are not converted to int - EXPECT_NE(Errors::OK, schema_item->validate(object)); + rpc::ValidationReport report("RPC"); + EXPECT_NE(Errors::OK, schema_item->validate(object, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); schema_item->applySchema(object, false); - EXPECT_EQ(Errors::OK, schema_item->validate(object)); + report = rpc::ValidationReport("RPC"); + EXPECT_EQ(Errors::OK, schema_item->validate(object, &report)); + EXPECT_EQ(std::string(""), rpc::PrettyFormat(report)); // check conversion result EXPECT_EQ(function_type, object[S_PARAMS][S_FUNCTION_ID].asInt()); @@ -391,7 +450,9 @@ TEST_F(ObjectSchemaItemTest, test_strings_to_enum_conversion) { schema_item->unapplySchema(object); // S_FUNCTION_ID and RESULT_CODE are string - EXPECT_NE(Errors::OK, schema_item->validate(object)); + report = rpc::ValidationReport("RPC"); + EXPECT_NE(Errors::OK, schema_item->validate(object, &report)); + EXPECT_NE(std::string(""), rpc::PrettyFormat(report)); // check conversion result EXPECT_EQ(function_str, object[S_PARAMS][S_FUNCTION_ID].asString()); diff --git a/src/components/smart_objects/test/EnumSchemaItem_test.cc b/src/components/smart_objects/test/EnumSchemaItem_test.cc index e5ac013f86..9914167e5a 100644 --- a/src/components/smart_objects/test/EnumSchemaItem_test.cc +++ b/src/components/smart_objects/test/EnumSchemaItem_test.cc @@ -92,7 +92,8 @@ TEST_F(EnumSchemaItemTest, test_item_with_default_value) { // Object - valid enum obj = TestType::BLUETOOTH_OFF; - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); @@ -101,7 +102,7 @@ TEST_F(EnumSchemaItemTest, test_item_with_default_value) { // Obj - bool obj = true; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); @@ -110,7 +111,7 @@ TEST_F(EnumSchemaItemTest, test_item_with_default_value) { // Object - number obj = 3.1415926; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); @@ -119,7 +120,7 @@ TEST_F(EnumSchemaItemTest, test_item_with_default_value) { // Object - string obj = "Some string"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); @@ -142,7 +143,8 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) { // Object - valid enum obj = TestType::BLUETOOTH_OFF; - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); bool resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); @@ -151,7 +153,7 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) { // Obj - bool obj = true; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); @@ -160,7 +162,7 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) { // Object - number obj = 3.1415926; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); @@ -169,7 +171,7 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) { // Object - string obj = "Some string"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); @@ -178,12 +180,12 @@ TEST_F(EnumSchemaItemTest, test_item_without_default_value) { // Object - int in range of enum obj = 6; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object - int out of enum range obj = 15; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); } @@ -199,31 +201,32 @@ TEST_F(EnumSchemaItemTest, test_apply_unapply_schema) { // Object - valid enum obj = TestType::BLUETOOTH_OFF; - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); EXPECT_EQ(TestType::FACTORY_DEFAULTS, obj.asInt()); item->unapplySchema(obj); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); EXPECT_EQ(std::string("FACTORY_DEFAULTS"), obj.asString()); item->applySchema(obj, false); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(TestType::FACTORY_DEFAULTS, obj.asInt()); obj = "TOO_MANY_REQUESTS"; item->applySchema(obj, false); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(TestType::TOO_MANY_REQUESTS, obj.asInt()); obj = "ENOUGH_REQUESTS"; item->applySchema(obj, false); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); EXPECT_EQ(std::string("ENOUGH_REQUESTS"), obj.asString()); } diff --git a/src/components/smart_objects/test/NumberSchemaItem_test.cc b/src/components/smart_objects/test/NumberSchemaItem_test.cc index c9e183ca4a..0315bcedb3 100644 --- a/src/components/smart_objects/test/NumberSchemaItem_test.cc +++ b/src/components/smart_objects/test/NumberSchemaItem_test.cc @@ -61,20 +61,21 @@ TEST(test_int_no_default_value, test_NumberSchemaItemTest) { obj = 5; ASSERT_EQ(5, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Obj bool obj = true; ASSERT_TRUE(obj.asBool()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); // Set default value bool resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); EXPECT_TRUE(obj.asBool()); @@ -82,11 +83,11 @@ TEST(test_int_no_default_value, test_NumberSchemaItemTest) { obj = "Test"; ASSERT_EQ(std::string("Test"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); } @@ -105,21 +106,22 @@ TEST(test_int_min_value, test_NumberSchemaItemTest) { obj = 15; ASSERT_EQ(15, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object int incorrect obj = 9; ASSERT_EQ(9, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object int correct obj = 10; ASSERT_EQ(10, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); } @@ -139,21 +141,22 @@ TEST(test_int_max_value, test_NumberSchemaItemTest) { obj = 749; ASSERT_EQ(749, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object int incorrect obj = 750; ASSERT_EQ(750, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object int correct obj = -750; ASSERT_EQ(-750, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); } @@ -173,28 +176,29 @@ TEST(test_int_min_max_value, test_NumberSchemaItemTest) { obj = 749; ASSERT_EQ(749, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object int incorrect obj = 750; ASSERT_EQ(750, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object int correct obj = -949; ASSERT_EQ(-949, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object int incorrect obj = -950; ASSERT_EQ(-950, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); } @@ -215,44 +219,45 @@ TEST(test_int_correct_default_value, test_NumberSchemaItemTest) { obj = -12000; ASSERT_EQ(-12000, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object int incorrect obj = -12001; ASSERT_EQ(-12001, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object int correct obj = 100; ASSERT_EQ(100, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object int incorrect obj = 101; ASSERT_EQ(101, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Set default value bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(-38, obj.asInt()); // Object string obj = "string"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(-38, obj.asInt()); } @@ -274,44 +279,45 @@ TEST(test_int_default_value_out_of_range, test_NumberSchemaItemTest) { obj = 90; ASSERT_EQ(90, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object int incorrect obj = 89; ASSERT_EQ(89, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object int correct obj = 100; ASSERT_EQ(100, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object int incorrect obj = 101; ASSERT_EQ(101, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Set default value bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); EXPECT_EQ(50, obj.asInt()); // Object string obj = "string"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); EXPECT_EQ(50, obj.asInt()); } @@ -331,15 +337,16 @@ TEST(test_int_map_validate, test_NumberSchemaItemTest) { obj["max"] = 100; obj["out_of_max"] = 101; - int resultType = item->validate(obj["min"]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj["min"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["max"]); + resultType = item->validate(obj["max"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["out_of_min"]); + resultType = item->validate(obj["out_of_min"], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj["out_of_max"]); + resultType = item->validate(obj["out_of_max"], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); // Set default value @@ -351,13 +358,13 @@ TEST(test_int_map_validate, test_NumberSchemaItemTest) { EXPECT_TRUE(resDefault); EXPECT_EQ(-38, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["min"]); + resultType = item->validate(obj["min"], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); } @@ -376,21 +383,22 @@ TEST(test_int_array_validate, test_NumberSchemaItemTest) { obj[2] = 100; obj[3] = 101; - int resultType = item->validate(obj[0]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj[0], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj[2]); + resultType = item->validate(obj[2], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj[3]); + resultType = item->validate(obj[3], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); @@ -402,14 +410,14 @@ TEST(test_int_array_validate, test_NumberSchemaItemTest) { EXPECT_TRUE(resDefault); EXPECT_EQ(-38, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); } @@ -433,20 +441,21 @@ TEST(test_double_no_default_value, test_NumberSchemaItemTest) { obj = 5.79; ASSERT_EQ(5.79, obj.asDouble()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Obj bool obj = true; ASSERT_TRUE(obj.asBool()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); // Set default value bool resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); EXPECT_TRUE(obj.asBool()); @@ -454,13 +463,13 @@ TEST(test_double_no_default_value, test_NumberSchemaItemTest) { obj = "Test"; ASSERT_EQ(std::string("Test"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); // Set default value resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); } @@ -479,21 +488,22 @@ TEST(test_double_min_value, test_NumberSchemaItemTest) { obj = 10.000001; ASSERT_EQ(10.000001, obj.asDouble()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object double incorrect obj = 9.999999; ASSERT_EQ(9.999999, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); /* //Object int obj = 10; ASSERT_EQ(10, obj.asInt()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType);*/ } @@ -513,21 +523,22 @@ TEST(test_double_max_value, test_NumberSchemaItemTest) { obj = 749.0; ASSERT_EQ(749.0, obj.asDouble()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object double incorrect obj = 749.0001; ASSERT_EQ(749.0001, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object double correct obj = -750.0; ASSERT_EQ(-750.0, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); } @@ -547,28 +558,29 @@ TEST(test_double_min_max_value, test_NumberSchemaItemTest) { obj = 749.0; ASSERT_EQ(749.0, obj.asDouble()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object double incorrect obj = 749.001; ASSERT_EQ(749.001, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object double correct obj = -949.0; ASSERT_EQ(-949.0, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object double incorrect obj = -949.00001; ASSERT_EQ(-949.00001, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); } @@ -589,44 +601,45 @@ TEST(test_double_correct_default_value, test_NumberSchemaItemTest) { obj = -12000.0; ASSERT_EQ(-12000.0, obj.asDouble()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object double incorrect obj = -12000.01; ASSERT_EQ(-12000.01, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object double correct obj = 100.0; ASSERT_EQ(100.0, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object double incorrect obj = 100.001; ASSERT_EQ(100.001, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Set default value bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(-38.0, obj.asDouble()); // Object string obj = "string"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(-38.0, obj.asDouble()); } @@ -648,44 +661,45 @@ TEST(test_double_default_value_out_of_range, test_NumberSchemaItemTest) { obj = 90.0; ASSERT_EQ(90.0, obj.asDouble()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object double incorrect obj = 89.999; ASSERT_EQ(89.999, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Object double correct obj = 100.0; ASSERT_EQ(100.0, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); // Object double incorrect obj = 100.001; ASSERT_EQ(100.001, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); // Set default value bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); EXPECT_EQ(50.0, obj.asDouble()); // Object string obj = "string"; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); EXPECT_EQ(50.0, obj.asDouble()); } @@ -705,15 +719,16 @@ TEST(test_double_map_validate, test_NumberSchemaItemTest) { obj["max"] = 100.0; obj["out_of_max"] = 100.001; - int resultType = item->validate(obj["min"]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj["min"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["max"]); + resultType = item->validate(obj["max"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["out_of_min"]); + resultType = item->validate(obj["out_of_min"], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj["out_of_max"]); + resultType = item->validate(obj["out_of_max"], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); bool resDefault = item->setDefaultValue(obj["aa"]); @@ -724,13 +739,13 @@ TEST(test_double_map_validate, test_NumberSchemaItemTest) { EXPECT_TRUE(resDefault); EXPECT_EQ(-38.0, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["min"]); + resultType = item->validate(obj["min"], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); } @@ -749,21 +764,22 @@ TEST(test_double_array_validate, test_NumberSchemaItemTest) { obj[2] = 100.0; obj[3] = 100.000001; - int resultType = item->validate(obj[0]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj[0], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj[2]); + resultType = item->validate(obj[2], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj[3]); + resultType = item->validate(obj[3], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); @@ -775,14 +791,14 @@ TEST(test_double_array_validate, test_NumberSchemaItemTest) { EXPECT_TRUE(resDefault); EXPECT_EQ(-38.0, obj.asDouble()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::OK, resultType); - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(NsSmartDeviceLink::NsSmartObjects::Errors::INVALID_VALUE, resultType); } @@ -799,7 +815,8 @@ TEST(test_int_double_value, test_NumberSchemaItemTest) { obj = value; ASSERT_EQ(value, obj.asDouble()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); } @@ -815,7 +832,8 @@ TEST(test_double_int_value, test_NumberSchemaItemTest) { obj = value; ASSERT_EQ(value, obj.asInt()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); } diff --git a/src/components/smart_objects/test/StringSchemaItem_test.cc b/src/components/smart_objects/test/StringSchemaItem_test.cc index d19d8518fe..4e4688d354 100644 --- a/src/components/smart_objects/test/StringSchemaItem_test.cc +++ b/src/components/smart_objects/test/StringSchemaItem_test.cc @@ -59,7 +59,8 @@ TEST(test_no_default_value, test_StringSchemaItemTest) { obj = "New valid string"; ASSERT_EQ(std::string("New valid string"), obj.asString()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); bool resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); @@ -68,7 +69,7 @@ TEST(test_no_default_value, test_StringSchemaItemTest) { // Obj - bool obj = true; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); @@ -77,12 +78,12 @@ TEST(test_no_default_value, test_StringSchemaItemTest) { // Object - number obj = 3.1415926; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_FALSE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); EXPECT_EQ(3.1415926, obj.asDouble()); } @@ -110,7 +111,8 @@ TEST(test_item_with_default_value, test_StringSchemaItemTest) { obj = "New valid string"; ASSERT_EQ(std::string("New valid string"), obj.asString()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); @@ -119,7 +121,7 @@ TEST(test_item_with_default_value, test_StringSchemaItemTest) { // Obj - bool obj = true; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); @@ -128,12 +130,12 @@ TEST(test_item_with_default_value, test_StringSchemaItemTest) { // Object - number obj = 3.1415926; - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); EXPECT_EQ(std::string("Default string"), obj.asString()); } @@ -154,7 +156,8 @@ TEST(test_item_with_max_length, test_StringSchemaItemTest) { obj = "New valid string"; ASSERT_EQ(std::string("New valid string"), obj.asString()); - int resultType = item->validate(obj); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); bool resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); @@ -164,13 +167,13 @@ TEST(test_item_with_max_length, test_StringSchemaItemTest) { obj = "New very very loooooong string"; ASSERT_EQ(std::string("New very very loooooong string"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); EXPECT_EQ(std::string("Default string"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); } @@ -188,19 +191,20 @@ TEST(test_map_validate, test_StringSchemaItemTest) { obj["bool"] = true; obj["num"] = 3.14; - int resultType = item->validate(obj["str"]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj["str"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["long"]); + resultType = item->validate(obj["long"], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj["bool"]); + resultType = item->validate(obj["bool"], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj["num"]); + resultType = item->validate(obj["num"], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); bool resDefault = item->setDefaultValue(obj["str"]); @@ -215,23 +219,23 @@ TEST(test_map_validate, test_StringSchemaItemTest) { EXPECT_TRUE(resDefault); EXPECT_EQ(std::string("Default string"), obj["num"].asString()); - resultType = item->validate(obj["str"]); + resultType = item->validate(obj["str"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["long"]); + resultType = item->validate(obj["long"], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj["bool"]); + resultType = item->validate(obj["bool"], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj["num"]); + resultType = item->validate(obj["num"], &report); EXPECT_EQ(Errors::OK, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); EXPECT_EQ(std::string("Default string"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); } @@ -250,22 +254,23 @@ TEST(test_array_validate, test_StringSchemaItemTest) { obj[3] = 3.14; obj[4] = "New valid string"; - int resultType = item->validate(obj[0]); + rpc::ValidationReport report("RPC"); + int resultType = item->validate(obj[0], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj[2]); + resultType = item->validate(obj[2], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[3]); + resultType = item->validate(obj[3], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[4]); + resultType = item->validate(obj[4], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); bool resDefault = item->setDefaultValue(obj[0]); @@ -284,24 +289,24 @@ TEST(test_array_validate, test_StringSchemaItemTest) { EXPECT_EQ(std::string("Default string"), obj[4].asString()); EXPECT_EQ(std::string("Default string"), obj[5].asString()); - resultType = item->validate(obj[0]); + resultType = item->validate(obj[0], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[1]); + resultType = item->validate(obj[1], &report); EXPECT_EQ(Errors::OUT_OF_RANGE, resultType); - resultType = item->validate(obj[2]); + resultType = item->validate(obj[2], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[3]); + resultType = item->validate(obj[3], &report); EXPECT_EQ(Errors::INVALID_VALUE, resultType); - resultType = item->validate(obj[4]); + resultType = item->validate(obj[4], &report); EXPECT_EQ(Errors::OK, resultType); - resultType = item->validate(obj[5]); + resultType = item->validate(obj[5], &report); EXPECT_EQ(Errors::OK, resultType); resDefault = item->setDefaultValue(obj); EXPECT_TRUE(resDefault); EXPECT_EQ(std::string("Default string"), obj.asString()); - resultType = item->validate(obj); + resultType = item->validate(obj, &report); EXPECT_EQ(Errors::OK, resultType); } diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h index 80338804ee..618901ffa8 100644 --- a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h +++ b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h @@ -35,7 +35,6 @@ #include <string> -#include "utils/shared_ptr.h" #include "utils/message_queue.h" #include "utils/threads/thread.h" #include "utils/threads/thread_delegate.h" @@ -47,6 +46,11 @@ #include "protocol_handler_observer.h" #include "protocol_handler/protocol_handler_impl.h" +namespace utils { +template <typename T> +class SharedPtr; +} + namespace telemetry_monitor { using ::utils::MessageQueue; @@ -88,7 +92,8 @@ class TelemetryMonitor { virtual void Stop(); virtual void Start(); virtual void SendMetric(utils::SharedPtr<MetricWrapper> metric); - void set_streamer(Streamer* streamer); + DEPRECATED void set_streamer(Streamer* streamer); + void set_streamer(utils::SharedPtr<Streamer> streamer); const std::string& ip() const; int16_t port() const; @@ -96,7 +101,7 @@ class TelemetryMonitor { std::string server_address_; int16_t port_; threads::Thread* thread_; - Streamer* streamer_; + utils::SharedPtr<Streamer> streamer_; ApplicationManagerObserver app_observer; TransportManagerObserver tm_observer; ProtocolHandlerObserver ph_observer; diff --git a/src/components/telemetry_monitor/src/telemetry_monitor.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc index 88c484ffd4..53a5a2dc70 100644 --- a/src/components/telemetry_monitor/src/telemetry_monitor.cc +++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc @@ -42,6 +42,8 @@ #include "transport_manager/transport_manager_default.h" #include "utils/resource_usage.h" +#include "utils/make_shared.h" +#include "utils/shared_ptr.h" #include "telemetry_monitor/telemetry_observable.h" namespace telemetry_monitor { @@ -53,24 +55,22 @@ TelemetryMonitor::TelemetryMonitor(const std::string& server_address, : server_address_(server_address) , port_(port) , thread_(NULL) - , streamer_(NULL) , app_observer(this) , tm_observer(this) , ph_observer(this) {} void TelemetryMonitor::Start() { - streamer_ = streamer_ ? streamer_ : new Streamer(this); - thread_ = threads::CreateThread("TelemetryMonitor", streamer_); + streamer_ = streamer_ ? streamer_ : utils::MakeShared<Streamer>(this); + thread_ = threads::CreateThread("TelemetryMonitor", streamer_.get()); } -void TelemetryMonitor::set_streamer(Streamer* streamer) { +void TelemetryMonitor::set_streamer(Streamer* streamer) {} + +void TelemetryMonitor::set_streamer(utils::SharedPtr<Streamer> streamer) { LOG4CXX_AUTO_TRACE(logger_); if (thread_ && !thread_->is_running()) { - thread_->set_delegate(streamer); - if (streamer_) { - delete streamer_; - } streamer_ = streamer; + thread_->set_delegate(streamer_.get()); } else { LOG4CXX_ERROR(logger_, "Unable to replace streamer if it is active"); } @@ -86,7 +86,6 @@ int16_t TelemetryMonitor::port() const { TelemetryMonitor::~TelemetryMonitor() { Stop(); - delete streamer_; } void TelemetryMonitor::Init( @@ -117,7 +116,7 @@ void TelemetryMonitor::Stop() { } void TelemetryMonitor::SendMetric(utils::SharedPtr<MetricWrapper> metric) { - if ((NULL != streamer_) && streamer_->is_client_connected_) { + if (streamer_ && streamer_->is_client_connected_) { streamer_->PushMessage(metric); } } diff --git a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc index 090c7ab5b7..5235f0a469 100644 --- a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc +++ b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc @@ -40,6 +40,8 @@ #include "connection_handler/mock_connection_handler.h" #include "transport_manager/mock_transport_manager.h" #include "telemetry_monitor/mock_telemetry_observable.h" +#include "utils/shared_ptr.h" +#include "utils/make_shared.h" using testing::Return; using testing::_; @@ -90,7 +92,8 @@ TEST(TelemetryMonitorTest, MessageProcess) { EXPECT_CALL(am_observeble, SetTelemetryObserver(_)); EXPECT_CALL(transport_manager_mock, SetTelemetryObserver(_)); telemetry_monitor::TelemetryMonitor telemetry_monitor(server_address, port); - StreamerMock* streamer_mock = new StreamerMock(&telemetry_monitor); + utils::SharedPtr<StreamerMock> streamer_mock = + utils::MakeShared<StreamerMock>(&telemetry_monitor); // streamer_mock will be freed by telemetry_monitor on destruction telemetry_monitor.Start(); telemetry_monitor.set_streamer(streamer_mock); diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt index e738bbaeb7..4fa224393d 100644 --- a/src/components/transport_manager/CMakeLists.txt +++ b/src/components/transport_manager/CMakeLists.txt @@ -89,6 +89,13 @@ else() ) endif() +if(NOT BUILD_TESTS) + list (APPEND EXCLUDE_PATH + ${CMAKE_CURRENT_SOURCE_DIR}/include/iap2_emulation/iap2_transport_adapter.h + ${CMAKE_CURRENT_SOURCE_DIR}/src/iap2_emulation/iap2_transport_adapter.cc + ) +endif() + collect_sources(SOURCES "${PATHS}" "${EXCLUDE_PATHS}") add_library("TransportManager" ${SOURCES}) diff --git a/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h b/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h new file mode 100644 index 0000000000..36a2b374dd --- /dev/null +++ b/src/components/transport_manager/include/transport_manager/iap2_emulation/iap2_transport_adapter.h @@ -0,0 +1,165 @@ +/* + * 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_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_IAP2_EMULATION_IAP2_TRANSPORT_ADAPTER_H_ +#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_IAP2_EMULATION_IAP2_TRANSPORT_ADAPTER_H_ + +#include "transport_manager/tcp/tcp_transport_adapter.h" +#include "transport_manager/transport_manager_settings.h" +#include "resumption/last_state.h" +#include "utils/macro.h" +#include "utils/threads/thread_delegate.h" + +namespace threads { +class Thread; +} + +namespace transport_manager { +namespace transport_adapter { + +/** + * @brief The IAP2BluetoothEmulationTransportAdapter class implements iAP2 + * Bluetooth transport over TCP + */ +class IAP2BluetoothEmulationTransportAdapter : public TcpTransportAdapter { + public: + /** + * @brief IAP2BluetoothEmulationTransportAdapter constructor + * @param port TCP port to listen on + * @param last_state LastState instance reference + * @param settings Settings reference + */ + IAP2BluetoothEmulationTransportAdapter( + const uint16_t port, + resumption::LastState& last_state, + const TransportManagerSettings& settings); + + /** + * @brief DeviceSwitched is called during switching from iAP2 Bluetooth to + * iAP2 USB transport. + * Currently there is no logic to switch back from iAP2 USB to iAP2 Bluetooth + * due to Bluetooth reconnection takes much time and this violates some Apple + * restrictions for iAP2 protocol, so if this method will be called - assert + * will be called + * @param device_handle Device handle of switched device + */ + void DeviceSwitched(const DeviceUID& device_handle) OVERRIDE; + + protected: + /** + * @brief GetDeviceType Provides SDL device type for transport adapter + * @return Device type + */ + DeviceType GetDeviceType() const OVERRIDE; +}; + +/** + * @brief The IAP2USBEmulationTransportAdapter class implements emulation of + * iAP2 USB transport over TCP + */ +class IAP2USBEmulationTransportAdapter : public TcpTransportAdapter { + public: + /** + * @brief IAP2USBEmulationTransportAdapter constructor + * @param port TCP port to listen on + * @param last_state LastState instance reference + * @param settings Settings reference + */ + IAP2USBEmulationTransportAdapter(const uint16_t port, + resumption::LastState& last_state, + const TransportManagerSettings& settings); + + /** + * Destructor + */ + ~IAP2USBEmulationTransportAdapter(); + + /** + * @brief DeviceSwitched is called during switching from iAP2 Bluetooth to + * iAP2 USB transport. Sends ACK signal for switching request. + * @param device_handle Device handle of switched device + */ + void DeviceSwitched(const DeviceUID& device_handle) OVERRIDE; + + protected: + /** + * @brief GetDeviceType Provides SDL device type for transport adapter + * @return Device type + */ + DeviceType GetDeviceType() const OVERRIDE; + + private: + /** + * @brief The IAPSignalHandlerDelegate class handles signals from the system + * to start transport switching flow + */ + class IAPSignalHandlerDelegate : public threads::ThreadDelegate { + public: + /** + * @brief IAPSignalHandlerDelegate Constructor + * @param adapter Pointer to iAP2 USB adapter + */ + IAPSignalHandlerDelegate(IAP2USBEmulationTransportAdapter& adapter); + + /** + * @brief threadMain Main loop to track incoming signals + */ + void threadMain() OVERRIDE; + + /** + * @brief exitThreadMain Stops main loop + */ + void exitThreadMain() OVERRIDE; + + private: + /** + * @brief adapter_ Reference to owning adapter + */ + IAP2USBEmulationTransportAdapter& adapter_; + + /** + * @brief run_flag_ Flag defines whether main loop is active + */ + bool run_flag_; + + /** + * @brief in_ Input signals channel descriptor + */ + int in_; + }; + + threads::Thread* signal_handler_; + int out_; +}; +} // namespace transport_adapter +} // namespace transport_manager +#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_IAP2_EMULATION_IAP2_TRANSPORT_ADAPTER_H_ diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h index 981ba9f6ee..7aa0b72687 100644 --- a/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h +++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h @@ -66,6 +66,18 @@ class TcpDevice : public Device { **/ TcpDevice(const in_addr_t& in_addr, const std::string& name); +#if defined(BUILD_TESTS) + /** + * @brief TcpDevice + * @param in_addr IP address of device + * @param device_uid Unique device id + * @param transport_switch_id Id used for transport switching + */ + TcpDevice(const in_addr_t& in_addr, + const std::string& device_uid, + const std::string& transport_switch_id); +#endif + virtual ~TcpDevice(); /** diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h index d4c97d5233..2b1ada79ad 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h @@ -400,6 +400,26 @@ class TransportAdapterImpl : public TransportAdapter, const DataSendError& error) OVERRIDE; /** + * @brief DoTransportSwitch notifies listeners of transport adapter events + * that transport switching is requested by system + */ + void DoTransportSwitch() const OVERRIDE; + + /** + * @brief DeviceSwitched Notifies system on successful transport switch for + * particular device + * @param device_handle Device handle of switched device + */ + void DeviceSwitched(const DeviceUID& device_handle) OVERRIDE; + + /** + * @brief GetSwitchableDevices Provides list of devices able to switch their + * transport (e.g. iAP2 Bluetooth to iAP2 USB). + * @return + */ + SwitchableDevices GetSwitchableDevices() const OVERRIDE; + + /** * @brief Return name of device. * * @param device_id Device unique identifier. @@ -409,6 +429,13 @@ class TransportAdapterImpl : public TransportAdapter, std::string DeviceName(const DeviceUID& device_id) const OVERRIDE; /** + * @brief StopDevice looks for specific device in devices list and calls + * Stop() interface of that device + * @param device_id unique device identifier that has to be stopped. + */ + void StopDevice(const DeviceUID& device_id) const OVERRIDE; + + /** * @brief Allows to obtain connection type used by device. * @return connection type. */ diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h index 0a1eeb6b4a..424fa53dea 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener.h @@ -146,6 +146,7 @@ class TransportAdapterListener { const DeviceUID& device_handle, const ApplicationHandle& app_handle, const CommunicationError& error) = 0; + /** * @brief Search specified device adapter in the container of shared pointers *to device adapters to be sure it is available, @@ -269,6 +270,13 @@ class TransportAdapterListener { virtual void OnCommunicationError(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle) = 0; + /** + * @brief OnTransportSwitchRequested notifies on received signal to start + * transport switching flow (at the moment Bluetooth to USB only) + * @param transport_adapter Transport adapter who received the signal + */ + virtual void OnTransportSwitchRequested( + const TransportAdapter* transport_adapter) = 0; }; } // transport_adapter namespace diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h index a7cd544563..8a8031c3cf 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h @@ -49,26 +49,6 @@ class TransportAdapterListenerImpl : public transport_adapter::TransportAdapterListener { public: /** - * @enum Available types of events. - */ - enum 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 - }; - - /** * @brief Constructor. * * @param manager Pointer to the transport manager class. @@ -283,7 +263,14 @@ class TransportAdapterListenerImpl */ virtual void OnCommunicationError(const TransportAdapter* adapter, const DeviceUID& device, - const ApplicationHandle& app_id); + const ApplicationHandle& app_id) OVERRIDE; + + /** + * @brief OnTransportSwitchRequested notifies on received signal to start + * transport switching flow (at the moment Bluetooth to USB only) + * @param transport_adapter Transport adapter who received the signal + */ + void OnTransportSwitchRequested(const TransportAdapter* adapter) OVERRIDE; private: TransportManager* transport_manager_; diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h index 4dd74086be..eaa71ce3bb 100644 --- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h @@ -39,6 +39,8 @@ #include <vector> #include <utility> #include <algorithm> +#include <tuple> +#include <functional> #include "utils/timer.h" #include "utils/timer_task_impl.h" @@ -63,6 +65,7 @@ typedef threads::MessageLoopThread<std::queue<protocol_handler::RawMessagePtr> > typedef threads::MessageLoopThread<std::queue<TransportAdapterEvent> > TransportAdapterEventLoopThread; typedef utils::SharedPtr<timer::Timer> TimerSPtr; +typedef std::map<DeviceUID, TransportAdapter*> DeviceToAdapterMap; /** * @brief Implementation of transport manager.s @@ -94,6 +97,7 @@ class TransportManagerImpl bool shutdown_; DeviceHandle device_handle_; int messages_count; + bool active_; ConnectionInternal(TransportManagerImpl* transport_manager, TransportAdapter* transport_adapter, @@ -241,11 +245,20 @@ class TransportManagerImpl int Visibility(const bool& on_off) const OVERRIDE; /** + * DEPRECATED + * Must be moved under 'private' section * @brief Updates total device list with info from specific transport adapter. * @param ta Transport adapter */ void UpdateDeviceList(TransportAdapter* ta); + /** + * @brief OnDeviceListUpdated updates device list and sends appropriate + * notifications to listeners in case of something is changed + * @param ta Transport adapter to check for updated devices state + */ + void OnDeviceListUpdated(TransportAdapter* ta); + #ifdef TELEMETRY_MONITOR /** * @brief Setup observer for time metric. @@ -307,44 +320,53 @@ class TransportManagerImpl private: /** - * @brief Structure that contains conversion functions (Device ID -> Device - * Handle; Device Handle -> Device ID) - */ + * @brief Structure that contains conversion functions (Device ID -> Device + * Handle; Device Handle -> Device ID) + */ struct Handle2GUIDConverter { - typedef std::vector<DeviceUID> ConversionTable; - - DeviceHandle UidToHandle(const DeviceUID& dev_uid) { - bool is_new = true; - return UidToHandle(dev_uid, is_new); - } - - DeviceHandle UidToHandle(const DeviceUID& dev_uid, bool& is_new) { - { - sync_primitives::AutoReadLock lock(conversion_table_lock); - ConversionTable::iterator it = std::find( - conversion_table_.begin(), conversion_table_.end(), dev_uid); - if (it != conversion_table_.end()) { - is_new = false; - return std::distance(conversion_table_.begin(), it) + - 1; // handle begin since 1 (one) - } + /** + * @brief ConversionTable Records uid/connection type/handle + */ + typedef std::vector<std::tuple<DeviceUID, std::string, DeviceHandle> > + ConversionTable; + + /** + * @brief The HandleFinder struct helper to search for hanlde in coversion + * table + */ + struct HandleFinder { + explicit HandleFinder(const DeviceHandle& look_for) + : look_for_(look_for) {} + + bool operator()(const ConversionTable::value_type value) const { + return look_for_ == std::get<2>(value); } - is_new = true; - sync_primitives::AutoWriteLock lock(conversion_table_lock); - conversion_table_.push_back(dev_uid); - return conversion_table_.size(); // handle begin since 1 (one) - } - - DeviceUID HandleToUid(const DeviceHandle handle) { - sync_primitives::AutoReadLock lock(conversion_table_lock); - if (handle == 0 || handle > conversion_table_.size()) { - return DeviceUID(); - } - return conversion_table_[handle - 1]; // handle begin since 1 (one) - } + const DeviceHandle look_for_; + }; + + /** + * @brief UidToHandle Converts UID to handle considering connection type as + * UID may be the same in case device is connected over Bluetooth/USB (e.g. + * for IAP2) + * @param dev_uid Device UID + * @param connection_type Connection type + * @return Device handle + */ + DeviceHandle UidToHandle(const DeviceUID& dev_uid, + const std::string& connection_type); + + /** + * @brief HandleToUid Converts handle to device UID + * @param handle Device handle + * @return Device UID + */ + DeviceUID HandleToUid(const DeviceHandle handle); + + private: ConversionTable conversion_table_; - sync_primitives::RWLock conversion_table_lock; + std::hash<std::string> hash_function_; + sync_primitives::RWLock conversion_table_lock_; }; /** @@ -353,6 +375,15 @@ class TransportManagerImpl */ Handle2GUIDConverter converter_; +#ifdef BUILD_TESTS + public: + Handle2GUIDConverter& get_converter() { + return converter_; + } + + private: +#endif // BUILD_TESTS + explicit TransportManagerImpl(const TransportManagerImpl&); int connection_id_counter_; sync_primitives::RWLock connections_lock_; @@ -372,13 +403,70 @@ class TransportManagerImpl sync_primitives::RWLock device_list_lock_; DeviceInfoList device_list_; + timer::Timer device_switch_timer_; + sync_primitives::Lock device_lock_; + DeviceUID device_to_reconnect_; + + /** + * @brief Adds new incoming connection to connections list + * @param c New connection + */ void AddConnection(const ConnectionInternal& c); + + /** + * @brief Removes connection from connections list + * @param id Identifier of connection to be removed + * @param transport_adapter Pointer to transport adapter + * that holds connection + */ void RemoveConnection(const uint32_t id, transport_adapter::TransportAdapter* transport_adapter); + + /** + * @brief Deactivates all connections related to certain device + * @param device_uid Device unique identifier + */ + void DeactivateDeviceConnections(const DeviceUID& device_uid); + /** + * @brief Returns connection from connections list by connection identifier + * @param id Connection identifier + * @return Pointer to connection or NULL if connection could not be found + */ ConnectionInternal* GetConnection(const ConnectionUID id); + + /** + * @brief Returns connection from connections list by device unique id + * and application handle + * @param device Device unique identifier + * @param application Application handle + * @return Pointer to connection or NULL if connection could not be found + */ ConnectionInternal* GetConnection(const DeviceUID& device, const ApplicationHandle& application); + /** + * @brief Returns active connection from connections list by device unique + * id + * and application handle + * (this method returns only active connections as opposed to previous one) + * @param device Device unique identifier + * @param application Application handle + * @return Pointer to connection or NULL if connection could not be found + */ + ConnectionInternal* GetActiveConnection(const DeviceUID& device, + const ApplicationHandle& application); + + /** + * @brief TryDeviceSwitch in case USB device is connected and there is + * appropriate Bluetooth device with same UUID stops Bluetooth device and + * initiates switching sequence for upper layers. Also starts timer to wait + * for sequence to complete. + * @param ta Transport adapter having device to try switching sequence + * At the moment implementation implies only IAP2-Bluetooth to IAP2-USB + * switching + */ + void TryDeviceSwitch(TransportAdapter* ta); + void AddDataToContainer( ConnectionUID id, std::map<ConnectionUID, std::pair<unsigned int, unsigned char*> >& @@ -394,11 +482,25 @@ class TransportManagerImpl unsigned int frame_size, unsigned char** frame); - void OnDeviceListUpdated(TransportAdapter* ta); void DisconnectAllDevices(); void TerminateAllAdapters(); int InitAllAdapters(); static Connection convert(const ConnectionInternal& p); + + /** + * @brief ReconnectionTimeout notifies upper layers on switching sequence + * timeout expiration + */ + void ReconnectionTimeout(); + + /** + * @brief UpdateDeviceMapping handles internal device-to-adapter mapping, + * performs its update on adding/removal of devices. Also used by IAP2 + * switching flow to substitute BT with USB transport + * @param ta Pointer to transport adapter + * @return True if mapping has been updated, otherwise - false + */ + bool UpdateDeviceMapping(TransportAdapter* ta); }; // class TransportManagerImpl } // namespace transport_manager #endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_IMPL_H_ diff --git a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h index bad1cd7117..5f6bd40957 100644 --- a/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h +++ b/src/components/transport_manager/include/transport_manager/usb/libusb/usb_connection.h @@ -80,6 +80,7 @@ class UsbConnection : public Connection { uint8_t out_endpoint_; uint16_t out_endpoint_max_packet_size_; unsigned char* in_buffer_; + uint16_t in_buffer_size_; libusb_transfer* in_transfer_; libusb_transfer* out_transfer_; diff --git a/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc new file mode 100644 index 0000000000..741c075310 --- /dev/null +++ b/src/components/transport_manager/src/iap2_emulation/iap2_transport_adapter.cc @@ -0,0 +1,163 @@ +/* + * 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. + */ + +#include "transport_manager/iap2_emulation/iap2_transport_adapter.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdio.h> + +#include "utils/threads/thread.h" +#include "utils/file_system.h" + +namespace { +static const mode_t mode = 0666; +static const auto in_signals_channel = "iap_signals_in"; +static const auto out_signals_channel = "iap_signals_out"; +} // namespace + +namespace transport_manager { +namespace transport_adapter { + +CREATE_LOGGERPTR_GLOBAL(logger_, "IAP2Emulation"); + +IAP2BluetoothEmulationTransportAdapter::IAP2BluetoothEmulationTransportAdapter( + const uint16_t port, + resumption::LastState& last_state, + const TransportManagerSettings& settings) + : TcpTransportAdapter(port, last_state, settings) {} + +void IAP2BluetoothEmulationTransportAdapter::DeviceSwitched( + const DeviceUID& device_handle) { + LOG4CXX_AUTO_TRACE(logger_); + UNUSED(device_handle); + DCHECK(!"Switching for iAP2 Bluetooth is not supported."); +} + +DeviceType IAP2BluetoothEmulationTransportAdapter::GetDeviceType() const { + return IOS_BT; +} + +IAP2USBEmulationTransportAdapter::IAP2USBEmulationTransportAdapter( + const uint16_t port, + resumption::LastState& last_state, + const TransportManagerSettings& settings) + : TcpTransportAdapter(port, last_state, settings), out_(0) { + auto delegate = new IAPSignalHandlerDelegate(*this); + signal_handler_ = threads::CreateThread("iAP signal handler", delegate); + signal_handler_->start(); + const auto result = mkfifo(out_signals_channel, mode); + LOG4CXX_DEBUG(logger_, "Out signals channel creation result: " << result); +} + +IAP2USBEmulationTransportAdapter::~IAP2USBEmulationTransportAdapter() { + signal_handler_->join(); + auto delegate = signal_handler_->delegate(); + signal_handler_->set_delegate(NULL); + delete delegate; + threads::DeleteThread(signal_handler_); + LOG4CXX_DEBUG(logger_, "Out close result: " << close(out_)); + LOG4CXX_DEBUG(logger_, "Out unlink result: " << unlink(out_signals_channel)); +} + +void IAP2USBEmulationTransportAdapter::DeviceSwitched( + const DeviceUID& device_handle) { + LOG4CXX_AUTO_TRACE(logger_); + UNUSED(device_handle); + const auto switch_signal_ack = std::string("SDL_TRANSPORT_SWITCH_ACK\n"); + + auto out_ = open(out_signals_channel, O_WRONLY); + LOG4CXX_DEBUG(logger_, "Out channel descriptor: " << out_); + + const auto bytes = + write(out_, switch_signal_ack.c_str(), switch_signal_ack.size()); + UNUSED(bytes); + LOG4CXX_DEBUG(logger_, "Written bytes to out: " << bytes); + + LOG4CXX_DEBUG(logger_, "Switching signal ACK is sent"); + LOG4CXX_DEBUG(logger_, "iAP2 USB device is switched with iAP2 Bluetooth"); +} + +DeviceType IAP2USBEmulationTransportAdapter::GetDeviceType() const { + return IOS_USB; +} + +IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate:: + IAPSignalHandlerDelegate(IAP2USBEmulationTransportAdapter& adapter) + : adapter_(adapter), run_flag_(true), in_(0) { + const auto result = mkfifo(in_signals_channel, mode); + LOG4CXX_DEBUG(logger_, "In signals channel creation result: " << result); +} + +void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate::threadMain() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Signal handling is started"); + const auto switch_signal = "SDL_TRANSPORT_SWITCH"; + LOG4CXX_DEBUG(logger_, "Waiting for signal: " << switch_signal); + + in_ = open(in_signals_channel, O_RDONLY); + LOG4CXX_DEBUG(logger_, "In channel descriptor: " << in_); + + const auto size = 32; + while (run_flag_) { + char buffer[size]; + auto bytes = read(in_, &buffer, size); + if (0 == bytes) { + continue; + } + if (-1 == bytes) { + LOG4CXX_DEBUG(logger_, "Error during input pipe read"); + break; + } + LOG4CXX_DEBUG(logger_, "Read in bytes: " << bytes); + std::string str(buffer); + if (std::string::npos != str.find(switch_signal)) { + LOG4CXX_DEBUG(logger_, "Switch signal received."); + adapter_.DoTransportSwitch(); + } + } + + LOG4CXX_DEBUG(logger_, "In close result: " << close(in_)); + LOG4CXX_DEBUG(logger_, "In unlink result: " << unlink(in_signals_channel)); +} + +void IAP2USBEmulationTransportAdapter::IAPSignalHandlerDelegate:: + exitThreadMain() { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, "Stopping signal handling."); + run_flag_ = false; + ThreadDelegate::exitThreadMain(); +} +} +} // namespace transport_manager::transport_adapter diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc index 52a566c5ff..207149eb8c 100644 --- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc +++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc @@ -230,13 +230,23 @@ void TcpClientListener::Loop() { inet_ntoa(client_address.sin_addr), sizeof(device_name) / sizeof(device_name[0])); LOG4CXX_INFO(logger_, "Connected client " << device_name); + LOG4CXX_INFO(logger_, "Port is: " << port_); if (enable_keepalive_) { SetKeepaliveOptions(connection_fd); } + const auto device_uid = + device_name + std::string(":") + std::to_string(port_); + +#if defined(BUILD_TESTS) + TcpDevice* tcp_device = + new TcpDevice(client_address.sin_addr.s_addr, device_uid, device_name); +#else TcpDevice* tcp_device = - new TcpDevice(client_address.sin_addr.s_addr, device_name); + new TcpDevice(client_address.sin_addr.s_addr, device_uid); +#endif // BUILD_TESTS + DeviceSptr device = controller_->AddDevice(tcp_device); tcp_device = static_cast<TcpDevice*>(device.get()); const ApplicationHandle app_handle = diff --git a/src/components/transport_manager/src/tcp/tcp_device.cc b/src/components/transport_manager/src/tcp/tcp_device.cc index d3f132759a..dbcb5d38cb 100644 --- a/src/components/transport_manager/src/tcp/tcp_device.cc +++ b/src/components/transport_manager/src/tcp/tcp_device.cc @@ -46,6 +46,23 @@ TcpDevice::TcpDevice(const in_addr_t& in_addr, const std::string& name) LOG4CXX_AUTO_TRACE(logger_); } +#if defined(BUILD_TESTS) +TcpDevice::TcpDevice(const in_addr_t& in_addr, + const std::string& device_uid, + const std::string& transport_switch_id) + : Device(device_uid, device_uid, transport_switch_id) + , applications_mutex_() + , in_addr_(in_addr) + , last_handle_(0) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, + "Device created with transport switch emulation support."); + LOG4CXX_DEBUG(logger_, + "Device parameters: " << device_uid << " / " + << transport_switch_id); +} +#endif // BUILD_TESTS + bool TcpDevice::IsSameAs(const Device* other) const { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Device: " << other); diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc index 026e53670b..9fb0921c4b 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc @@ -45,13 +45,16 @@ namespace transport_adapter { CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") namespace { +// @deprecated DeviceTypes: PASA_AOA, PASA_BLUETOOTH, MME DeviceTypes devicesType = { - std::make_pair(AOA, std::string("USB_AOA")), - std::make_pair(PASA_AOA, std::string("USB_AOA")), - std::make_pair(MME, std::string("USB_IOS")), - std::make_pair(BLUETOOTH, std::string("BLUETOOTH")), - std::make_pair(PASA_BLUETOOTH, std::string("BLUETOOTH")), - std::make_pair(TCP, std::string("WIFI"))}; + std::make_pair(DeviceType::AOA, std::string("USB_AOA")), + std::make_pair(DeviceType::PASA_AOA, std::string("USB_AOA")), + std::make_pair(DeviceType::BLUETOOTH, std::string("BLUETOOTH")), + std::make_pair(DeviceType::PASA_BLUETOOTH, std::string("BLUETOOTH")), + std::make_pair(DeviceType::MME, std::string("USB_IOS")), + std::make_pair(DeviceType::IOS_BT, std::string("BLUETOOTH_IOS")), + std::make_pair(DeviceType::IOS_USB, std::string("USB_IOS")), + std::make_pair(DeviceType::TCP, std::string("WIFI"))}; } TransportAdapterImpl::TransportAdapterImpl( @@ -502,15 +505,13 @@ void TransportAdapterImpl::SearchDeviceFailed(const SearchDeviceError& error) { } bool TransportAdapterImpl::IsSearchDevicesSupported() const { - LOG4CXX_TRACE(logger_, "enter"); + LOG4CXX_AUTO_TRACE(logger_); return device_scanner_ != 0; - LOG4CXX_TRACE(logger_, "exit"); } bool TransportAdapterImpl::IsServerOriginatedConnectSupported() const { - LOG4CXX_TRACE(logger_, "enter"); + LOG4CXX_AUTO_TRACE(logger_); return server_connection_factory_ != 0; - LOG4CXX_TRACE(logger_, "exit"); } bool TransportAdapterImpl::IsClientOriginatedConnectSupported() const { @@ -694,6 +695,23 @@ void TransportAdapterImpl::DataSendFailed( LOG4CXX_TRACE(logger_, "exit"); } +void TransportAdapterImpl::DoTransportSwitch() const { + LOG4CXX_AUTO_TRACE(logger_); + std::for_each( + listeners_.begin(), + listeners_.end(), + std::bind2nd( + std::mem_fun(&TransportAdapterListener::OnTransportSwitchRequested), + this)); +} + +void TransportAdapterImpl::DeviceSwitched(const DeviceUID& device_handle) { + LOG4CXX_DEBUG(logger_, + "Switching is not implemented for that adapter type " + << GetConnectionType().c_str()); + UNUSED(device_handle); +} + DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const { LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id); DeviceSptr ret; @@ -864,10 +882,40 @@ std::string TransportAdapterImpl::DeviceName(const DeviceUID& device_id) const { } } +void TransportAdapterImpl::StopDevice(const DeviceUID& device_id) const { + LOG4CXX_AUTO_TRACE(logger_); + DeviceSptr device = FindDevice(device_id); + if (device) { + device->Stop(); + } +} + std::string TransportAdapterImpl::GetConnectionType() const { return devicesType[GetDeviceType()]; } +SwitchableDevices TransportAdapterImpl::GetSwitchableDevices() const { + LOG4CXX_AUTO_TRACE(logger_); + SwitchableDevices devices; + sync_primitives::AutoLock locker(devices_mutex_); + for (DeviceMap::const_iterator it = devices_.begin(); it != devices_.end(); + ++it) { + const auto device_uid = it->first; + const auto device = it->second; + const auto transport_switch_id = device->transport_switch_id(); + if (transport_switch_id.empty()) { + LOG4CXX_DEBUG(logger_, + "Device is not suitable for switching: " << device_uid); + continue; + } + LOG4CXX_DEBUG(logger_, "Device is suitable for switching: " << device_uid); + devices.insert(std::make_pair(device_uid, transport_switch_id)); + } + LOG4CXX_INFO(logger_, + "Found number of switchable devices: " << devices.size()); + return devices; +} + #ifdef TELEMETRY_MONITOR void TransportAdapterImpl::SetTelemetryObserver(TMTelemetryObserver* observer) { metric_observer_ = observer; diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc index 2ab19ade86..f1181ce921 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc @@ -48,13 +48,12 @@ TransportAdapterListenerImpl::TransportAdapterListenerImpl( void TransportAdapterListenerImpl::OnSearchDeviceDone( const TransportAdapter* adapter) { LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE, - transport_adapter_, - "", - 0, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr()); + const TransportAdapterEvent event(EventTypeEnum::ON_SEARCH_DONE, + transport_adapter_, + "", + 0, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr()); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -68,13 +67,12 @@ void TransportAdapterListenerImpl::OnSearchDeviceFailed( LOG4CXX_TRACE(logger_, "enter. adapter: " << adapter << ", error: " << &error); SearchDeviceError* err = new SearchDeviceError(error); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL, - transport_adapter_, - "", - 0, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr(err)); + const TransportAdapterEvent event(EventTypeEnum::ON_SEARCH_FAIL, + transport_adapter_, + "", + 0, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr(err)); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -86,13 +84,12 @@ void TransportAdapterListenerImpl::OnSearchDeviceFailed( void TransportAdapterListenerImpl::OnDeviceListUpdated( const TransportAdapter* adapter) { LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED, - transport_adapter_, - "", - 0, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr()); + const TransportAdapterEvent event(EventTypeEnum::ON_DEVICE_LIST_UPDATED, + transport_adapter_, + "", + 0, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr()); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -105,7 +102,7 @@ void TransportAdapterListenerImpl::OnFindNewApplicationsRequest( const TransportAdapter* adapter) { LOG4CXX_TRACE(logger_, "enter. adapter* " << adapter); const TransportAdapterEvent event( - TransportAdapterListenerImpl::ON_FIND_NEW_APPLICATIONS_REQUEST, + EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST, transport_adapter_, "", 0, @@ -126,13 +123,12 @@ void TransportAdapterListenerImpl::OnConnectDone( LOG4CXX_TRACE(logger_, "enter adapter*: " << adapter << ", device: " << &device << ", application_id: " << &application_id); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE, - transport_adapter_, - device, - application_id, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr(new BaseError())); + const TransportAdapterEvent event(EventTypeEnum::ON_CONNECT_DONE, + transport_adapter_, + device, + application_id, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr(new BaseError())); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -151,13 +147,12 @@ void TransportAdapterListenerImpl::OnConnectFailed( << ", application_id: " << &app_id << ", error: " << &error); ConnectError* err = new ConnectError(error); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL, - transport_adapter_, - device, - app_id, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr(err)); + const TransportAdapterEvent event(EventTypeEnum::ON_CONNECT_FAIL, + transport_adapter_, + device, + app_id, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr(err)); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -173,13 +168,12 @@ void TransportAdapterListenerImpl::OnDisconnectDone( LOG4CXX_TRACE(logger_, "enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE, - transport_adapter_, - device, - app_id, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr(new BaseError())); + const TransportAdapterEvent event(EventTypeEnum::ON_DISCONNECT_DONE, + transport_adapter_, + device, + app_id, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr(new BaseError())); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -198,13 +192,12 @@ void TransportAdapterListenerImpl::OnDisconnectFailed( << ", application_id: " << &app_id << ", error: " << &error); DisconnectError* err = new DisconnectError(error); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL, - transport_adapter_, - device, - app_id, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr(err)); + const TransportAdapterEvent event(EventTypeEnum::ON_DISCONNECT_FAIL, + transport_adapter_, + device, + app_id, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr(err)); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -230,13 +223,12 @@ void TransportAdapterListenerImpl::OnDataReceiveDone( "enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", data_container: " << data_container); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE, - transport_adapter_, - device, - app_id, - data_container, - BaseErrorPtr(new BaseError())); + const TransportAdapterEvent event(EventTypeEnum::ON_RECEIVED_DONE, + transport_adapter_, + device, + app_id, + data_container, + BaseErrorPtr(new BaseError())); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -255,13 +247,12 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed( << ", application_id: " << &app_id << ", error: " << &error); DataReceiveError* err = new DataReceiveError(error); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL, - transport_adapter_, - device, - app_id, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr(err)); + const TransportAdapterEvent event(EventTypeEnum::ON_RECEIVED_FAIL, + transport_adapter_, + device, + app_id, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr(err)); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -279,13 +270,12 @@ void TransportAdapterListenerImpl::OnDataSendDone( "enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id << ", data_container: " << data_container); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE, - transport_adapter_, - device, - app_id, - data_container, - new BaseError()); + const TransportAdapterEvent event(EventTypeEnum::ON_SEND_DONE, + transport_adapter_, + device, + app_id, + data_container, + new BaseError()); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -306,13 +296,12 @@ void TransportAdapterListenerImpl::OnDataSendFailed( << ", data_container: " << data_container << ", error: " << &error); DataSendError* err = new DataSendError(error); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL, - transport_adapter_, - device, - app_id, - data_container, - BaseErrorPtr(err)); + const TransportAdapterEvent event(EventTypeEnum::ON_SEND_FAIL, + transport_adapter_, + device, + app_id, + data_container, + BaseErrorPtr(err)); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -336,13 +325,12 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect( << ", application: " << &application << ", error: " << &error); CommunicationError* err = new CommunicationError(error); - const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT, - transport_adapter_, - device, - application, - ::protocol_handler::RawMessagePtr(), - BaseErrorPtr(err)); + const TransportAdapterEvent event(EventTypeEnum::ON_UNEXPECTED_DISCONNECT, + transport_adapter_, + device, + application, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr(err)); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { @@ -358,18 +346,34 @@ void TransportAdapterListenerImpl::OnCommunicationError( LOG4CXX_TRACE(logger_, "enter. adapter: " << adapter << ", device: " << &device << ", application_id: " << &app_id); + const TransportAdapterEvent event(EventTypeEnum::ON_COMMUNICATION_ERROR, + transport_adapter_, + device, + app_id, + ::protocol_handler::RawMessagePtr(), + BaseErrorPtr(new BaseError())); + if (transport_manager_ != NULL && + transport_manager::E_SUCCESS != + transport_manager_->ReceiveEventFromDevice(event)) { + LOG4CXX_WARN(logger_, "Failed to receive event from device"); + } + LOG4CXX_TRACE(logger_, "exit"); +} + +void TransportAdapterListenerImpl::OnTransportSwitchRequested( + const transport_adapter::TransportAdapter* adapter) { + LOG4CXX_AUTO_TRACE(logger_); const TransportAdapterEvent event( - TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR, + EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED, transport_adapter_, - device, - app_id, + "", + 0, ::protocol_handler::RawMessagePtr(), - BaseErrorPtr(new BaseError())); + BaseErrorPtr()); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { LOG4CXX_WARN(logger_, "Failed to receive event from device"); } - LOG4CXX_TRACE(logger_, "exit"); } } // namespace transport_manager diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc index 31f398233b..196ad09af4 100644 --- a/src/components/transport_manager/src/transport_manager_default.cc +++ b/src/components/transport_manager/src/transport_manager_default.cc @@ -44,6 +44,10 @@ #include "transport_manager/usb/usb_aoa_adapter.h" #endif // USB_SUPPORT +#if defined(BUILD_TESTS) +#include "transport_manager/iap2_emulation/iap2_transport_adapter.h" +#endif // BUILD_TEST + namespace transport_manager { CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") @@ -97,6 +101,23 @@ int TransportManagerDefault::Init(resumption::LastState& last_state) { ta_usb = NULL; #endif // USB_SUPPORT +#if defined BUILD_TESTS + const uint16_t iap2_bt_emu_port = 23456; + transport_adapter::IAP2BluetoothEmulationTransportAdapter* + iap2_bt_emu_adapter = + new transport_adapter::IAP2BluetoothEmulationTransportAdapter( + iap2_bt_emu_port, last_state, get_settings()); + + AddTransportAdapter(iap2_bt_emu_adapter); + + const uint16_t iap2_usb_emu_port = 34567; + transport_adapter::IAP2USBEmulationTransportAdapter* iap2_usb_emu_adapter = + new transport_adapter::IAP2USBEmulationTransportAdapter( + iap2_usb_emu_port, last_state, get_settings()); + + AddTransportAdapter(iap2_usb_emu_adapter); +#endif // BUILD_TEST + LOG4CXX_TRACE(logger_, "exit with E_SUCCESS"); return E_SUCCESS; } diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index 831ff0980e..03e6bd58f6 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -55,6 +55,17 @@ using ::transport_manager::transport_adapter::TransportAdapter; +namespace { +struct ConnectionFinder { + const uint32_t id_; + explicit ConnectionFinder(const uint32_t id) : id_(id) {} + bool operator()(const transport_manager::TransportManagerImpl::Connection& + connection) const { + return id_ == connection.id; + } +}; +} // namespace + namespace transport_manager { CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager") @@ -82,7 +93,11 @@ TransportManagerImpl::TransportManagerImpl( , connection_id_counter_(0) , message_queue_("TM MessageQueue", this) , event_queue_("TM EventQueue", this) - , settings_(settings) { + , settings_(settings) + , device_switch_timer_( + "Device reconection timer", + new timer::TimerTaskImpl<TransportManagerImpl>( + this, &TransportManagerImpl::ReconnectionTimeout)) { LOG4CXX_TRACE(logger_, "TransportManager has created"); } @@ -108,6 +123,12 @@ TransportManagerImpl::~TransportManagerImpl() { LOG4CXX_INFO(logger_, "TransportManager object destroyed"); } +void TransportManagerImpl::ReconnectionTimeout() { + LOG4CXX_AUTO_TRACE(logger_); + RaiseEvent(&TransportManagerListener::OnDeviceSwitchingFinish, + device_to_reconnect_); +} + int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) { LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle); if (!this->is_initialized_) { @@ -562,7 +583,8 @@ void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) { const DeviceList dev_list = ta->GetDeviceList(); for (DeviceList::const_iterator it = dev_list.begin(); it != dev_list.end(); ++it) { - DeviceHandle device_handle = converter_.UidToHandle(*it); + DeviceHandle device_handle = + converter_.UidToHandle(*it, ta->GetConnectionType()); DeviceInfo info( device_handle, *it, ta->DeviceName(*it), ta->GetConnectionType()); device_list_.push_back(std::make_pair(ta, info)); @@ -626,25 +648,43 @@ void TransportManagerImpl::RemoveConnection( LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "Id: " << id); sync_primitives::AutoWriteLock lock(connections_lock_); - std::vector<ConnectionInternal>::iterator it = connections_.begin(); - while (it != connections_.end()) { - if (it->id == id) { - if (transport_adapter) { - transport_adapter->RemoveFinalizedConnection(it->device, - it->application); - } - connections_.erase(it++); - break; - } else { - ++it; + LOG4CXX_DEBUG(logger_, "Removing connection with id: " << id); + const std::vector<ConnectionInternal>::iterator it = std::find_if( + connections_.begin(), connections_.end(), ConnectionFinder(id)); + if (connections_.end() != it) { + if (transport_adapter) { + transport_adapter->RemoveFinalizedConnection(it->device, it->application); + } + } +} + +void TransportManagerImpl::DeactivateDeviceConnections( + const DeviceUID& device_uid) { + LOG4CXX_AUTO_TRACE(logger_); + + sync_primitives::AutoWriteLock lock(connections_lock_); + LOG4CXX_DEBUG(logger_, + "Deactivating connections for device with UID: " << device_uid); + + size_t counter = 0; + for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); + it != connections_.end(); + ++it) { + if (it->device == device_uid) { + it->active_ = false; + ++counter; } } + LOG4CXX_DEBUG(logger_, + "Deactivated " + << counter + << " connections for device with UID: " << device_uid); } TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( const ConnectionUID id) { LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, "ConnectionUID: " << &id); + LOG4CXX_DEBUG(logger_, "ConnectionUID: " << id); for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { @@ -659,9 +699,8 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( const DeviceUID& device, const ApplicationHandle& application) { LOG4CXX_AUTO_TRACE(logger_); - LOG4CXX_DEBUG(logger_, - "DeviceUID: " << &device - << "ApplicationHandle: " << &application); + LOG4CXX_DEBUG( + logger_, "DeviceUID: " << device << "ApplicationHandle: " << application); for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); it != connections_.end(); ++it) { @@ -673,21 +712,201 @@ TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection( return NULL; } -void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) { - LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta); - const DeviceList device_list = ta->GetDeviceList(); - LOG4CXX_DEBUG(logger_, "DEVICE_LIST_UPDATED " << device_list.size()); - for (DeviceList::const_iterator it = device_list.begin(); - it != device_list.end(); +TransportManagerImpl::ConnectionInternal* +TransportManagerImpl::GetActiveConnection( + const DeviceUID& device, const ApplicationHandle& application) { + LOG4CXX_AUTO_TRACE(logger_); + LOG4CXX_DEBUG(logger_, + "DeviceUID: " << device + << " ApplicationHandle: " << application); + for (std::vector<ConnectionInternal>::iterator it = connections_.begin(); + it != connections_.end(); + ++it) { + if (it->device == device && it->application == application && it->active_) { + LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it); + return &*it; + } + } + return NULL; +} + +namespace { + +struct IOSBTAdapterFinder { + bool operator()(const std::vector<TransportAdapter*>::value_type& i) const { + return i->GetDeviceType() == transport_adapter::DeviceType::IOS_BT; + } +}; + +struct SwitchableFinder { + explicit SwitchableFinder(SwitchableDevices::const_iterator what) + : what_(what) {} + bool operator()(const SwitchableDevices::value_type& i) const { + return what_->second == i.second; + } + + private: + SwitchableDevices::const_iterator what_; +}; + +} // namespace + +void TransportManagerImpl::TryDeviceSwitch( + transport_adapter::TransportAdapter* adapter) { + LOG4CXX_AUTO_TRACE(logger_); + if (adapter->GetDeviceType() != transport_adapter::DeviceType::IOS_USB) { + LOG4CXX_ERROR(logger_, "Switching requested not from iAP-USB transport."); + return; + } + + const auto ios_bt_adapter = std::find_if(transport_adapters_.begin(), + transport_adapters_.end(), + IOSBTAdapterFinder()); + + if (transport_adapters_.end() == ios_bt_adapter) { + LOG4CXX_WARN( + logger_, + "There is no iAP2 Bluetooth adapter found. Switching is not possible."); + return; + } + + const SwitchableDevices usb_switchable_devices = + adapter->GetSwitchableDevices(); + const auto bt_switchable_devices = (*ios_bt_adapter)->GetSwitchableDevices(); + auto bt = bt_switchable_devices.end(); + auto usb = usb_switchable_devices.begin(); + for (; usb != usb_switchable_devices.end(); ++usb) { + SwitchableFinder finder(usb); + bt = std::find_if( + bt_switchable_devices.begin(), bt_switchable_devices.end(), finder); + + if (bt != bt_switchable_devices.end()) { + break; + } + } + + if (bt_switchable_devices.end() == bt) { + LOG4CXX_WARN(logger_, + "No suitable for switching iAP2 Bluetooth device found."); + return; + } + + LOG4CXX_DEBUG(logger_, + "Found UUID suitable for transport switching: " << bt->second); + LOG4CXX_DEBUG( + logger_, "Device to switch from: " << bt->first << " to: " << usb->first); + + sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_); + + const auto bt_device_uid = bt->first; + const auto device_to_switch = device_to_adapter_map_.find(bt_device_uid); + if (device_to_adapter_map_.end() == device_to_switch) { + LOG4CXX_ERROR(logger_, + "There is no known device found with UID " + << bt_device_uid + << " . Transport switching is not possible."); + DCHECK_OR_RETURN_VOID(false); + return; + } + + const auto usb_uid = usb->first; + const auto bt_uid = device_to_switch->first; + const auto bt_adapter = device_to_switch->second; + + LOG4CXX_DEBUG(logger_, + "Known device with UID " + << bt_uid << " is appropriate for transport switching."); + + RaiseEvent( + &TransportManagerListener::OnDeviceSwitchingStart, bt_uid, usb_uid); + + bt_adapter->StopDevice(bt_uid); + adapter->DeviceSwitched(usb_uid); + + DeactivateDeviceConnections(bt_uid); + + device_to_reconnect_ = bt_uid; + + const uint32_t timeout = get_settings().app_transport_change_timer() + + get_settings().app_transport_change_timer_addition(); + device_switch_timer_.Start(timeout, timer::kSingleShot); + + LOG4CXX_DEBUG(logger_, + "Device switch for device id " << bt_uid << " is done."); + return; +} + +bool TransportManagerImpl::UpdateDeviceMapping( + transport_adapter::TransportAdapter* ta) { + const DeviceList adapter_device_list = ta->GetDeviceList(); + LOG4CXX_DEBUG(logger_, "DEVICE_LIST_UPDATED " << adapter_device_list.size()); + + sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_); + + LOG4CXX_DEBUG(logger_, + "Before cleanup and update. Device map size is " + << device_to_adapter_map_.size()); + + for (auto item = device_to_adapter_map_.begin(); + device_to_adapter_map_.end() != item;) { + const auto adapter = item->second; + if (adapter != ta) { + ++item; + continue; + } + + const auto device_uid = item->first; + if (adapter_device_list.end() != std::find(adapter_device_list.begin(), + adapter_device_list.end(), + device_uid)) { + ++item; + continue; + } + + device_to_adapter_map_.erase(item); + item = device_to_adapter_map_.begin(); + } + + LOG4CXX_DEBUG(logger_, + "After cleanup. Device map size is " + << device_to_adapter_map_.size()); + + for (DeviceList::const_iterator it = adapter_device_list.begin(); + it != adapter_device_list.end(); ++it) { - device_to_adapter_map_lock_.AcquireForWriting(); - device_to_adapter_map_.insert(std::make_pair(*it, ta)); - device_to_adapter_map_lock_.Release(); - DeviceHandle device_handle = converter_.UidToHandle(*it); - DeviceInfo info( - device_handle, *it, ta->DeviceName(*it), ta->GetConnectionType()); + const auto device_uid = *it; + const auto result = + device_to_adapter_map_.insert(std::make_pair(device_uid, ta)); + if (!result.second) { + LOG4CXX_WARN(logger_, + "Device UID " + << device_uid + << " is known already. Processing skipped." + "Connection type is: " << ta->GetConnectionType()); + continue; + } + DeviceHandle device_handle = + converter_.UidToHandle(device_uid, ta->GetConnectionType()); + DeviceInfo info(device_handle, + device_uid, + ta->DeviceName(device_uid), + ta->GetConnectionType()); RaiseEvent(&TransportManagerListener::OnDeviceFound, info); } + + LOG4CXX_DEBUG(logger_, + "After update. Device map size is " + << device_to_adapter_map_.size()); + + return true; +} + +void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) { + LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta); + if (!UpdateDeviceMapping(ta)) { + LOG4CXX_ERROR(logger_, "Device list update failed."); + return; + } UpdateDeviceList(ta); std::vector<DeviceInfo> device_infos; device_list_lock_.AcquireForReading(); @@ -697,37 +916,43 @@ void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) { device_infos.push_back(it->second); } device_list_lock_.Release(); + RaiseEvent(&TransportManagerListener::OnDeviceListUpdated, device_infos); LOG4CXX_TRACE(logger_, "exit"); } void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_TRACE(logger_, "enter"); switch (event.event_type) { - case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE: { + case EventTypeEnum::ON_SEARCH_DONE: { RaiseEvent(&TransportManagerListener::OnScanDevicesFinished); LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_DONE"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL: { + case EventTypeEnum::ON_SEARCH_FAIL: { // error happened in real search process (external error) RaiseEvent(&TransportManagerListener::OnScanDevicesFailed, *static_cast<SearchDeviceError*>(event.event_error.get())); LOG4CXX_DEBUG(logger_, "event_type = ON_SEARCH_FAIL"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED: { + case EventTypeEnum::ON_DEVICE_LIST_UPDATED: { OnDeviceListUpdated(event.transport_adapter); LOG4CXX_DEBUG(logger_, "event_type = ON_DEVICE_LIST_UPDATED"); break; } - case TransportAdapterListenerImpl::ON_FIND_NEW_APPLICATIONS_REQUEST: { + case EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED: { + TryDeviceSwitch(event.transport_adapter); + LOG4CXX_DEBUG(logger_, "event_type = ON_TRANSPORT_SWITCH_REQUESTED"); + break; + } + case EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST: { RaiseEvent(&TransportManagerListener::OnFindNewApplicationsRequest); LOG4CXX_DEBUG(logger_, "event_type = ON_FIND_NEW_APPLICATIONS_REQUEST"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE: { - const DeviceHandle device_handle = - converter_.UidToHandle(event.device_uid); + case EventTypeEnum::ON_CONNECT_DONE: { + const DeviceHandle device_handle = converter_.UidToHandle( + event.device_uid, event.transport_adapter->GetConnectionType()); AddConnection(ConnectionInternal(this, event.transport_adapter, ++connection_id_counter_, @@ -744,10 +969,12 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_DONE"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL: { + case EventTypeEnum::ON_CONNECT_FAIL: { RaiseEvent( &TransportManagerListener::OnConnectionFailed, - DeviceInfo(converter_.UidToHandle(event.device_uid), + DeviceInfo(converter_.UidToHandle( + event.device_uid, + event.transport_adapter->GetConnectionType()), event.device_uid, event.transport_adapter->DeviceName(event.device_uid), event.transport_adapter->GetConnectionType()), @@ -755,7 +982,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_DEBUG(logger_, "event_type = ON_CONNECT_FAIL"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE: { + case EventTypeEnum::ON_DISCONNECT_DONE: { connections_lock_.AcquireForReading(); ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); @@ -774,16 +1001,16 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_DONE"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL: { - const DeviceHandle device_handle = - converter_.UidToHandle(event.device_uid); + case EventTypeEnum::ON_DISCONNECT_FAIL: { + const DeviceHandle device_handle = converter_.UidToHandle( + event.device_uid, event.transport_adapter->GetConnectionType()); RaiseEvent(&TransportManagerListener::OnDisconnectFailed, device_handle, DisconnectDeviceError()); LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_FAIL"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE: { + case EventTypeEnum::ON_SEND_DONE: { #ifdef TELEMETRY_MONITOR if (metric_observer_) { metric_observer_->StopRawMsg(event.event_data.get()); @@ -810,7 +1037,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_DONE"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL: { + case EventTypeEnum::ON_SEND_FAIL: { #ifdef TELEMETRY_MONITOR if (metric_observer_) { metric_observer_->StopRawMsg(event.event_data.get()); @@ -845,11 +1072,11 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_DEBUG(logger_, "eevent_type = ON_SEND_FAIL"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE: { + case EventTypeEnum::ON_RECEIVED_DONE: { { sync_primitives::AutoReadLock lock(connections_lock_); ConnectionInternal* connection = - GetConnection(event.device_uid, event.application_id); + GetActiveConnection(event.device_uid, event.application_id); if (connection == NULL) { LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " @@ -872,11 +1099,11 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL: { + case EventTypeEnum::ON_RECEIVED_FAIL: { LOG4CXX_DEBUG(logger_, "Event ON_RECEIVED_FAIL"); connections_lock_.AcquireForReading(); ConnectionInternal* connection = - GetConnection(event.device_uid, event.application_id); + GetActiveConnection(event.device_uid, event.application_id); if (connection == NULL) { LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", " @@ -891,12 +1118,11 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_FAIL"); break; } - case TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR: { + case EventTypeEnum::ON_COMMUNICATION_ERROR: { LOG4CXX_DEBUG(logger_, "event_type = ON_COMMUNICATION_ERROR"); break; } - case TransportAdapterListenerImpl::EventTypeEnum:: - ON_UNEXPECTED_DISCONNECT: { + case EventTypeEnum::ON_UNEXPECTED_DISCONNECT: { connections_lock_.AcquireForReading(); ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id); @@ -983,7 +1209,8 @@ TransportManagerImpl::ConnectionInternal::ConnectionInternal( this, &ConnectionInternal::DisconnectFailedRoutine))) , shutdown_(false) , device_handle_(device_handle) - , messages_count(0) { + , messages_count(0) + , active_(true) { Connection::id = id; Connection::device = dev_id; Connection::application = app_id; @@ -999,4 +1226,55 @@ void TransportManagerImpl::ConnectionInternal::DisconnectFailedRoutine() { LOG4CXX_TRACE(logger_, "exit"); } +DeviceHandle TransportManagerImpl::Handle2GUIDConverter::UidToHandle( + const DeviceUID& dev_uid, const std::string& connection_type) { + DeviceHandle handle = hash_function_(dev_uid + connection_type); + + { + sync_primitives::AutoReadLock lock(conversion_table_lock_); + + auto it = std::find_if(conversion_table_.begin(), + conversion_table_.end(), + HandleFinder(handle)); + + if (it != conversion_table_.end()) { + LOG4CXX_DEBUG(logger_, + "Handle for UID is found: " << std::get<0>(*it) << "/" + << std::get<1>(*it) << "/" + << std::get<2>(*it)); + return std::get<2>(*it); + } + } + + sync_primitives::AutoWriteLock lock(conversion_table_lock_); + + auto t = std::make_tuple(dev_uid, connection_type, handle); + conversion_table_.push_back( + std::make_tuple(dev_uid, connection_type, handle)); + LOG4CXX_DEBUG(logger_, + "Handle for UID is added: " << std::get<0>(t) << "/" + << std::get<1>(t) << "/" + << std::get<2>(t)); + return handle; +} + +DeviceUID TransportManagerImpl::Handle2GUIDConverter::HandleToUid( + const DeviceHandle handle) { + sync_primitives::AutoReadLock lock(conversion_table_lock_); + + auto it = std::find_if( + conversion_table_.begin(), conversion_table_.end(), HandleFinder(handle)); + + if (it != conversion_table_.end()) { + LOG4CXX_DEBUG(logger_, + "Handle is found: " << std::get<0>(*it) << "/" + << std::get<1>(*it) << "/" + << std::get<2>(*it)); + return std::get<0>(*it); + } + + LOG4CXX_DEBUG(logger_, "Handle is not found: " << handle); + return DeviceUID("uknown_uid"); +} + } // namespace transport_manager diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc index 584add463d..e9ab2bae8e 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc @@ -43,6 +43,10 @@ #include "utils/logger.h" +// Define the buffer size, because the Android accessory protocol packet support +// packet buffers up to 16Kbytes +#define TRANSPORT_USB_BUFFER_MAX_SIZE (16 * 1024) + namespace transport_manager { namespace transport_adapter { @@ -64,6 +68,7 @@ UsbConnection::UsbConnection(const DeviceUID& device_uid, , out_endpoint_(0) , out_endpoint_max_packet_size_(0) , in_buffer_(NULL) + , in_buffer_size_(0) , in_transfer_(NULL) , out_transfer_(0) , out_messages_() @@ -96,7 +101,7 @@ bool UsbConnection::PostInTransfer() { device_handle_, in_endpoint_, in_buffer_, - in_endpoint_max_packet_size_, + in_buffer_size_, InTransferCallback, this, 0); @@ -307,7 +312,14 @@ bool UsbConnection::Init() { LOG4CXX_TRACE(logger_, "exit with FALSE. Condition: !FindEndpoints()"); return false; } - in_buffer_ = new unsigned char[in_endpoint_max_packet_size_]; + + if (in_endpoint_max_packet_size_ < TRANSPORT_USB_BUFFER_MAX_SIZE) { + in_buffer_size_ = TRANSPORT_USB_BUFFER_MAX_SIZE; + } else { + in_buffer_size_ = in_endpoint_max_packet_size_; + } + + in_buffer_ = new unsigned char[in_buffer_size_]; in_transfer_ = libusb_alloc_transfer(0); if (NULL == in_transfer_) { LOG4CXX_ERROR(logger_, "libusb_alloc_transfer failed"); diff --git a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc index 3462b557ce..b7faf1ef6b 100644 --- a/src/components/transport_manager/src/usb/usb_aoa_adapter.cc +++ b/src/components/transport_manager/src/usb/usb_aoa_adapter.cc @@ -60,7 +60,7 @@ UsbAoaAdapter::UsbAoaAdapter(resumption::LastState& last_state, UsbAoaAdapter::~UsbAoaAdapter() {} DeviceType UsbAoaAdapter::GetDeviceType() const { - return PASA_AOA; + return AOA; } bool UsbAoaAdapter::IsInitialised() const { diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h index 0636448e58..384f55605a 100644 --- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h +++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h @@ -68,7 +68,7 @@ class MockTransportAdapterImpl : public TransportAdapterImpl { const ApplicationHandle& app_handle) { return this->FindEstablishedConnection(device_handle, app_handle); } - virtual ~MockTransportAdapterImpl(){}; + virtual ~MockTransportAdapterImpl() {} virtual DeviceType GetDeviceType() const { return DeviceType::UNKNOWN; @@ -76,6 +76,9 @@ class MockTransportAdapterImpl : public TransportAdapterImpl { MOCK_CONST_METHOD0(Store, void()); MOCK_METHOD0(Restore, bool()); + MOCK_CONST_METHOD1(FindDevice, + transport_manager::transport_adapter::DeviceSptr( + const DeviceUID& device_id)); }; } // namespace transport_manager_test diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h index 8302a63beb..03e7630e8b 100644 --- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h +++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h @@ -120,6 +120,8 @@ class MockTransportAdapterListener : public TransportAdapterListener { void(const TransportAdapter*, const DeviceUID&, const ApplicationHandle&)); + MOCK_METHOD1(OnTransportSwitchRequested, + void(const TransportAdapter* transport_adapter)); }; } // namespace transport_manager_test diff --git a/src/components/transport_manager/test/transport_adapter_listener_test.cc b/src/components/transport_manager/test/transport_adapter_listener_test.cc index c8e9af7d63..14b8850b49 100644 --- a/src/components/transport_manager/test/transport_adapter_listener_test.cc +++ b/src/components/transport_manager/test/transport_adapter_listener_test.cc @@ -45,16 +45,16 @@ using namespace ::transport_manager; class TransportAdapterListenerTest : public ::testing::Test { public: TransportAdapterListenerTest() - : app_handle(1) - , dev_id("device_id") - , transport_listener(&tr_mock, &adapter_mock) {} + : dev_id("device_id") + , transport_listener(&tr_mock, &adapter_mock) + , app_handle(1) {} protected: - const int app_handle; const std::string dev_id; MockTransportManager tr_mock; MockTransportAdapter adapter_mock; TransportAdapterListenerImpl transport_listener; + const int app_handle; }; MATCHER_P4(IsEvent, eventType, adapter, dev_id, app_id, "") { @@ -73,33 +73,30 @@ MATCHER_P5(IsEvent, eventType, adapter, dev_id, app_id, data, "") { TEST_F(TransportAdapterListenerTest, OnCommunicationError) { EXPECT_CALL( tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR, - &adapter_mock, - dev_id, - app_handle))).WillOnce(Return(E_SUCCESS)); + ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_COMMUNICATION_ERROR, + &adapter_mock, + dev_id, + app_handle))).WillOnce(Return(E_SUCCESS)); transport_listener.OnCommunicationError(&adapter_mock, dev_id, app_handle); } TEST_F(TransportAdapterListenerTest, OnConnectDone) { - EXPECT_CALL(tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE, - &adapter_mock, - dev_id, - app_handle))).WillOnce(Return(E_SUCCESS)); + EXPECT_CALL( + tr_mock, + ReceiveEventFromDevice(IsEvent( + EventTypeEnum::ON_CONNECT_DONE, &adapter_mock, dev_id, app_handle))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnConnectDone(&adapter_mock, dev_id, app_handle); } TEST_F(TransportAdapterListenerTest, OnConnectFailed) { ConnectError er; - EXPECT_CALL(tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL, - &adapter_mock, - dev_id, - app_handle))).WillOnce(Return(E_SUCCESS)); + EXPECT_CALL( + tr_mock, + ReceiveEventFromDevice(IsEvent( + EventTypeEnum::ON_CONNECT_FAIL, &adapter_mock, dev_id, app_handle))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnConnectFailed(&adapter_mock, dev_id, app_handle, er); } @@ -107,12 +104,12 @@ TEST_F(TransportAdapterListenerTest, OnDataReceiveDone) { ::protocol_handler::RawMessagePtr data_container; EXPECT_CALL(tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE, - &adapter_mock, - dev_id, - app_handle, - data_container))).WillOnce(Return(E_SUCCESS)); + ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_RECEIVED_DONE, + &adapter_mock, + dev_id, + app_handle, + data_container))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnDataReceiveDone( &adapter_mock, dev_id, app_handle, data_container); } @@ -120,12 +117,11 @@ TEST_F(TransportAdapterListenerTest, OnDataReceiveDone) { TEST_F(TransportAdapterListenerTest, OnDataReceiveFailed) { DataReceiveError err; - EXPECT_CALL(tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL, - &adapter_mock, - dev_id, - app_handle))).WillOnce(Return(E_SUCCESS)); + EXPECT_CALL( + tr_mock, + ReceiveEventFromDevice(IsEvent( + EventTypeEnum::ON_RECEIVED_FAIL, &adapter_mock, dev_id, app_handle))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnDataReceiveFailed( &adapter_mock, dev_id, app_handle, err); } @@ -136,12 +132,12 @@ TEST_F(TransportAdapterListenerTest, OnDataSendDone) { new ::protocol_handler::RawMessage(1, 1, data, 3); EXPECT_CALL(tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE, - &adapter_mock, - dev_id, - app_handle, - data_container))).WillOnce(Return(E_SUCCESS)); + ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_SEND_DONE, + &adapter_mock, + dev_id, + app_handle, + data_container))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnDataSendDone( &adapter_mock, dev_id, app_handle, data_container); } @@ -153,56 +149,50 @@ TEST_F(TransportAdapterListenerTest, OnDataSendFailed) { DataSendError err; EXPECT_CALL(tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL, - &adapter_mock, - dev_id, - app_handle, - data_container))).WillOnce(Return(E_SUCCESS)); + ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_SEND_FAIL, + &adapter_mock, + dev_id, + app_handle, + data_container))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnDataSendFailed( &adapter_mock, dev_id, app_handle, data_container, err); } TEST_F(TransportAdapterListenerTest, OnDeviceListUpdated) { - EXPECT_CALL( - tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED, - &adapter_mock, - "", - 0))).WillOnce(Return(E_SUCCESS)); + EXPECT_CALL(tr_mock, + ReceiveEventFromDevice(IsEvent( + EventTypeEnum::ON_DEVICE_LIST_UPDATED, &adapter_mock, "", 0))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnDeviceListUpdated(&adapter_mock); } TEST_F(TransportAdapterListenerTest, OnDisconnectDeviceDone) { - EXPECT_CALL( - tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE, - &adapter_mock, - dev_id, - app_handle))).WillOnce(Return(E_SUCCESS)); + EXPECT_CALL(tr_mock, + ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_DISCONNECT_DONE, + &adapter_mock, + dev_id, + app_handle))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnDisconnectDone(&adapter_mock, dev_id, app_handle); } TEST_F(TransportAdapterListenerTest, OnDisconnectFailed) { DisconnectError err; - EXPECT_CALL( - tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL, - &adapter_mock, - dev_id, - app_handle))).WillOnce(Return(E_SUCCESS)); + EXPECT_CALL(tr_mock, + ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_DISCONNECT_FAIL, + &adapter_mock, + dev_id, + app_handle))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnDisconnectFailed(&adapter_mock, dev_id, app_handle, err); } TEST_F(TransportAdapterListenerTest, OnFindNewApplicationsRequest) { EXPECT_CALL(tr_mock, ReceiveEventFromDevice( - IsEvent(TransportAdapterListenerImpl::EventTypeEnum:: - ON_FIND_NEW_APPLICATIONS_REQUEST, + IsEvent(EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST, &adapter_mock, "", 0))).WillOnce(Return(E_SUCCESS)); @@ -211,11 +201,9 @@ TEST_F(TransportAdapterListenerTest, OnFindNewApplicationsRequest) { TEST_F(TransportAdapterListenerTest, OnSearchDeviceDone) { EXPECT_CALL(tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE, - &adapter_mock, - "", - 0))).WillOnce(Return(E_SUCCESS)); + ReceiveEventFromDevice( + IsEvent(EventTypeEnum::ON_SEARCH_DONE, &adapter_mock, "", 0))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnSearchDeviceDone(&adapter_mock); } @@ -223,11 +211,9 @@ TEST_F(TransportAdapterListenerTest, OnSearchDeviceFailed) { SearchDeviceError er; EXPECT_CALL(tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL, - &adapter_mock, - "", - 0))).WillOnce(Return(E_SUCCESS)); + ReceiveEventFromDevice( + IsEvent(EventTypeEnum::ON_SEARCH_FAIL, &adapter_mock, "", 0))) + .WillOnce(Return(E_SUCCESS)); transport_listener.OnSearchDeviceFailed(&adapter_mock, er); } @@ -236,11 +222,10 @@ TEST_F(TransportAdapterListenerTest, OnUnexpectedDisconnect) { EXPECT_CALL( tr_mock, - ReceiveEventFromDevice(IsEvent( - TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT, - &adapter_mock, - dev_id, - app_handle))).WillOnce(Return(E_SUCCESS)); + ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_UNEXPECTED_DISCONNECT, + &adapter_mock, + dev_id, + app_handle))).WillOnce(Return(E_SUCCESS)); transport_listener.OnUnexpectedDisconnect( &adapter_mock, dev_id, app_handle, err); } diff --git a/src/components/transport_manager/test/transport_adapter_test.cc b/src/components/transport_manager/test/transport_adapter_test.cc index 0c59e912ba..6d709e0c17 100644 --- a/src/components/transport_manager/test/transport_adapter_test.cc +++ b/src/components/transport_manager/test/transport_adapter_test.cc @@ -189,9 +189,10 @@ TEST_F(TransportAdapterTest, AddDevice) { MockTransportAdapterListener mock_listener; transport_adapter.AddListener(&mock_listener); - MockDevice* mockdev = new MockDevice(dev_id, uniq_id); + utils::SharedPtr<MockDevice> mockdev = + utils::MakeShared<MockDevice>(dev_id, uniq_id); - EXPECT_CALL(mock_listener, OnDeviceListUpdated(_)); + EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)); transport_adapter.AddDevice(mockdev); } @@ -276,7 +277,8 @@ TEST_F(TransportAdapterTest, ConnectDevice_ServerNotAdded_DeviceAdded) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - MockDevice* mockdev = new MockDevice(dev_id, uniq_id); + utils::SharedPtr<MockDevice> mockdev = + utils::MakeShared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -286,6 +288,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_ServerNotAdded_DeviceAdded) { int app_handle = 1; std::vector<int> intList = {app_handle}; EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(intList)); + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::FAIL, res); @@ -303,6 +306,8 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceNotAdded) { EXPECT_CALL(*serverMock, IsInitialised()).Times(0); EXPECT_CALL(*serverMock, CreateConnection(_, _)).Times(0); + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)) + .WillOnce(Return(utils::SharedPtr<MockDevice>())); TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::BAD_PARAM, res); @@ -318,7 +323,8 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - MockDevice* mockdev = new MockDevice(dev_id, uniq_id); + utils::SharedPtr<MockDevice> mockdev = + utils::MakeShared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -332,6 +338,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded) { EXPECT_CALL(*serverMock, IsInitialised()).WillOnce(Return(true)); EXPECT_CALL(*serverMock, CreateConnection(uniq_id, app_handle)) .WillOnce(Return(TransportAdapter::OK)); + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::OK, res); @@ -347,7 +354,8 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - MockDevice* mockdev = new MockDevice(dev_id, uniq_id); + utils::SharedPtr<MockDevice> mockdev = + utils::MakeShared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -361,6 +369,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) { EXPECT_CALL(*serverMock, IsInitialised()).WillOnce(Return(true)); EXPECT_CALL(*serverMock, CreateConnection(uniq_id, app_handle)) .WillOnce(Return(TransportAdapter::OK)); + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::OK, res); @@ -370,6 +379,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) { EXPECT_CALL(*serverMock, IsInitialised()).WillOnce(Return(true)); EXPECT_CALL(*serverMock, CreateConnection(uniq_id, app_handle)).Times(0); + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); TransportAdapter::Error newres = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::OK, newres); @@ -415,7 +425,8 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - MockDevice* mockdev = new MockDevice(dev_id, uniq_id); + utils::SharedPtr<MockDevice> mockdev = + utils::MakeShared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -428,6 +439,7 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) { EXPECT_CALL(*serverMock, IsInitialised()).WillOnce(Return(true)); EXPECT_CALL(*serverMock, CreateConnection(uniq_id, app_handle)) .WillOnce(Return(TransportAdapter::OK)); + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::OK, res); @@ -455,8 +467,9 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) { MockTransportAdapterListener mock_listener; transport_adapter.AddListener(&mock_listener); - MockDevice* mockdev = new MockDevice(dev_id, uniq_id); - EXPECT_CALL(mock_listener, OnDeviceListUpdated(_)); + utils::SharedPtr<MockDevice> mockdev = + utils::MakeShared<MockDevice>(dev_id, uniq_id); + EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -465,23 +478,25 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) { std::vector<int> intList = {app_handle}; EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(intList)); - + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); EXPECT_CALL(*serverMock, IsInitialised()).WillOnce(Return(true)); EXPECT_CALL(*serverMock, CreateConnection(uniq_id, app_handle)) .WillOnce(Return(TransportAdapter::OK)); TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::OK, res); - MockConnection* mock_connection = new MockConnection(); + utils::SharedPtr<MockConnection> mock_connection = + utils::MakeShared<MockConnection>(); transport_adapter.ConnectionCreated(mock_connection, uniq_id, app_handle); + EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)); EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(intList)); EXPECT_CALL( mock_listener, OnUnexpectedDisconnect(&transport_adapter, uniq_id, app_handle, _)); EXPECT_CALL(mock_listener, OnDisconnectDeviceDone(&transport_adapter, uniq_id)); - EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)); + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); DisconnectDeviceError error; transport_adapter.DeviceDisconnected(uniq_id, error); @@ -697,7 +712,8 @@ TEST_F(TransportAdapterTest, GetDeviceAndApplicationLists) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - MockDevice* mockdev = new MockDevice(dev_id, uniq_id); + utils::SharedPtr<MockDevice> mockdev = + utils::MakeShared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -707,6 +723,7 @@ TEST_F(TransportAdapterTest, GetDeviceAndApplicationLists) { int app_handle = 1; std::vector<int> intList = {app_handle}; EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(intList)); + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); std::vector<int> res = transport_adapter.GetApplicationList(uniq_id); ASSERT_EQ(1u, res.size()); EXPECT_EQ(intList[0], res[0]); @@ -752,6 +769,8 @@ TEST_F(TransportAdapterTest, RunAppOnDevice_NoDeviseWithAskedId_UNSUCCESS) { transport_adapter.AddDevice(mock_device); EXPECT_CALL(*mock_device, LaunchApp(bundle_id)).Times(0); + EXPECT_CALL(transport_adapter, FindDevice("test_device_uid1")) + .WillOnce(Return(utils::SharedPtr<MockDevice>())); transport_adapter.RunAppOnDevice("test_device_uid1", bundle_id); } @@ -769,10 +788,27 @@ TEST_F(TransportAdapterTest, RunAppOnDevice_DeviseWithAskedIdWasFound_SUCCESS) { transport_adapter.AddDevice(mock_device); EXPECT_CALL(*mock_device, LaunchApp(bundle_id)); + EXPECT_CALL(transport_adapter, FindDevice(device_uid)) + .WillOnce(Return(mock_device)); transport_adapter.RunAppOnDevice(device_uid, bundle_id); } +TEST_F(TransportAdapterTest, StopDevice) { + MockTransportAdapterImpl transport_adapter( + NULL, NULL, NULL, last_state_, transport_manager_settings); + EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); + transport_adapter.Init(); + + auto mockdev = utils::MakeShared<MockDevice>(dev_id, uniq_id); + transport_adapter.AddDevice(mockdev); + + EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); + EXPECT_CALL(*mockdev, Stop()); + + transport_adapter.StopDevice(uniq_id); +} + } // namespace transport_manager_test } // namespace components } // namespace test diff --git a/src/components/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc index c7cf3b2cb2..eebb247908 100644 --- a/src/components/transport_manager/test/transport_manager_impl_test.cc +++ b/src/components/transport_manager/test/transport_manager_impl_test.cc @@ -70,10 +70,15 @@ const uint32_t kAsyncExpectationsTimeout = 10000u; class TransportManagerImplTest : public ::testing::Test { protected: TransportManagerImplTest() - : device_handle_(1) + : mock_adapter_(NULL) + , tm_(mock_transport_manager_settings_) , mac_address_("MA:CA:DR:ES:S") - , dev_info_(device_handle_, mac_address_, "TestDeviceName", "BTMAC") - , tm_(settings) {} + , connection_type_("BTMAC") + , device_name_("TestDeviceName") + , device_handle_( + tm_.get_converter().UidToHandle(mac_address_, connection_type_)) + , dev_info_( + device_handle_, mac_address_, device_name_, connection_type_) {} void SetUp() OVERRIDE { resumption::LastStateImpl last_state_("app_storage_folder", @@ -101,11 +106,46 @@ class TransportManagerImplTest : public ::testing::Test { MakeShared<RawMessage>(connection_key_, version_protocol_, data, kSize); } - void HandleDeviceListUpdated() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED); + DeviceInfo ConstructDeviceInfo(const std::string& mac_address, + const std::string& connection_type, + const std::string& device_name) { + const auto device_handle( + tm_.get_converter().UidToHandle(mac_address, connection_type)); + + return DeviceInfo(device_handle, mac_address, device_name, connection_type); + } + + void SetOnDeviceExpectations(const DeviceInfo& device_info) { + EXPECT_CALL(*tm_listener_, OnDeviceAdded(device_info)); + EXPECT_CALL(*tm_listener_, OnDeviceListUpdated(_)); + } + + void SetDeviceExpectations(MockTransportAdapter* mock_adapter, + const DeviceList& device_list, + const DeviceInfo& device_info) { + EXPECT_CALL(*mock_adapter, GetDeviceList()) + .WillRepeatedly(Return(device_list)); + + EXPECT_CALL(*mock_adapter, DeviceName(device_info.mac_address())) + .WillRepeatedly(Return(device_info.name())); + + EXPECT_CALL(*mock_adapter, GetConnectionType()) + .WillRepeatedly(Return(device_info.connection_type())); + } + + void SetAddDeviceExpectations(MockTransportAdapter* mock_adapter, + transport_adapter::DeviceType type, + const DeviceList& device_list, + const DeviceInfo& device_info) { + SetDeviceExpectations(mock_adapter, device_list, device_info); + + EXPECT_CALL(*mock_adapter, GetDeviceType()).WillRepeatedly(Return(type)); + + SetOnDeviceExpectations(device_info); + } - TransportAdapterEvent test_event(type, + void HandleDeviceListUpdated() { + TransportAdapterEvent test_event(EventTypeEnum::ON_DEVICE_LIST_UPDATED, mock_adapter_, dev_info_.mac_address(), application_id_, @@ -125,18 +165,15 @@ class TransportManagerImplTest : public ::testing::Test { .Times(AtLeast(1)) .WillRepeatedly(Return(dev_info_.connection_type())); - EXPECT_CALL(*tm_listener_, OnDeviceFound(dev_info_)); EXPECT_CALL(*tm_listener_, OnDeviceAdded(dev_info_)); + EXPECT_CALL(*tm_listener_, OnDeviceListUpdated(_)); tm_.TestHandle(test_event); device_list_.pop_back(); } void HandleConnection() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_DONE, mock_adapter_, dev_info_.mac_address(), application_id_, @@ -146,7 +183,7 @@ class TransportManagerImplTest : public ::testing::Test { EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address())) .WillOnce(Return(dev_info_.name())); EXPECT_CALL(*mock_adapter_, GetConnectionType()) - .WillOnce(Return(dev_info_.connection_type())); + .WillRepeatedly(Return(dev_info_.connection_type())); EXPECT_CALL(*tm_listener_, OnConnectionEstablished(dev_info_, connection_key_)); @@ -155,10 +192,7 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleConnectionFailed() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_CONNECT_FAIL, mock_adapter_, dev_info_.mac_address(), application_id_, @@ -168,7 +202,7 @@ class TransportManagerImplTest : public ::testing::Test { EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address())) .WillOnce(Return(dev_info_.name())); EXPECT_CALL(*mock_adapter_, GetConnectionType()) - .WillOnce(Return(dev_info_.connection_type())); + .WillRepeatedly(Return(dev_info_.connection_type())); EXPECT_CALL(*tm_listener_, OnConnectionFailed(dev_info_, _)); @@ -176,9 +210,7 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleSendDone() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE); - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_SEND_DONE, mock_adapter_, mac_address_, application_id_, @@ -193,9 +225,7 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleReceiveDone() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE); - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_RECEIVED_DONE, mock_adapter_, mac_address_, application_id_, @@ -210,10 +240,7 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleSendFailed() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_SEND_FAIL, mock_adapter_, mac_address_, application_id_, @@ -226,10 +253,7 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleSearchDone() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_SEARCH_DONE, mock_adapter_, mac_address_, application_id_, @@ -242,10 +266,7 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleSearchFail() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_SEARCH_FAIL, mock_adapter_, mac_address_, application_id_, @@ -258,16 +279,13 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleFindNewApplicationsRequest() { - const int type = - static_cast<int>(TransportAdapterListenerImpl::EventTypeEnum:: - ON_FIND_NEW_APPLICATIONS_REQUEST); - - TransportAdapterEvent test_event(type, - mock_adapter_, - mac_address_, - application_id_, - test_message_, - error_); + TransportAdapterEvent test_event( + EventTypeEnum::ON_FIND_NEW_APPLICATIONS_REQUEST, + mock_adapter_, + mac_address_, + application_id_, + test_message_, + error_); EXPECT_CALL(*tm_listener_, OnFindNewApplicationsRequest()); @@ -275,10 +293,7 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleConnectionClosed() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_DISCONNECT_DONE, mock_adapter_, mac_address_, application_id_, @@ -293,10 +308,7 @@ class TransportManagerImplTest : public ::testing::Test { } void HandleDisconnectionFailed() { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_DISCONNECT_FAIL, mock_adapter_, mac_address_, application_id_, @@ -312,23 +324,26 @@ class TransportManagerImplTest : public ::testing::Test { EXPECT_CALL(*mock_adapter_, Terminate()); ASSERT_EQ(E_SUCCESS, tm_.Stop()); } - MockTransportManagerSettings settings; + + MockTransportManagerSettings mock_transport_manager_settings_; #ifdef TELEMETRY_MONITOR MockTMTelemetryObserver mock_metric_observer_; #endif // TELEMETRY_MONITOR MockTransportAdapter* mock_adapter_; utils::SharedPtr<MockTransportManagerListener> tm_listener_; + MockTransportManagerImpl tm_; const ApplicationHandle application_id_ = 1; ConnectionUID connection_key_; RawMessagePtr test_message_; - DeviceHandle device_handle_; std::string mac_address_; + std::string connection_type_; + std::string device_name_; + DeviceHandle device_handle_; const DeviceInfo dev_info_; DeviceList device_list_; BaseErrorPtr error_; - MockTransportManagerImpl tm_; }; TEST_F(TransportManagerImplTest, SearchDevices_AdaptersNotAdded) { @@ -642,45 +657,39 @@ TEST_F(TransportManagerImplTest, Reinit_InitAdapterFailed) { TEST_F(TransportManagerImplTest, UpdateDeviceList_AddNewDevice) { device_list_.push_back(dev_info_.mac_address()); - EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_)); - EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address())) - .WillOnce(Return(dev_info_.name())); - EXPECT_CALL(*mock_adapter_, GetConnectionType()) - .WillOnce(Return(dev_info_.connection_type())); - EXPECT_CALL(*tm_listener_, OnDeviceAdded(dev_info_)); - - tm_.UpdateDeviceList(mock_adapter_); + SetDeviceExpectations(mock_adapter_, device_list_, dev_info_); + EXPECT_CALL(*tm_listener_, OnDeviceFound(dev_info_)); + SetOnDeviceExpectations(dev_info_); + tm_.OnDeviceListUpdated(mock_adapter_); device_list_.pop_back(); } TEST_F(TransportManagerImplTest, UpdateDeviceList_RemoveDevice) { device_list_.push_back(dev_info_.mac_address()); - - ::testing::InSequence seq; - EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_)); - EXPECT_CALL(*mock_adapter_, GetConnectionType()) - .WillOnce(Return(dev_info_.connection_type())); - EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address())) - .WillOnce(Return(dev_info_.name())); - EXPECT_CALL(*tm_listener_, OnDeviceAdded(dev_info_)); - tm_.UpdateDeviceList(mock_adapter_); + { + SetDeviceExpectations(mock_adapter_, device_list_, dev_info_); + ::testing::InSequence s; + EXPECT_CALL(*tm_listener_, OnDeviceFound(dev_info_)); + SetOnDeviceExpectations(dev_info_); + tm_.OnDeviceListUpdated(mock_adapter_); + } device_list_.pop_back(); + SetDeviceExpectations(mock_adapter_, device_list_, dev_info_); + // Device list is empty now - EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_)); + ::testing::InSequence s; EXPECT_CALL(*tm_listener_, OnDeviceRemoved(dev_info_)); - tm_.UpdateDeviceList(mock_adapter_); + EXPECT_CALL(*tm_listener_, OnDeviceListUpdated(_)); + tm_.OnDeviceListUpdated(mock_adapter_); } /* * Tests which check correct handling and receiving events */ TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceDone) { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE); - TestAsyncWaiter waiter; - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_SEARCH_DONE, mock_adapter_, mac_address_, application_id_, @@ -696,11 +705,8 @@ TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceDone) { } TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceFail) { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL); - TestAsyncWaiter waiter; - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_SEARCH_FAIL, mock_adapter_, mac_address_, application_id_, @@ -716,10 +722,7 @@ TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceFail) { } TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_DeviceListUpdated) { - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_DEVICE_LIST_UPDATED, mock_adapter_, dev_info_.mac_address(), application_id_, @@ -772,10 +775,7 @@ TEST_F(TransportManagerImplTest, CheckReceiveEvent) { TEST_F(TransportManagerImplTest, CheckReceiveFailedEvent) { // Arrange - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_RECEIVED_FAIL, mock_adapter_, mac_address_, application_id_, @@ -790,10 +790,7 @@ TEST_F(TransportManagerImplTest, CheckReceiveFailedEvent) { TEST_F(TransportManagerImplTest, CheckUnexpectedDisconnect) { // Arrange - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_UNEXPECTED_DISCONNECT, mock_adapter_, mac_address_, application_id_, @@ -875,10 +872,12 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice_ConnectionNotExist) { TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_TMIsNotInitialized) { // Arrange - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE); - TransportAdapterEvent test_event( - type, NULL, mac_address_, application_id_, test_message_, error_); + TransportAdapterEvent test_event(EventTypeEnum::ON_SEARCH_DONE, + NULL, + mac_address_, + application_id_, + test_message_, + error_); // Check before Act UninitializeTM(); // Act and Assert @@ -938,84 +937,10 @@ TEST_F(TransportManagerImplTest, } TEST_F(TransportManagerImplTest, - UpdateDeviceList_AddDevices_TwoTransportAdapters) { - // Arrange - MockTransportAdapter* second_mock_adapter = new MockTransportAdapter(); - device_list_.push_back(dev_info_.mac_address()); - // Check before Act - EXPECT_CALL(*second_mock_adapter, AddListener(_)); - EXPECT_CALL(*second_mock_adapter, IsInitialised()).WillOnce(Return(true)); - EXPECT_EQ(E_SUCCESS, tm_.AddTransportAdapter(second_mock_adapter)); - - // Act and Assert - EXPECT_CALL(*second_mock_adapter, GetDeviceList()) - .WillOnce(Return(device_list_)); - EXPECT_CALL(*second_mock_adapter, DeviceName(dev_info_.mac_address())) - .WillOnce(Return(dev_info_.name())); - EXPECT_CALL(*second_mock_adapter, GetConnectionType()) - .WillOnce(Return(dev_info_.connection_type())); - EXPECT_CALL(*tm_listener_, OnDeviceAdded(dev_info_)); - tm_.UpdateDeviceList(second_mock_adapter); - - EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_)); - EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address())) - .WillOnce(Return(dev_info_.name())); - EXPECT_CALL(*mock_adapter_, GetConnectionType()) - .WillOnce(Return(dev_info_.connection_type())); - EXPECT_CALL(*tm_listener_, OnDeviceAdded(dev_info_)); - tm_.UpdateDeviceList(mock_adapter_); - - device_list_.pop_back(); -} - -TEST_F(TransportManagerImplTest, - UpdateDeviceList_RemoveDevices_TwoTransportAdapters) { - // Arrange - MockTransportAdapter* second_mock_adapter = new MockTransportAdapter(); - device_list_.push_back(dev_info_.mac_address()); - // Check before Act - EXPECT_CALL(*second_mock_adapter, AddListener(_)); - EXPECT_CALL(*second_mock_adapter, IsInitialised()).WillOnce(Return(true)); - EXPECT_EQ(E_SUCCESS, tm_.AddTransportAdapter(second_mock_adapter)); - - // Act and Assert - EXPECT_CALL(*second_mock_adapter, GetDeviceList()) - .WillOnce(Return(device_list_)); - EXPECT_CALL(*second_mock_adapter, DeviceName(dev_info_.mac_address())) - .WillOnce(Return(dev_info_.name())); - EXPECT_CALL(*second_mock_adapter, GetConnectionType()) - .WillOnce(Return(dev_info_.connection_type())); - EXPECT_CALL(*tm_listener_, OnDeviceAdded(dev_info_)); - tm_.UpdateDeviceList(second_mock_adapter); - - EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_)); - EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address())) - .WillOnce(Return(dev_info_.name())); - EXPECT_CALL(*mock_adapter_, GetConnectionType()) - .WillOnce(Return(dev_info_.connection_type())); - EXPECT_CALL(*tm_listener_, OnDeviceAdded(dev_info_)); - tm_.UpdateDeviceList(mock_adapter_); - - device_list_.pop_back(); - - EXPECT_CALL(*second_mock_adapter, GetDeviceList()) - .WillOnce(Return(device_list_)); - EXPECT_CALL(*tm_listener_, OnDeviceRemoved(dev_info_)); - tm_.UpdateDeviceList(second_mock_adapter); - - EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_)); - EXPECT_CALL(*tm_listener_, OnDeviceRemoved(dev_info_)); - tm_.UpdateDeviceList(mock_adapter_); -} - -TEST_F(TransportManagerImplTest, CheckEventOnDisconnectDone_ConnectionNotExist) { // SetUp does not add connections // Arrange - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_DISCONNECT_DONE, mock_adapter_, mac_address_, application_id_, @@ -1031,10 +956,7 @@ TEST_F(TransportManagerImplTest, TEST_F(TransportManagerImplTest, CheckEventOnSendDone_ConnectionNotExist) { // SetUp does not add connections // Arrange - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE); - - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_SEND_DONE, mock_adapter_, mac_address_, application_id_, @@ -1052,9 +974,7 @@ TEST_F(TransportManagerImplTest, CheckEventOnSendDone_ConnectionNotExist) { TEST_F(TransportManagerImplTest, CheckEventOnReceivedDone_ConnectionNotExist) { // SetUp does not add connections // Arrange - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE); - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_RECEIVED_DONE, mock_adapter_, mac_address_, application_id_, @@ -1071,9 +991,7 @@ TEST_F(TransportManagerImplTest, CheckEventOnReceivedDone_ConnectionNotExist) { TEST_F(TransportManagerImplTest, CheckEventOnReceivedFail_ConnectionNotExist) { // SetUp does not add connections // Arrange - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL); - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_RECEIVED_FAIL, mock_adapter_, mac_address_, application_id_, @@ -1088,9 +1006,7 @@ TEST_F(TransportManagerImplTest, CheckEventOnUnexpectedDisconnect_ConnectionNotExist) { // SetUp does not add connections // Arrange - const int type = static_cast<int>( - TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT); - TransportAdapterEvent test_event(type, + TransportAdapterEvent test_event(EventTypeEnum::ON_UNEXPECTED_DISCONNECT, mock_adapter_, mac_address_, application_id_, @@ -1108,6 +1024,305 @@ TEST_F(TransportManagerImplTest, RunAppOnDevice_TransportAdapterFound_SUCCESS) { tm_.RunAppOnDevice(device_handle_, bundle_id); } +TEST_F(TransportManagerImplTest, + UpdateDeviceList_AddDevices_TwoTransportAdapters_ExpectSuccess) { + // Arrange + MockTransportAdapter* second_mock_adapter = new MockTransportAdapter(); + device_list_.push_back(dev_info_.mac_address()); + // Check before Act + EXPECT_CALL(*second_mock_adapter, AddListener(_)); + EXPECT_CALL(*second_mock_adapter, IsInitialised()).WillOnce(Return(true)); + EXPECT_EQ(E_SUCCESS, tm_.AddTransportAdapter(second_mock_adapter)); + + // Act and Assert + SetDeviceExpectations(mock_adapter_, device_list_, dev_info_); + EXPECT_CALL(*tm_listener_, OnDeviceFound(dev_info_)); + SetOnDeviceExpectations(dev_info_); + tm_.OnDeviceListUpdated(mock_adapter_); + + const std::string mac_address("NE:WA:DR:ES:SS"); + const std::string connection_type("TCP"); + const std::string device_name("TestName"); + const transport_manager::DeviceHandle device_handle( + tm_.get_converter().UidToHandle(mac_address, connection_type)); + + DeviceInfo second_device( + device_handle, mac_address, device_name, connection_type); + DeviceList device_list_2; + device_list_2.push_back(second_device.mac_address()); + + SetDeviceExpectations(second_mock_adapter, device_list_2, second_device); + + EXPECT_CALL(*tm_listener_, OnDeviceFound(second_device)); + SetOnDeviceExpectations(second_device); + tm_.OnDeviceListUpdated(second_mock_adapter); + + device_list_.pop_back(); +} + +TEST_F( + TransportManagerImplTest, + UpdateDeviceList_AddSameUUIDNonSwitchableDevices_TwoTransportAdapters_ExpectNoSwitch) { + device_list_.push_back(dev_info_.mac_address()); + SetAddDeviceExpectations(mock_adapter_, + transport_adapter::DeviceType::TCP, + device_list_, + dev_info_); + + tm_.OnDeviceListUpdated(mock_adapter_); + + // Adapter will be removed by TM on destruction + MockTransportAdapter* second_mock_adapter = new MockTransportAdapter(); + EXPECT_CALL(*second_mock_adapter, AddListener(_)); + EXPECT_CALL(*second_mock_adapter, IsInitialised()).WillOnce(Return(true)); + EXPECT_EQ(E_SUCCESS, tm_.AddTransportAdapter(second_mock_adapter)); + + const auto usb_serial = "USB_serial"; + DeviceInfo second_device = + ConstructDeviceInfo(usb_serial, "USB_IOS", "SecondDeviceName"); + + DeviceList second_adapter_device_list; + second_adapter_device_list.push_back(usb_serial); + + SetAddDeviceExpectations(second_mock_adapter, + transport_adapter::DeviceType::IOS_USB, + second_adapter_device_list, + second_device); + + tm_.OnDeviceListUpdated(second_mock_adapter); + + // Act + EXPECT_CALL(*second_mock_adapter, StopDevice(_)).Times(0); + EXPECT_CALL(*second_mock_adapter, DeviceSwitched(_)).Times(0); + + tm_.TestHandle( + TransportAdapterEvent(EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED, + second_mock_adapter, + mac_address_, + application_id_, + test_message_, + error_)); + + device_list_.pop_back(); +} + +TEST_F(TransportManagerImplTest, OnlyOneDeviceShouldNotTriggerSwitch) { + device_list_.push_back(dev_info_.mac_address()); + SetDeviceExpectations(mock_adapter_, device_list_, dev_info_); + SetOnDeviceExpectations(dev_info_); + + EXPECT_CALL(*mock_adapter_, StopDevice(_)).Times(0); + EXPECT_CALL(*mock_adapter_, DeviceSwitched(_)).Times(0); + EXPECT_CALL(*tm_listener_, OnDeviceSwitchingStart(_, _)).Times(0); + + tm_.TestHandle(TransportAdapterEvent(EventTypeEnum::ON_DEVICE_LIST_UPDATED, + mock_adapter_, + mac_address_, + application_id_, + test_message_, + error_)); + + device_list_.pop_back(); +} + +TEST_F(TransportManagerImplTest, + TwoTransportAdapterAddSameSwitchableDevice_ExpectSuccess) { + device_list_.push_back(dev_info_.mac_address()); + const uint32_t timeout = 0; + + SetAddDeviceExpectations(mock_adapter_, + transport_adapter::DeviceType::IOS_BT, + device_list_, + dev_info_); + + EXPECT_CALL(*tm_listener_, OnDeviceFound(dev_info_)); + + tm_.TestHandle(TransportAdapterEvent(EventTypeEnum::ON_DEVICE_LIST_UPDATED, + mock_adapter_, + mac_address_, + application_id_, + test_message_, + error_)); + + auto second_mock_adapter = utils::MakeShared<MockTransportAdapter>(); + + const auto usb_serial = "USB_serial"; + DeviceInfo second_device = + ConstructDeviceInfo(usb_serial, "USB_IOS", "SecondDeviceName"); + + DeviceList second_adapter_devices; + second_adapter_devices.push_back(second_device.mac_address()); + + SetAddDeviceExpectations(second_mock_adapter.get(), + transport_adapter::DeviceType::IOS_USB, + second_adapter_devices, + second_device); + + EXPECT_CALL(*tm_listener_, OnDeviceFound(second_device)); + EXPECT_CALL(*second_mock_adapter, DeviceSwitched(_)).Times(0); + + tm_.TestHandle(TransportAdapterEvent(EventTypeEnum::ON_DEVICE_LIST_UPDATED, + second_mock_adapter.get(), + mac_address_, + application_id_, + test_message_, + error_)); + + // Act + const auto uuid = "ABC-DEF-GHJ-KLM"; + SwitchableDevices bt_switchables; + bt_switchables.insert(std::make_pair(dev_info_.mac_address(), uuid)); + EXPECT_CALL(*mock_adapter_, GetSwitchableDevices()) + .WillOnce(Return(bt_switchables)); + + SwitchableDevices usb_switchables; + usb_switchables.insert(std::make_pair(second_device.mac_address(), uuid)); + EXPECT_CALL(*second_mock_adapter, GetSwitchableDevices()) + .WillOnce(Return(usb_switchables)); + + EXPECT_CALL(*mock_adapter_, StopDevice(mac_address_)); + EXPECT_CALL(*second_mock_adapter, DeviceSwitched(usb_serial)); + EXPECT_CALL(mock_transport_manager_settings_, app_transport_change_timer()) + .WillOnce(Return(timeout)); + EXPECT_CALL(mock_transport_manager_settings_, + app_transport_change_timer_addition()).WillOnce(Return(0)); + + EXPECT_CALL(*tm_listener_, OnDeviceSwitchingStart(mac_address_, usb_serial)); + + tm_.TestHandle( + TransportAdapterEvent(EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED, + second_mock_adapter.get(), + mac_address_, + application_id_, + test_message_, + error_)); + + // There is internal timer started on switching. Need to wait for timeout. + sleep(1); + device_list_.pop_back(); +} + +TEST_F(TransportManagerImplTest, + TwoTransportAdapterAddSameDeviceSecondSkipped) { + device_list_.push_back(dev_info_.mac_address()); + + SetAddDeviceExpectations(mock_adapter_, + transport_adapter::DeviceType::IOS_BT, + device_list_, + dev_info_); + + EXPECT_CALL(*tm_listener_, OnDeviceFound(_)); + + tm_.TestHandle(TransportAdapterEvent(EventTypeEnum::ON_DEVICE_LIST_UPDATED, + mock_adapter_, + mac_address_, + application_id_, + test_message_, + error_)); + + auto second_mock_adapter = utils::MakeShared<MockTransportAdapter>(); + + DeviceInfo second_device = + ConstructDeviceInfo("MA:CA:DR:ES:S", "USB_IOS", "SecondDeviceName"); + + SetAddDeviceExpectations(second_mock_adapter.get(), + transport_adapter::DeviceType::IOS_USB, + device_list_, + second_device); + + EXPECT_CALL(*tm_listener_, OnDeviceFound(_)).Times(0); + + tm_.TestHandle(TransportAdapterEvent(EventTypeEnum::ON_DEVICE_LIST_UPDATED, + second_mock_adapter.get(), + mac_address_, + application_id_, + test_message_, + error_)); + + device_list_.pop_back(); +} + +TEST_F(TransportManagerImplTest, NoDeviceTransportSwitchRequest_Fail) { + device_list_.push_back(dev_info_.mac_address()); + SetAddDeviceExpectations(mock_adapter_, + transport_adapter::DeviceType::IOS_USB, + device_list_, + dev_info_); + + EXPECT_CALL(*tm_listener_, OnDeviceFound(_)); + + tm_.TestHandle(TransportAdapterEvent(EventTypeEnum::ON_DEVICE_LIST_UPDATED, + mock_adapter_, + mac_address_, + application_id_, + test_message_, + error_)); + + EXPECT_CALL(*mock_adapter_, StopDevice(mac_address_)).Times(0); + + EXPECT_CALL(*tm_listener_, OnDeviceSwitchingStart(mac_address_, mac_address_)) + .Times(0); + + tm_.TestHandle( + TransportAdapterEvent(EventTypeEnum::ON_TRANSPORT_SWITCH_REQUESTED, + mock_adapter_, + mac_address_, + application_id_, + test_message_, + error_)); + + device_list_.pop_back(); +} + +TEST_F(TransportManagerImplTest, + UpdateDeviceList_RemoveDevices_TwoTransportAdapters_ExpectSuccess) { + // Arrange + MockTransportAdapter* second_mock_adapter = new MockTransportAdapter(); + device_list_.push_back(dev_info_.mac_address()); + // Check before Act + EXPECT_CALL(*second_mock_adapter, AddListener(_)); + EXPECT_CALL(*second_mock_adapter, IsInitialised()).WillOnce(Return(true)); + EXPECT_EQ(E_SUCCESS, tm_.AddTransportAdapter(second_mock_adapter)); + + // Act and Assert + SetDeviceExpectations(mock_adapter_, device_list_, dev_info_); + + EXPECT_CALL(*tm_listener_, OnDeviceFound(dev_info_)); + SetOnDeviceExpectations(dev_info_); + tm_.OnDeviceListUpdated(mock_adapter_); + + const std::string mac_address("NE:WA:DR:ES:SS"); + const std::string connection_type("TCP"); + const std::string device_name("TestName"); + const transport_manager::DeviceHandle device_handle( + tm_.get_converter().UidToHandle(mac_address, connection_type)); + + DeviceInfo second_device( + device_handle, mac_address, device_name, connection_type); + DeviceList device_list_2; + device_list_2.push_back(second_device.mac_address()); + SetDeviceExpectations(second_mock_adapter, device_list_2, second_device); + + EXPECT_CALL(*tm_listener_, OnDeviceFound(second_device)); + SetOnDeviceExpectations(second_device); + tm_.OnDeviceListUpdated(second_mock_adapter); + + device_list_.pop_back(); + device_list_2.pop_back(); + + EXPECT_CALL(*second_mock_adapter, GetDeviceList()) + .WillRepeatedly(Return(device_list_2)); + EXPECT_CALL(*tm_listener_, OnDeviceRemoved(second_device)); + EXPECT_CALL(*tm_listener_, OnDeviceListUpdated(_)); + tm_.OnDeviceListUpdated(second_mock_adapter); + + EXPECT_CALL(*mock_adapter_, GetDeviceList()) + .WillRepeatedly(Return(device_list_)); + EXPECT_CALL(*tm_listener_, OnDeviceRemoved(dev_info_)); + EXPECT_CALL(*tm_listener_, OnDeviceListUpdated(_)); + tm_.OnDeviceListUpdated(mock_adapter_); +} + } // namespace transport_manager_test } // namespace components } // namespace test diff --git a/src/components/utils/test/generated_code_with_sqlite_test.cc b/src/components/utils/test/generated_code_with_sqlite_test.cc index d37b46f801..1c829c838c 100644 --- a/src/components/utils/test/generated_code_with_sqlite_test.cc +++ b/src/components/utils/test/generated_code_with_sqlite_test.cc @@ -66,7 +66,7 @@ const std::string GeneratedCodeTest::kEndpointsCreation = "CREATE TABLE Endpoints (" "endpoint_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," "service_id VARCHAR(45) NOT NULL," - "application_id VARCHAR(45)," + "application_id VARCHAR(45) COLLATE NOCASE," "url VARCHAR(45) NOT NULL," "is_default INTEGER NOT NULL CHECK(is_default>=0))"; @@ -77,14 +77,14 @@ const std::string GeneratedCodeTest::kEndpointsContent = const std::string GeneratedCodeTest::kAppPoliciesCreation = "CREATE TABLE AppPolicies (" "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," - "application_id VARCHAR(45)," + "application_id VARCHAR(45) COLLATE NOCASE," "priority VARCHAR(45)," "is_default INTEGER NOT NULL CHECK(is_default>=0))"; const std::string GeneratedCodeTest::kGroupsCreation = "CREATE TABLE Groups (" "id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," - "application_id VARCHAR(45) NOT NULL," + "application_id VARCHAR(45) NOT NULL COLLATE NOCASE," "group_name VARCHAR(45) NOT NULL )"; TEST_F(GeneratedCodeTest, diff --git a/src/components/utils/test/policy.sql b/src/components/utils/test/policy.sql index 406579f6b7..292855734e 100644 --- a/src/components/utils/test/policy.sql +++ b/src/components/utils/test/policy.sql @@ -108,7 +108,7 @@ BEGIN TRANSACTION; CREATE INDEX `rpc.select_rpc_name_hmi_level` ON `rpc`(`name`,`hmi_level_value`); CREATE TABLE IF NOT EXISTS `application`( - `id` VARCHAR(45) PRIMARY KEY NOT NULL, + `id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, `keep_context` BOOLEAN, `steal_focus` BOOLEAN, `default_hmi` VARCHAR(45), @@ -131,7 +131,7 @@ BEGIN TRANSACTION; CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` ON `application`(`priority_value`); CREATE TABLE IF NOT EXISTS `app_group`( - `application_id` VARCHAR(45) NOT NULL, + `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, `functional_group_id` INTEGER NOT NULL, PRIMARY KEY(`application_id`,`functional_group_id`), CONSTRAINT `fk_application_has_functional_group_application1` @@ -144,9 +144,9 @@ BEGIN TRANSACTION; CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_functional_group1_idx` ON `app_group`(`functional_group_id`); CREATE INDEX IF NOT EXISTS `app_group.fk_application_has_functional_group_application1_idx` - ON `app_group`(`application_id`); + ON `app_group`(`application_id` COLLATE NOCASE); CREATE TABLE IF NOT EXISTS `preconsented_group`( - `application_id` VARCHAR(45) NOT NULL, + `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, `functional_group_id` INTEGER NOT NULL, PRIMARY KEY(`application_id`,`functional_group_id`), CONSTRAINT `fk_application_has_functional_group_application2` @@ -161,7 +161,7 @@ BEGIN TRANSACTION; ON `preconsented_group`(`functional_group_id`); CREATE INDEX IF NOT EXISTS `preconsented_group.fk_application_has_functional_group_application2_idx` - ON `preconsented_group`(`application_id`); + ON `preconsented_group`(`application_id` COLLATE NOCASE); CREATE TABLE IF NOT EXISTS `seconds_between_retry`( `index` INTEGER PRIMARY KEY NOT NULL, `value` INTEGER NOT NULL @@ -187,7 +187,7 @@ BEGIN TRANSACTION; `device_consent_group.fk_device_has_functional_group_device1_idx` ON `device_consent_group`(`device_id`); CREATE TABLE IF NOT EXISTS `app_level`( - `application_id` VARCHAR(45) PRIMARY KEY NOT NULL, + `application_id` VARCHAR(45) PRIMARY KEY NOT NULL COLLATE NOCASE, `minutes_in_hmi_full` INTEGER DEFAULT 0, `minutes_in_hmi_limited` INTEGER DEFAULT 0, `minutes_in_hmi_background` INTEGER DEFAULT 0, @@ -214,34 +214,34 @@ BEGIN TRANSACTION; REFERENCES `language`(`code`) ); CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx` - ON `app_level`(`application_id`); + ON `app_level`(`application_id` COLLATE NOCASE); CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language1_idx` ON `app_level`(`app_registration_language_gui`); CREATE INDEX IF NOT EXISTS `app_level.fk_app_level_language2_idx` ON `app_level`(`app_registration_language_vui`); CREATE TABLE IF NOT EXISTS `nickname`( - `name` VARCHAR(100) NOT NULL, - `application_id` VARCHAR(45) NOT NULL, + `name` VARCHAR(100) NOT NULL COLLATE NOCASE, + `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, PRIMARY KEY(`name`,`application_id`), CONSTRAINT `fk_nickname_application1` FOREIGN KEY(`application_id`) REFERENCES `application`(`id`) ); CREATE INDEX IF NOT EXISTS `nickname.fk_nickname_application1_idx` - ON `nickname`(`application_id`); + ON `nickname`(`application_id` COLLATE NOCASE); CREATE TABLE IF NOT EXISTS `app_type`( `name` VARCHAR(50) NOT NULL, - `application_id` VARCHAR(45) NOT NULL, + `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, PRIMARY KEY(`name`,`application_id`), CONSTRAINT `fk_app_type_application1` FOREIGN KEY(`application_id`) REFERENCES `application`(`id`) ); CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` - ON `app_type`(`application_id`); + ON `app_type`(`application_id` COLLATE NOCASE); CREATE TABLE IF NOT EXISTS `consent_group`( `device_id` VARCHAR(100) NOT NULL, - `application_id` VARCHAR(45) NOT NULL, + `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, `functional_group_id` INTEGER NOT NULL, `is_consented` BOOL NOT NULL, `input` VARCHAR(45), @@ -265,13 +265,13 @@ BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS `endpoint`( `service` INTEGER NOT NULL, `url` VARCHAR(100) NOT NULL, - `application_id` VARCHAR(45) NOT NULL, + `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, CONSTRAINT `fk_endpoint_application1` FOREIGN KEY(`application_id`) REFERENCES `application`(`id`) ); CREATE INDEX IF NOT EXISTS `endpoint.fk_endpoint_application1_idx` - ON `endpoint`(`application_id`); + ON `endpoint`(`application_id` COLLATE NOCASE); CREATE TABLE IF NOT EXISTS `message`( `id` INTEGER PRIMARY KEY NOT NULL, `tts` TEXT, diff --git a/tools/intergen/test/generated_interface_json_tests.cc b/tools/intergen/test/generated_interface_json_tests.cc index 995ff17e8b..ee1db2167b 100644 --- a/tools/intergen/test/generated_interface_json_tests.cc +++ b/tools/intergen/test/generated_interface_json_tests.cc @@ -545,7 +545,7 @@ TEST_F(GeneratedInterfaceTests, ReportIncorrectlyInitializedMap1) { ASSERT_FALSE(smim.is_valid()); rpc::ValidationReport report("smim"); smim.ReportErrors(&report); - ASSERT_EQ("smim.mandatoryIntMap: object is not initialized\n", PrettyFormat(report)); + ASSERT_EQ("smim.mandatoryIntMap: object is not initialized", PrettyFormat(report)); } TEST_F(GeneratedInterfaceTests, ReportIncorrectlyInitializedMap2) { @@ -556,7 +556,7 @@ TEST_F(GeneratedInterfaceTests, ReportIncorrectlyInitializedMap2) { ASSERT_EQ("c: object is not initialized\n" "c.choiceID: value is not initialized\n" "c.menuName: value is not initialized\n" - "c.vrCommands: object is not initialized\n", PrettyFormat(report)); + "c.vrCommands: object is not initialized", PrettyFormat(report)); } TEST_F(GeneratedInterfaceTests, TestFrankenstructCreation) { @@ -621,7 +621,7 @@ TEST_F(GeneratedInterfaceTests, FrankenstructFromInvalidJson) { ASSERT_EQ(2, fbmi.mandatoryInt); rpc::ValidationReport report("fbmi"); fbmi.ReportErrors(&report); - ASSERT_EQ("fbmi[\"hello\"]: value initialized incorrectly\n", PrettyFormat(report)); + ASSERT_EQ("fbmi[\"hello\"]: value initialized incorrectly", PrettyFormat(report)); } } // namespace test |