summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Kolodiy <KKolodiy@luxoft.com>2014-06-30 17:44:47 +0400
committerKonstantin Kolodiy <KKolodiy@luxoft.com>2014-06-30 17:44:47 +0400
commit0eee955c6e321504217357b0e9810214538e4f6a (patch)
tree65dc8e76016efeee6431fff9de3f6feb8ffe1947
parentdafcf57f311e6c2d17ab2e16ef18bebaaa7afafe (diff)
downloadsdl_core-0eee955c6e321504217357b0e9810214538e4f6a.tar.gz
APPLINK-7920: Send notification OnSystemRequestSNAPSHOT_PASA01072014
-rw-r--r--src/components/qt_hmi/qml_model_qt5/models/SettingsSourceModel.qml6
-rw-r--r--src/components/qt_hmi/qml_model_qt5/models/SettingsStorage.qml33
-rw-r--r--src/components/qt_hmi/qml_model_qt5/views/SystemRequestView.qml89
3 files changed, 119 insertions, 9 deletions
diff --git a/src/components/qt_hmi/qml_model_qt5/models/SettingsSourceModel.qml b/src/components/qt_hmi/qml_model_qt5/models/SettingsSourceModel.qml
index a6578d7633..e05a5baec6 100644
--- a/src/components/qt_hmi/qml_model_qt5/models/SettingsSourceModel.qml
+++ b/src/components/qt_hmi/qml_model_qt5/models/SettingsSourceModel.qml
@@ -83,4 +83,10 @@ ListModel
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
index a284a0b7ac..3ef05a486c 100644
--- a/src/components/qt_hmi/qml_model_qt5/models/SettingsStorage.qml
+++ b/src/components/qt_hmi/qml_model_qt5/models/SettingsStorage.qml
@@ -152,7 +152,7 @@ Item
urlsPTExchange = urls;
currentRetry = 0;
currentUrl = 0;
- sendSystemRequest();
+ tryUpdatePolicy();
}
function getUrl() {
@@ -175,17 +175,24 @@ Item
}
}
- function sendSystemRequest() {
- var url = getUrl();
+ function sendSystemRequest(type, url, fileName, applicationId) {
var offset = 1000;
var length = 10000;
- var appId = url.policyAppId ? url.policyAppId : "default";
- var file = (url.url) ? filePTSnapshot : fileIVSU;
+ var appId = applicationId ? applicationId : "default";
+ var file = fileName ? fileName : fileIVSU;
- sdlBasicCommunication.onSystemRequest(Common.RequestType.PROPRIETARY,
- url.url, Common.FileType.JSON,
- offset, length,
- timeoutPTExchange, file, appId);
+ sdlBasicCommunication.onSystemRequest(type, url, Common.FileType.JSON,
+ offset, length, timeoutPTExchange,
+ file, appId);
+ }
+
+ function 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) {
@@ -193,6 +200,14 @@ Item
}
}
+ function systemRequest(type) {
+ if (urlsPTExchange.length) {
+ sendSystemRequest(type, urlsPTExchange[0].url, null, urlsPTExchange[0].policyAppId);
+ } else {
+ sendSystemRequest(type);
+ }
+ }
+
function stopPTExchange(fileName) {
retriesTimer.stop();
sdlSDL.onReceivedPolicyUpdate(fileName);
diff --git a/src/components/qt_hmi/qml_model_qt5/views/SystemRequestView.qml b/src/components/qt_hmi/qml_model_qt5/views/SystemRequestView.qml
new file mode 100644
index 0000000000..32a3987e74
--- /dev/null
+++ b/src/components/qt_hmi/qml_model_qt5/views/SystemRequestView.qml
@@ -0,0 +1,89 @@
+/**
+ * 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 }
+ }
+ }
+}