APPLINK-6580: OnSystemRequest with extended API
authorAndrew Melnik <AMelnik@luxoft.com>
Thu, 3 Apr 2014 12:14:13 +0000 (15:14 +0300)
committerJustin Dickow <jjdickow@gmail.com>
Tue, 8 Jul 2014 22:46:43 +0000 (18:46 -0400)
src/components/HMI/IVSU/PROPRIETARY_REQUEST [new file with mode: 0644]
src/components/HMI/IVSU/PROPRIETARY_REQUEST~ [new file with mode: 0644]
src/components/HMI/app/AppViews.js
src/components/HMI/app/controller/sdl/Controller.js
src/components/HMI/app/model/sdl/Model.js
src/components/HMI/app/view/home/controlButtons.js
src/components/HMI/app/view/sdl/SystemRequestView.js [new file with mode: 0644]
src/components/HMI/css/buttonControls.css
src/components/HMI/css/sdl.css
src/components/HMI/ffw/BasicCommunicationRPC.js
src/components/HMI/index.html

diff --git a/src/components/HMI/IVSU/PROPRIETARY_REQUEST b/src/components/HMI/IVSU/PROPRIETARY_REQUEST
new file mode 100644 (file)
index 0000000..ab0a27b
--- /dev/null
@@ -0,0 +1,2 @@
+\1d4Ezay^ק<yi'\1a*';(*'-N)z:\ enx:\bRǂi^^笴ǭO9$ySgږ爞ZDžYh\17ږǜzۭ\7fקoj[nruZ\ 6\a\18L
+w>\14\1e\ 3^7\10\ 4k\e\15͆
diff --git a/src/components/HMI/IVSU/PROPRIETARY_REQUEST~ b/src/components/HMI/IVSU/PROPRIETARY_REQUEST~
new file mode 100644 (file)
index 0000000..e69de29
index 30b2ddc..30d8472 100644 (file)
@@ -68,6 +68,7 @@ SDL.AppViews = Em.ContainerView.extend( {
         SDL.TBTClientStateView,\r
         SDL.DriverDistraction,\r
         SDL.ExitApp,\r
+        SDL.SystemRequest,\r
         SDL.ControlButtons\r
     ],\r
 \r
index 814820b..58ec87b 100644 (file)
@@ -166,21 +166,21 @@ SDL.SDLController = Em.Object
          */
         showVRHelpItems: function() {
 
-//            if (SDL.SDLAppController.model) {
-//                if (SDL.SDLModel.VRActive && SDL.SDLModel.interactionData.vrHelp) {
-//
-//                    SDL.SDLModel.ShowVrHelp(SDL.SDLModel.interactionData.vrHelpTitle, SDL.SDLModel.interactionData.vrHelp);
-//                } else if (SDL.SDLModel.VRActive && !SDL.SDLModel.interactionData.vrHelp && SDL.SDLAppController.model.globalProperties.vrHelp) {
-//
-//                    if (SDL.SDLAppController.model) {
-//                        SDL.SDLModel.ShowVrHelp(SDL.SDLAppController.model.globalProperties.vrHelpTitle, SDL.SDLAppController.model.globalProperties.vrHelp );
-//                    }
-//                } else {
-//                    if (SDL.VRHelpListView.active) {
-//                        SDL.VRHelpListView.deactivate();
-//                    }
-//                }
-//            }
+            if (SDL.SDLAppController.model) {
+                if (SDL.SDLModel.VRActive && SDL.SDLModel.interactionData.vrHelp) {
+
+                    SDL.SDLModel.ShowVrHelp(SDL.SDLModel.interactionData.vrHelpTitle, SDL.SDLModel.interactionData.vrHelp);
+                } else if (SDL.SDLModel.VRActive && !SDL.SDLModel.interactionData.vrHelp && SDL.SDLAppController.model.globalProperties.vrHelp) {
+
+                    if (SDL.SDLAppController.model) {
+                        SDL.SDLModel.ShowVrHelp(SDL.SDLAppController.model.globalProperties.vrHelpTitle, SDL.SDLAppController.model.globalProperties.vrHelp );
+                    }
+                } else {
+                    if (SDL.VRHelpListView.active) {
+                        SDL.VRHelpListView.deactivate();
+                    }
+                }
+            }
         }.observes('SDL.SDLModel.VRActive', 'SDL.SDLModel.interactionData.vrHelp'),
 
         /**
@@ -380,6 +380,15 @@ SDL.SDLController = Em.Object
             FFW.BasicCommunication.ExitAllApplications(state);
         },
         /**
+         * Method to sent notification with selected reason of OnSystemRequest
+         *
+         * @param {String}
+         */
+        systemRequestViewSelected: function(state) {
+
+            FFW.BasicCommunication.OnSystemRequest(state);
+        },
+        /**
          * Method to sent notification ABORTED for PerformInteractionChoise
          */
         interactionChoiseCloseResponse: function(appID, result, choiceID, manualTextEntry) {
index 9085b67..22cf39f 100644 (file)
@@ -176,6 +176,7 @@ SDL.SDLModel = Em.Object.create({
             id: 9
         }
     ],
+
     /**
      * List of states for ExitApplication notification
      */
@@ -195,6 +196,36 @@ SDL.SDLModel = Em.Object.create({
     ],
 
     /**
+     * List of states for OnSystemRequest notification
+     */
+    systemRequestState: [
+        {
+            name: "HTTP",
+            id  : 0
+        },
+        {
+            name: "FILE_RESUME",
+            id  : 1
+        },
+        {
+            name: "AUTH_REQUEST",
+            id  : 2
+        },
+        {
+            name: "AUTH_CHALLENGE",
+            id  : 3
+        },
+        {
+            name: "AUTH_ACK",
+            id  : 4
+        },
+        {
+            name: "PROPRIETARY",
+            id  : 5
+        }
+    ],
+
+    /**
      * Data for AudioPassThruPopUp that contains params for visualisation
      *
      * @type {Object}
index 645c1dd..0dbbbcc 100644 (file)
@@ -41,10 +41,10 @@ SDL.ControlButtons = Em.ContainerView
             'buttonControls',
             'driverDistractionControl',
             'infoTable',
-            'sendData',
             'vehicleInfo',
             'tbtClientState',
             'ExitApp',
+            'SystemRequest',
             'UILanguages',
             'TTSVRLanguages',
             'UILanguagesLabel',
@@ -157,20 +157,6 @@ SDL.ControlButtons = Em.ContainerView
         }),
 
         /**
-         * Sending data from HMI for processing in SDLCore
-         */
-        sendData: SDL.Button.create( {
-            elementId: 'sendData',
-            classNames: 'sendData btnNotPressed',
-            action: function() {
-
-                FFW.BasicCommunication.OnSystemRequest();
-            },
-            text: 'OnSystemRequest',
-            templateName: 'text'
-        }),
-
-        /**
          * VehicleInfo button
          */
         vehicleInfo: SDL.Button.create( {
@@ -216,6 +202,21 @@ SDL.ControlButtons = Em.ContainerView
         }),
 
         /**
+         * Exit Application button opens Exit Application reasons popup
+         */
+        SystemRequest: SDL.Button.create( {
+            elementId: 'systemRequest',
+            classNames: 'systemRequest btn',
+            text: 'System Request',
+            action: function() {
+
+                // this._super();
+                SDL.SystemRequest.toggleActivity();
+            },
+            templateName: 'text'
+        }),
+
+        /**
          * Voice Recognition button
          */
         VRButton: SDL.Button.create( {
diff --git a/src/components/HMI/app/view/sdl/SystemRequestView.js b/src/components/HMI/app/view/sdl/SystemRequestView.js
new file mode 100644 (file)
index 0000000..0701cd2
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * 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.
+ */
+/**
+ * @name SDL.systemRequest
+ * @desc Exit All Applications reason select visual representation
+ * @category View
+ * @filesource app/view/sdl/systemRequestView.js
+ * @version 1.0
+ */
+
+SDL.SystemRequest = Em.ContainerView.create( {
+
+       elementId: 'systemRequestView',
+
+    classNames: 'systemRequestView',
+
+    classNameBindings:
+        [
+            'active'
+        ],
+
+    childViews:
+        [
+            'systemRequestViewLabel',
+            'systemRequestViewTitle',
+            'systemRequestViewSelect'
+        ],
+
+    /**
+     * Title of VehicleInfo PopUp view
+     */
+    systemRequestViewLabel: SDL.Label.extend( {
+
+        elementId: 'systemRequestViewLabel',
+
+        classNames: 'systemRequestViewLabel',
+
+        content: 'System Request'
+    } ),
+
+    /**
+     * Property indicates the activity state of TBTClientStateView
+     */
+    active: false,
+
+    /**
+     * Title of tbtClientState group of parameters
+     */
+    systemRequestViewTitle: SDL.Label.extend( {
+
+        elementId: 'systemRequestViewTitle',
+
+        classNames: 'systemRequestViewTitle',
+
+        content: 'System Request reason'
+    } ),
+
+    /**
+     * HMI element Select with parameters of TBTClientStates
+     */
+    systemRequestViewSelect: Em.Select.extend( {
+
+        elementId: 'systemRequestViewSelect',
+
+        classNames: 'systemRequestViewSelect',
+
+        contentBinding: 'SDL.SDLModel.systemRequestState',
+
+        optionValuePath: 'content.id',
+
+        optionLabelPath: 'content.name',
+
+        /**
+         * Selected data sent on model for further processing
+         */
+        click: function() {
+
+            SDL.SDLController.systemRequestViewSelected( this.selection.name );
+
+        }
+    } ),
+
+    /**
+     * Trigger function that activates and deactivates tbtClientStateView
+     */
+    toggleActivity: function() {
+        this.toggleProperty( 'active' );
+    }
+} );
\ No newline at end of file
index 77299af..762dd80 100644 (file)
        top: 55px !important;
 }
 
-#app_controlButtons .sendData {
+#app_controlButtons .systemRequest {
        top: 252px !important;
-       left: 1049px !important;
+       left: 1059px !important;
        width: 150px !important;
        font-size: 16px !important;
+    text-align: center;
+    line-height: 48px;
 }
 
 #app_controlButtons .btnNotPressed {
index 3b1f9b1..28f5520 100644 (file)
        line-height: 48px;
 }
 
-#exitAppView,#tbtClientStateView,#VehicleInfo {
+#exitAppView,#tbtClientStateView,#VehicleInfo,#systemRequestView {
        opacity: 0;
        left: 50px;
        width: 700px;
        border: 1px solid white;
 }
 
-#exitAppView .exitAppViewLabel,#tbtClientStateView .tbtClientStateLabel,#VehicleInfo .vehicleInfoLabel
+#exitAppView .exitAppViewLabel,#systemRequestView .systemRequestViewLabel, #tbtClientStateView .tbtClientStateLabel,#VehicleInfo .vehicleInfoLabel
        {
        top: 10px;
        width: 600px;
        background: #393939;
 }
 
-#exitAppView.active,#tbtClientStateView.active,#VehicleInfo.active {
+#exitAppView.active,#systemRequestView.active,#tbtClientStateView.active,#VehicleInfo.active {
        opacity: 1;
        display: block;
 }
 
-#exitAppView .exitAppViewTitle,#tbtClientStateView .tbtClientState,#VehicleInfo .prndl
+#exitAppView .exitAppViewTitle, #systemRequestView .systemRequestViewTitle, #tbtClientStateView .tbtClientState,#VehicleInfo .prndl
        {
        top: 70px;
        width: 600px;
        background: #535353;
 }
 
-#exitAppView .exitAppViewSelect,#tbtClientStateView .tbtClientStateSelect,#VehicleInfo .prndlSelect
+#exitAppView .exitAppViewSelect, #systemRequestView .systemRequestViewSelect, #tbtClientStateView .tbtClientStateSelect,#VehicleInfo .prndlSelect
        {
        top: 125px;
        position: absolute;
index be2eaa7..402ce5f 100644 (file)
@@ -40,12 +40,18 @@ FFW.BasicCommunication = FFW.RPCObserver
             componentName: "BasicCommunication"
         }),
 
