2 * Copyright (c) 2013, Ford Motor Company All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * · Redistributions of source code must retain the above copyright notice,
7 * this list of conditions and the following disclaimer.
8 * · Redistributions in binary form must reproduce the above copyright notice,
9 * this list of conditions and the following disclaimer in the documentation
10 * and/or other materials provided with the distribution.
11 * · Neither the name of the Ford Motor Company nor the names of its
12 * contributors may be used to endorse or promote products derived from this
13 * software without specific prior written permission.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
28 * @name SDL.AudioPassThruPopUp
29 * @desc AudioPassThruPopUp module visual representation
31 * @filesource app/view/sdl/AudioPassThruPopUp.js
35 SDL.AudioPassThruPopUp = Em.ContainerView.create( {
37 elementId: 'AudioPassThruPopUp',
39 classNames: 'AudioPassThruPopUp',
43 'activate:AudioPassThruActive'
62 activateBinding: 'SDL.SDLModel.AudioPassThruState',
66 applicationName: SDL.Label.extend( {
68 elementId: 'AudioPassThruPopUpApplicationName',
70 classNames: 'applicationName',
72 contentBinding: 'parentView.appName'
76 * Wagning image on Alert PopUp
78 image: Em.View.extend( {
79 elementId: 'audioPassThruImage',
81 classNames: 'audioPassThruImage'
84 message1: SDL.Label.extend( {
86 elementId: 'AudioPassThruPopUpMessage1',
88 classNames: 'message1',
90 contentBinding: 'parentView.content1'
93 message2: SDL.Label.extend( {
95 elementId: 'AudioPassThruPopUpMessage2',
97 classNames: 'message2',
99 contentBinding: 'parentView.content2'
102 message3: SDL.Label.extend( {
104 elementId: 'AudioPassThruPopUpMessage3',
106 classNames: 'message3',
108 contentBinding: 'parentView.content3'
111 buttonRetry: SDL.Button.create( {
112 elementId: 'AudioPassThruPopUpButtonRetry',
113 classNames: 'buttonRetry softButton',
115 responseResult: 'RETRY',
116 actionUp: function() {
117 SDL.SDLController.callPerformAudioPassThruPopUpResponse( this );
121 buttonDone: SDL.Button.create( {
122 elementId: 'AudioPassThruPopUpButtonDone',
123 classNames: 'buttonDone softButton',
125 responseResult: 'SUCCESS',
126 actionUp: function() {
127 SDL.SDLController.callPerformAudioPassThruPopUpResponse( this );
131 buttonCancel: SDL.Button.create( {
132 elementId: 'AudioPassThruPopUpButtonCancel',
133 classNames: 'buttonCancel softButton',
135 responseResult: 'ABORTED',
136 actionUp: function() {
137 SDL.SDLController.callPerformAudioPassThruPopUpResponse( this );
142 * Method clears PopUp's timer when activity flag become false, and show
143 * PopUp with data come from SDLCorel when activity flag become true
145 AudioPassThruActivity: function() {
149 var self = this, data = SDL.SDLModel.AudioPassThruData;
151 SDL.SDLModel.onPrompt( data.initialPrompt.ttsChunks );
153 this.set( 'appName', SDL.SDLController.getApplicationModel( data.appId ).appName );
155 this.set( 'content1', data.audioPassThruDisplayText1 );
156 this.set( 'content2', data.audioPassThruDisplayText2 );
158 clearTimeout( this.timer );
159 this.timer = setTimeout( function() {
160 SDL.SDLController.performAudioPassThruResponse( "SUCCESS" );
161 }, data.maxDuration );
164 clearTimeout( this.timer );
167 }.observes( 'activate' )