diff options
Diffstat (limited to 'src/components/qt_hmi/qml_model_qt5/hmi_api')
9 files changed, 0 insertions, 2393 deletions
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 } } - } -} |