+
+        //OnPutFile
+
+
+        onPutFileSubscribeRequestID: -1,
         onFileRemovedSubscribeRequestID: -1,
         onAppRegisteredSubscribeRequestID: -1,
         onAppUnregisteredSubscribeRequestID: -1,
         onPlayToneSubscribeRequestID: -1,
         onSDLCloseSubscribeRequestID: -1,
 
+        onPutFileUnsubscribeRequestID: -1,
         onFileRemovedUnsubscribeRequestID: -1,
         onAppRegisteredUnsubscribeRequestID: -1,
         onAppUnregisteredUnsubscribeRequestID: -1,
@@ -53,6 +59,7 @@ FFW.BasicCommunication = FFW.RPCObserver
         onSDLCloseUnsubscribeRequestID: -1,
 
         // const
+        onPutFileNotification: "BasicCommunication.OnPutFile",
         onFileRemovedNotification: "BasicCommunication.OnFileRemoved",
         onAppRegisteredNotification: "BasicCommunication.OnAppRegistered",
         onAppUnregisteredNotification: "BasicCommunication.OnAppUnregistered",
@@ -93,6 +100,8 @@ FFW.BasicCommunication = FFW.RPCObserver
             this._super();
 
             // subscribe to notifications
+            this.onPutFileSubscribeRequestID = this.client
+                .subscribeToNotification(this.onPutFileNotification);
             this.onFileRemovedSubscribeRequestID = this.client
                 .subscribeToNotification(this.onFileRemovedNotification);
             this.onAppRegisteredSubscribeRequestID = this.client
