Not a subject for review
[profile/ivi/smartdevicelink.git] / src / components / HMI / app / controller / sdl / Controller.js
1 /*
2  * Copyright (c) 2013, Ford Motor Company All rights reserved.
3  * 
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, this
7  * list of conditions and the following disclaimer. · Redistributions in binary
8  * form must reproduce the above copyright notice, this list of conditions and
9  * the following disclaimer in the documentation and/or other materials provided
10  * with the distribution. · Neither the name of the Ford Motor Company nor the
11  * names of its contributors may be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * 
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24  * POSSIBILITY OF SUCH DAMAGE.
25  */
26 /**
27  * @name SDL.SDLController
28  * @desc Main SDL Controller
29  * @category Controller
30  * @filesource app/controller/sdl/SDLController.js
31  * @version 1.0
32  */
33 SDL.SDLController = Em.Object
34     .create( {
35         /**
36          * Current system context
37          * 
38          * @type {String}
39          */
40         sysContext: function() {
41
42             if (SDL.VRPopUp.VRActive) {
43                 return 'VRSESSION';
44             }
45             if (SDL.AlertPopUp.active) {
46                 return 'ALERT';
47             }
48             if ( SDL.SliderView.active
49                 || SDL.InteractionChoicesView.active
50                 || SDL.ScrollableMessage.active
51                 || SDL.AudioPassThruPopUp.activate
52                 || SDL.VRHelpListView.active) {
53
54                 return 'HMI_OBSCURED';
55             }
56             if (SDL.OptionsView.active) {
57                 return 'MENU';
58             }
59             if (SDL.States.info.nonMedia.active
60                 || SDL.States.media.sdlmedia.active
61                 || SDL.States.navigationApp.baseNavigation.active) {
62
63                 return 'MAIN';
64             } else {
65                 return 'MENU';
66             }
67         }.property('SDL.OptionsView.active',
68             'SDL.SliderView.active',
69             'SDL.VRPopUp.VRActive',
70             'SDL.AlertPopUp.active',
71             'SDL.States.info.nonMedia.active',
72             'SDL.States.media.sdlmedia.active',
73             'SDL.States.navigationApp.baseNavigation.active',
74             'SDL.ScrollableMessage.active',
75             'SDL.InteractionChoicesView.active',
76             'SDL.VRHelpListView.active',
77             'SDL.AudioPassThruPopUp.activate'),
78
79         /**
80          * List of SDL application models
81          * 
82          * @type object
83          */
84         applicationModels: {
85             0: SDL.SDLMediaModel,
86             1: SDL.SDLNonMediaModel
87         },
88
89         /**
90          * Registered components handler
91          *
92          * @type object
93          */
94         activateTBT: function(){
95             if (SDL.SDLAppController.model && SDL.SDLAppController.model.tbtActivate) {
96                 SDL.TurnByTurnView.activate(SDL.SDLAppController.model.appID);
97             }
98         },
99
100         /**
101          * Registered components handler
102          * 
103          * @type object
104          */
105         registeredComponentStatus: function(component) {
106
107             for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
108                 if (SDL.SDLModel.registeredComponents[i].type == component) {
109                     SDL.SDLModel.set('registeredComponents.' + i + '.state',  true);
110                     return;
111                 }
112             }
113         },
114
115         /**
116          * Registered components handler
117          *
118          * @type object
119          */
120         unregisterComponentStatus: function(component) {
121
122             for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
123                 if (SDL.SDLModel.registeredComponents[i].type == component) {
124                     SDL.SDLModel.set('registeredComponents.' + i + '.state',  false);
125                     return;
126                 }
127             }
128         },
129
130         /**
131          * Notification from state manager about triggered state
132          * Method aborts all popups and requests currently in process
133          *
134          * @type object
135          */
136         triggerState: function(){
137             if (SDL.SliderView.active) {
138                 SDL.SliderView.deactivate(false);
139             }
140         },
141
142         /**
143          * Notify SDLCore that HMI is ready and all components are registered
144          *
145          * @type {String}
146          */
147         componentsReadiness: function(component) {
148
149             for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
150                 if (!SDL.SDLModel.registeredComponents[i].state) {
151                     return;
152                 }
153             }
154             FFW.BasicCommunication.onReady();
155             SDL.SDLModel.timeStamp = new Date().getTime();
156
157             console.log(SDL.SDLModel.timeStamp);
158
159         }.observes('SDL.SDLModel.registeredComponents.@each.state'),
160
161         /**
162          * Show VrHelpItems popup with necessary params
163          * if VRPopUp is active - show data from Global Properties
164          * if VRPopUp and InteractionChoicesView are active - show data from PerformInteraction request
165          *
166          */
167         showVRHelpItems: function() {
168
169             if (SDL.SDLAppController.model) {
170                 if (SDL.SDLModel.VRActive && SDL.SDLModel.interactionData.vrHelp) {
171
172                     SDL.SDLModel.ShowVrHelp(SDL.SDLModel.interactionData.vrHelpTitle, SDL.SDLModel.interactionData.vrHelp);
173                 } else if (SDL.SDLModel.VRActive && !SDL.SDLModel.interactionData.vrHelp && SDL.SDLAppController.model.globalProperties.vrHelp) {
174
175                     if (SDL.SDLAppController.model) {
176                         SDL.SDLModel.ShowVrHelp(SDL.SDLAppController.model.globalProperties.vrHelpTitle, SDL.SDLAppController.model.globalProperties.vrHelp );
177                     }
178                 } else {
179                     if (SDL.VRHelpListView.active) {
180                         SDL.VRHelpListView.deactivate();
181                     }
182                 }
183             }
184             if (SDL.SDLAppController.model && !SDL.SDLModel.VRActive && SDL.SDLAppController.model.activeRequests.vrPerformInteraction) {
185                 SDL.SDLController.vrInteractionResponse(SDL.SDLModel.resultCode['ABORTED']);
186             }
187         }.observes('SDL.SDLModel.VRActive', 'SDL.SDLModel.interactionData.vrHelp'),
188
189         /**
190          * Handler for Help button in VR menu
191          * triggers helpPrompt on HMI
192          *
193          */
194         vrHelpAction: function() {
195             if (SDL.SDLModel.interactionData.helpPrompt) {
196                 SDL.SDLModel.onPrompt(SDL.SDLModel.interactionData.helpPrompt);
197             } else if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.helpPrompt.length) {
198                 SDL.SDLModel.onPrompt(SDL.SDLAppController.model.globalProperties.helpPrompt);
199             }
200         },
201
202         /**
203          * Notify SDLCore that TTS haas finished processing
204          *
205          * @type {String}
206          */
207         TTSResponseHandler: function() {
208
209             if (FFW.TTS.requestId) {
210                 if (FFW.TTS.aborted) {
211                     FFW.TTS.sendError(SDL.SDLModel.resultCode["ABORTED"], FFW.TTS.requestId, "TTS.Speak", "TTS Speak request aborted");
212                 } else {
213                     FFW.TTS.sendTTSResult(SDL.SDLModel.resultCode["SUCCESS"], FFW.TTS.requestId, "TTS.Speak");
214                 }
215                 FFW.TTS.requestId = null;
216                 FFW.TTS.aborted = false;
217             }
218         },
219
220         /**
221          * Move VR list to right side when VRHelpList was activated
222          * 
223          * @type {String}
224          */
225         VRMove: function() {
226
227             if (SDL.VRHelpListView.active || SDL.InteractionChoicesView.active) {
228                 SDL.SDLModel.set('VRHelpListActivated', true);
229             } else {
230                 SDL.SDLModel.set('VRHelpListActivated', false);
231             }
232         },
233
234         /**
235          * Activate navigationApp method to set navigationApp data to controlls on main screen
236          */
237         navigationAppUpdate: function() {
238             SDL.BaseNavigationView.update(SDL.SDLAppController.model.appID);
239         },
240
241         /**
242          * Default action for SoftButtons: closes window, popUp or clears
243          * applications screen
244          * 
245          * @param {Object}
246          */
247         defaultActionSoftButton: function(element) {
248
249             switch (element.groupName) {
250                 case "AlertPopUp": {
251                     SDL.AlertPopUp.deactivate();
252                     break;
253                 }
254                 case "ScrollableMessage": {
255                     SDL.ScrollableMessage.deactivate(true);
256                     break;
257                 }
258             }
259         },
260
261         /**
262          * SDL notification call function
263          * to notify that SDL Core should reset timeout for some method
264          */
265         onResetTimeout: function (appID, methodName) {
266             FFW.UI.onResetTimeout(appID, methodName);
267         },
268         /**
269          * Action to show Voice Recognition PopUp
270          */
271         activateVRPopUp: function() {
272
273             SDL.SDLModel.toggleProperty('VRActive');
274         },
275         /**
276          * Action for SoftButtons that closes popUp or window and opens
277          * applications screen
278          * 
279          * @param {Object}
280          */
281         stealFocusSoftButton: function(element) {
282
283             switch (element.groupName) {
284                 case "AlertPopUp": {
285                     SDL.AlertPopUp.deactivate();
286                     this.onActivateSDLApp(element);
287                     break;
288                 }
289                 case "ScrollableMessage": {
290                     SDL.ScrollableMessage.deactivate();
291                     this.onActivateSDLApp(element);
292                     break;
293                 }
294             }
295         },
296         /**
297          * Action for SoftButtons that clears popUps timer and it become visible
298          * all the time until user user closes it
299          * 
300          * @param {Object}
301          */
302         keepContextSoftButton: function(element) {
303
304             switch (element.groupName) {
305                 case "AlertPopUp": {
306                     clearTimeout(SDL.AlertPopUp.timer);
307                     SDL.AlertPopUp.timer = setTimeout(function() {
308                         SDL.AlertPopUp.deactivate();
309                     }, SDL.AlertPopUp.timeout);
310                     this.onResetTimeout(element.appID, "UI.Alert");
311                     break;
312                 }
313                 case "ScrollableMessage": {
314                     clearTimeout(SDL.ScrollableMessage.timer);
315                     SDL.ScrollableMessage.timer = setTimeout(function() {
316                         SDL.ScrollableMessage.deactivate();
317                     }, SDL.ScrollableMessage.timeout);
318                     this.onResetTimeout(element.appID, "UI.ScrollableMessage");
319                     break;
320                 }
321             }
322         },
323         /**
324          * Action for ClosePopUp request that triggers deactivate function from
325          * opened popUp
326          */
327         closePopUp: function() {
328
329             if (SDL.AlertPopUp.active) {
330                 SDL.AlertPopUp.deactivate();
331             }
332             if (SDL.AudioPassThruPopUp.active) {
333                 SDL.AudioPassThruPopUp.deactivate();
334                 this.performAudioPassThruResponse(SDL.SDLModel.resultCode["SUCCESS"]);
335             }
336             if (SDL.InteractionChoicesView.active) {
337                 SDL.InteractionChoicesView.deactivate("ABORTED");
338             }
339             if (SDL.ScrollableMessage.active) {
340                 SDL.ScrollableMessage.deactivate(true);
341             }
342             if (SDL.SliderView.active) {
343                 SDL.SliderView.deactivate(true);
344             }
345             if (SDL.VRHelpListView.active) {
346                 SDL.VRHelpListView.deactivate();
347             }
348         },
349
350         /**
351          * Method to close InteractionChoices view
352          */
353         InteractionChoicesDeactivate: function() {
354
355             SDL.InteractionChoicesView.deactivate("ABORTED");
356         },
357         /**
358          * Method to open Turn List view from TBT
359          * 
360          * @param {Number}
361          *            appID AppID of activated sdl application
362          */
363         tbtTurnList: function(appID) {
364
365             SDL.TBTTurnList.activate(appID);
366         },
367         /**
368          * Method to sent notification with selected state of TBT Client State
369          * 
370          * @param {String}
371          */
372         tbtClientStateSelected: function(state) {
373
374             FFW.Navigation.onTBTClientState(state);
375         },
376         /**
377          * Method to sent notification with selected reason of Exit Application
378          * 
379          * @param {String}
380          */
381         exitAppViewSelected: function(state) {
382
383             FFW.BasicCommunication.ExitAllApplications(state);
384         },
385         /**
386          * Method to sent notification with selected reason of OnSystemRequest
387          *
388          * @param {String}
389          */
390         systemRequestViewSelected: function(state) {
391
392             FFW.BasicCommunication.OnSystemRequest(state);
393         },
394         /**
395          * Method to sent notification ABORTED for PerformInteractionChoise
396          */
397         interactionChoiseCloseResponse: function(appID, result, choiceID, manualTextEntry) {
398
399             FFW.UI.interactionResponse(SDL.SDLController.getApplicationModel(appID).activeRequests.uiPerformInteraction, result, choiceID, manualTextEntry);
400             SDL.SDLModel.set('interactionData.vrHelpTitle', null);
401             SDL.SDLModel.set('interactionData.vrHelp', null);
402
403             SDL.SDLController.getApplicationModel(appID).activeRequests.uiPerformInteraction = null;
404         },
405         /**
406          * Method to sent notification ABORTED for VR PerformInteraction
407          */
408         vrInteractionResponse: function(result, choiceID) {
409
410             FFW.VR.interactionResponse(SDL.SDLAppController.model.activeRequests.vrPerformInteraction, result, choiceID);
411
412             SDL.SDLAppController.model.activeRequests.vrPerformInteraction = null;
413
414             SDL.SDLModel.set('VRActive', false);
415         },
416         /**
417          * Method to sent notification for Alert
418          * 
419          * @param {String}
420          *            result
421          * @param {Number}
422          *            alertRequestID
423          */
424         alertResponse: function(result, alertRequestID) {
425
426             FFW.UI.alertResponse(result, alertRequestID);
427         },
428         /**
429          * Method to sent notification for Scrollable Message
430          * 
431          * @param {String}
432          *            result
433          * @param {Number}
434          *            messageRequestId
435          */
436         scrollableMessageResponse: function(result, messageRequestId) {
437
438             if (result == SDL.SDLModel.resultCode['SUCCESS']) {
439                 FFW.UI.sendUIResult(result,
440                     messageRequestId,
441                     'UI.ScrollableMessage');
442             } else {
443                 FFW.UI.sendError(result,
444                     messageRequestId,
445                     'UI.ScrollableMessage',
446                     "ScrollableMessage aborted!");
447             }
448         },
449         /**
450          * Method to do necessary actions when user navigate throught the menu
451          */
452         userStateAction: function() {
453             if (SDL.ScrollableMessage.active) {
454                 SDL.ScrollableMessage.deactivate(true);
455             }
456         },
457         /**
458          * Method to sent notification for Slider
459          * 
460          * @param {String}
461          *            result
462          * @param {Number}
463          *            sliderRequestId
464          */
465         sliderResponse: function(result, sliderRequestId) {
466
467             FFW.UI.sendUIResult(result, sliderRequestId, 'UI.Slider');
468         },
469         /**
470          * Method to call performAudioPassThruResponse with Result code
471          * parameters
472          * 
473          * @param {Object}
474          *            element Button object
475          */
476         callPerformAudioPassThruPopUpResponse: function(element) {
477
478             this.performAudioPassThruResponse(element.responseResult);
479         },
480         /**
481          * Method close PerformAudioPassThruPopUp and call response from UI RPC
482          * back to SDLCore
483          * 
484          * @param {String}
485          *            result Result code
486          */
487         performAudioPassThruResponse: function(result) {
488
489             SDL.SDLModel.set('AudioPassThruState', false);
490             FFW.UI.sendUIResult(result,
491                 FFW.UI.performAudioPassThruRequestID,
492                 "UI.PerformAudioPassThru");
493         },
494         /**
495          * Method close PerformAudioPassThruPopUp and call error response from
496          * UI RPC back to SDLCore
497          * 
498          * @param {String}
499          *            result Result code
500          */
501         callPerformAudioPassThruPopUpErrorResponse: function(element) {
502
503             SDL.SDLModel.set('AudioPassThruState', false);
504             FFW.UI.sendError(element.responseResult,
505                 FFW.UI.performAudioPassThruRequestID,
506                 "UI.PerformAudioPassThru",
507                 "PerformAudioPassThru was not completed successfuly!");
508         },
509         /**
510          * Method to set language for UI component with parameters sent from
511          * SDLCore to UIRPC
512          */
513         onLanguageChangeUI: function() {
514
515             FFW.UI.OnLanguageChange(SDL.SDLModel.hmiUILanguage);
516         }.observes('SDL.SDLModel.hmiUILanguage'),
517         /**
518          * Method to set language for TTS and VR components with parameters sent
519          * from SDLCore to UIRPC
520          */
521         onLanguageChangeTTSVR: function() {
522
523             FFW.TTS.OnLanguageChange(SDL.SDLModel.hmiTTSVRLanguage);
524             FFW.VR.OnLanguageChange(SDL.SDLModel.hmiTTSVRLanguage);
525         }.observes('SDL.SDLModel.hmiTTSVRLanguage'),
526         /**
527          * Register application
528          * 
529          * @param {Object}
530          *            params
531          * @param {Number}
532          *            applicationType
533          */
534         registerApplication: function(params, applicationType) {
535
536             SDL.SDLModel.get('registeredApps')
537                 .pushObject(this.applicationModels[applicationType].create( {
538                     appID: params.appID,
539                     appName: params.appName,
540                     deviceName: params.deviceName,
541                     appType: params.appType
542                 }));
543         },
544         /**
545          * Unregister application
546          * 
547          * @param {Number}
548          *            appID
549          */
550         unregisterApplication: function(appID) {
551
552             this.getApplicationModel(appID).VRCommands = [];
553             this.getApplicationModel(appID).onDeleteApplication(appID);
554             var len = SDL.SDLModel.VRCommands.length;
555             for (var i = len - 1; i >= 0; i--) {
556                 if (SDL.SDLModel.VRCommands[i].appID == appID) {
557                     SDL.SDLModel.VRCommands.splice(i, 1);
558                 }
559             }
560             SDL.SDLAppController.set('model', null);
561         },
562         /**
563          * SDL Driver Distraction ON/OFF switcher
564          */
565         selectDriverDistraction: function() {
566
567             if (SDL.SDLModel.driverDistractionState) {
568                 FFW.UI.onDriverDistraction("DD_ON");
569             } else {
570                 FFW.UI.onDriverDistraction("DD_OFF");
571             }
572         }.observes('SDL.SDLModel.driverDistractionState'),
573
574         /**
575          * Ondisplay keyboard event handler
576          * Sends notification on SDL Core with changed value
577          */
578         onKeyboardChanges: function() {
579             if (null !== SDL.SDLModel.keyboardInputValue) {
580
581                 var str = SDL.SDLModel.keyboardInputValue;
582
583                 if (SDL.SDLAppController.model.globalProperties.keyboardProperties.keypressMode) {
584                     switch (SDL.SDLAppController.model.globalProperties.keyboardProperties.keypressMode) {
585                         case 'SINGLE_KEYPRESS':{
586                             FFW.UI.OnKeyboardInput(str.charAt( str.length-1 ));
587                             break;
588                         }
589                         case 'QUEUE_KEYPRESS':{
590                             break;
591                         }
592                         case 'RESEND_CURRENT_ENTRY':{
593                             if (str) {
594                                 FFW.UI.OnKeyboardInput(str, "KEYPRESS");
595                             }
596                             break;
597                         }
598                     }
599                 }
600             }
601         }.observes('SDL.SDLModel.keyboardInputValue'),
602
603         /**
604          * Get application model
605          * 
606          * @param {Number}
607          */
608         getApplicationModel: function(applicationId) {
609
610             return SDL.SDLModel.registeredApps.filterProperty('appID',
611                 applicationId)[0];
612         },
613         /**
614          * Function returns ChangeDeviceView back to previous state
615          */
616         turnChangeDeviceViewBack: function() {
617
618             SDL.States.goToStates('info.apps');
619         },
620         /**
621          * Enter screen vith list of devices application model
622          */
623         onGetDeviceList: function() {
624
625             SDL.States.goToStates('info.devicelist');
626             SDL.SDLModel.set('deviceSearchProgress', true);
627         },
628         /**
629          * Send notification if device was choosed
630          * 
631          * @param element:
632          *            SDL.Button
633          */
634         onDeviceChoosed: function(element) {
635
636             SDL.SDLModel.set('CurrDeviceInfo.name', element.deviceName);
637             SDL.SDLModel.set('CurrDeviceInfo.id', element.id);
638             FFW.BasicCommunication.OnDeviceChosen(element.deviceName,
639                 element.id);
640             this.turnChangeDeviceViewBack();
641         },
642         /**
643          * Method creates list of Application ID's Then call HMI method for
644          * display a list of Applications
645          * 
646          * @param {Object}
647          */
648         onGetAppList: function(appList) {
649
650             SDL.SDLModel.onGetAppList(appList);
651         },
652         /**
653          * Method call's request to get list of applications
654          */
655         findNewApps: function() {
656
657             FFW.BasicCommunication.OnFindApplications();
658         },
659         /**
660          * Method activates selected registered application
661          * 
662          * @param {Object}
663          */
664         onActivateSDLApp: function(element) {
665
666             FFW.BasicCommunication.OnAppActivated(element.appID);
667         },
668         /**
669          * Method sent custom softButtons pressed and event status to RPC
670          * 
671          * @param {Object}
672          */
673         onSoftButtonActionUpCustom: function(element) {
674
675             if (element.time > 0) {
676                 FFW.Buttons.buttonEventCustom("CUSTOM_BUTTON",
677                     "BUTTONUP",
678                     element.softButtonID);
679             } else {
680                 FFW.Buttons.buttonEventCustom("CUSTOM_BUTTON",
681                     "BUTTONUP",
682                     element.softButtonID);
683                 FFW.Buttons.buttonPressedCustom("CUSTOM_BUTTON",
684                     "SHORT",
685                     element.softButtonID);
686             }
687             clearTimeout(element.timer);
688             element.time = 0;
689         },
690         /**
691          * Method sent custom softButtons pressed and event status to RPC
692          * 
693          * @param {Object}
694          */
695         onSoftButtonActionDownCustom: function(element) {
696
697             FFW.Buttons.buttonEventCustom("CUSTOM_BUTTON",
698                 "BUTTONDOWN",
699                 element.softButtonID);
700             element.time = 0;
701             element.timer = setTimeout(function() {
702
703                 FFW.Buttons.buttonPressedCustom("CUSTOM_BUTTON",
704                     "LONG",
705                     element.softButtonID);
706                 element.time++;
707             }, 2000);
708         },
709         /**
710          * Method sent softButtons pressed and event status to RPC
711          * 
712          * @param {String}
713          * @param {Object}
714          */
715         onSoftButtonActionUp: function(element) {
716
717             if (element.time > 0) {
718                 FFW.Buttons.buttonEvent(element.presetName, "BUTTONUP");
719             } else {
720                 FFW.Buttons.buttonEvent(element.presetName, "BUTTONUP");
721                 FFW.Buttons.buttonPressed(element.presetName, "SHORT");
722             }
723             clearTimeout(element.timer);
724             element.time = 0;
725         },
726         /**
727          * Method sent softButtons Ok pressed and event status to RPC
728          * 
729          * @param {String}
730          */
731         onSoftButtonOkActionDown: function(name) {
732
733             FFW.Buttons.buttonEvent(name, "BUTTONDOWN");
734         },
735         /**
736          * Method sent softButton OK pressed and event status to RPC
737          * 
738          * @param {String}
739          */
740         onSoftButtonOkActionUp: function(name) {
741
742             FFW.Buttons.buttonEvent(name, "BUTTONUP");
743             FFW.Buttons.buttonPressed(name, "SHORT");
744             if (SDL.SDLAppController.model) {
745                 SDL.SDLAppController.model.set('isPlaying',
746                     !SDL.SDLAppController.model.isPlaying);
747             }
748         },
749         /**
750          * Method sent softButtons pressed and event status to RPC
751          * 
752          * @param {String}
753          * @param {Object}
754          */
755         onSoftButtonActionDown: function(element) {
756
757             FFW.Buttons.buttonEvent(element.presetName, "BUTTONDOWN");
758             element.time = 0;
759             element.timer = setTimeout(function() {
760
761                 FFW.Buttons.buttonPressed(element.presetName, "LONG");
762                 element.time++;
763             }, 2000);
764         },
765         /**
766          * Send system context
767          */
768         onSystemContextChange: function() {
769
770             FFW.UI.OnSystemContext(this.get('sysContext'));
771         }
772     });