@@ -116,6 +125,8 @@ FFW.BasicCommunication = FFW.RPCObserver
 
             // unsubscribe from notifications
 
+            this.onPutFileUnsubscribeRequestID = this.client
+                .unsubscribeFromNotification(this.onPutFileNotification);
             this.onFileRemovedUnsubscribeRequestID = this.client
                 .unsubscribeFromNotification(this.onFileRemovedNotification);
             this.onAppRegisteredUnsubscribeRequestID = this.client
@@ -591,7 +602,7 @@ FFW.BasicCommunication = FFW.RPCObserver
         /**
          * Initiated by HMI.
          */
-        OnSystemRequest: function() {
+        OnSystemRequest: function(type) {
 
             Em.Logger.log("FFW.BasicCommunication.OnSystemRequest");
 
@@ -601,12 +612,14 @@ FFW.BasicCommunication = FFW.RPCObserver
                 "jsonrpc": "2.0",
                 "method": "BasicCommunication.OnSystemRequest",
                 "params":{
-                    "requestType": "HTTP",
+                    "requestType": type,
                     "url": ["http://127.0.0.1"],
                     "fileType": "JSON",
                     "offset": 1000,
                     "length": 10000,
-                    "timeout": 500
+                    "timeout": 500,
+                    "fileName": document.location.pathname.replace("index.html", "IVSU/PROPRIETARY_REQUEST"),
+                    "appID": SDL.SDLAppController.model ? SDL.SDLAppController.model.appID : null
                 }
             };
             this.client.send(JSONMessage);
index cab732f..38ba616 100644 (file)
         <script type="text/javascript" src="app/view/sdl/tbtClientStateView.js"></script>\r
         <script type="text/javascript" src="app/view/sdl/driverDistraction.js"></script>\r
         <script type="text/javascript" src="app/view/sdl/ExitAppView.js"></script>\r
+        <script type="text/javascript" src="app/view/sdl/SystemRequestView.js"></script>\r
         \r
         \r
                                \r