summaryrefslogtreecommitdiff
path: root/SDL_Core/src/components/HMI/app/controller/sdl/Controller.js
blob: 570bdf435c22a18ca46151d301b3e3fd05ac4032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
/*
 * 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.SDLController
 * @desc Main SDL Controller
 * @category Controller
 * @filesource app/controller/sdl/SDLController.js
 * @version 1.0
 */
SDL.SDLController = Em.Object
    .create( {
        /**
         * Current system context
         * 
         * @type {String}
         */
        sysContext: function() {

            if (SDL.VRPopUp.VRActive) {
                return 'VRSESSION';
            }
            if (SDL.AlertPopUp.active) {
                return 'ALERT';
            }
            if (SDL.TBTClientStateView.active
                || SDL.VehicleInfo.active
                || SDL.DriverDistraction.active
                || SDL.ExitApp.active
                || SDL.SliderView.active
                || SDL.InteractionChoicesView.active
                || SDL.ScrollableMessage.active
                || SDL.AudioPassThruPopUp.activate
                || SDL.VRHelpListView.active) {

                return 'HMI_OBSCURED';
            }
            if (SDL.OptionsView.active) {
                return 'MENU';
            }
            if (SDL.States.info.nonMedia.active
                || SDL.States.media.sdlmedia.active) {

                return 'MAIN';
            } else {
                return 'MENU';
            }
        }.property('SDL.DriverDistraction.active',
            'SDL.OptionsView.active',
            'SDL.VRPopUp.VRActive',
            'SDL.AlertPopUp.active',
            'SDL.TBTClientStateView.active',
            'SDL.VehicleInfo.active',
            'SDL.States.info.nonMedia.active',
            'SDL.States.media.sdlmedia.active',
            'SDL.ExitApp.active',
            'SDL.ScrollableMessage.active',
            'SDL.InteractionChoicesView.active',
            'SDL.VRHelpListView.active',
            'SDL.AudioPassThruPopUp.activate'),

        /**
         * List of SDL application models
         * 
         * @type object
         */
        applicationModels: {
            0: SDL.SDLMediaModel,
            1: SDL.SDLNonMediaModel
        },

        /**
         * Registered components handler
         *
         * @type object
         */
        activateTBT: function(){
            if (SDL.SDLAppController.model.tbtActivate) {
                SDL.TurnByTurnView.activate(SDL.SDLAppController.model.appID);
            }
        },

        /**
         * Registered components handler
         * 
         * @type object
         */
        registeredComponentStatus: function(component) {

            for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
                if (SDL.SDLModel.registeredComponents[i].type == component) {
                    SDL.SDLModel.set('registeredComponents.' + i + '.state',  true);
                    return;
                }
            }
        },

        /**
         * Registered components handler
         *
         * @type object
         */
        unregisterComponentStatus: function(component) {

            for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
                if (SDL.SDLModel.registeredComponents[i].type == component) {
                    SDL.SDLModel.set('registeredComponents.' + i + '.state',  false);
                    return;
                }
            }
        },

        /**
         * Notification from state manager about triggered state
         * Method aborts all popups and requests currently in process
         *
         * @type object
         */
        triggerState: function(){
            if (SDL.SliderView.active) {
                SDL.SliderView.deactivate(false);
            }
        },

        /**
         * Notify SDLCore that HMI is ready and all components are registered
         *
         * @type {String}
         */
        componentsReadiness: function(component) {

            for ( var i = 0; i < SDL.SDLModel.registeredComponents.length; i++) {
                if (!SDL.SDLModel.registeredComponents[i].state) {
                    return;
                }
            }
            FFW.BasicCommunication.onReady();
            SDL.SDLModel.timeStamp = new Date().getTime();

            console.log(SDL.SDLModel.timeStamp);

        }.observes('SDL.SDLModel.registeredComponents.@each.state'),

        /**
         * Show VrHelpItems popup with necessary params
         * if VRPopUp is active - show data from Global Properties
         * if VRPopUp and InteractionChoicesView are active - show data from PerformInteraction request
         *
         */
        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();
                    }
                }
            }
        }.observes('SDL.SDLModel.VRActive', 'SDL.SDLModel.interactionData.vrHelp'),

        /**
         * Handler for Help button in VR menu
         * triggers helpPrompt on HMI
         *
         */
        vrHelpAction: function() {
            if (SDL.SDLModel.interactionData.helpPrompt) {
                SDL.SDLModel.onPrompt(SDL.SDLModel.interactionData.helpPrompt);
            } else if (SDL.SDLAppController.model && SDL.SDLAppController.model.globalProperties.helpPrompt.length) {
                SDL.SDLModel.onPrompt(SDL.SDLAppController.model.globalProperties.helpPrompt);
            }
        },

        /**
         * Notify SDLCore that TTS haas finished processing
         *
         * @type {String}
         */
        TTSResponseHandler: function() {

            if (FFW.TTS.requestId) {
                if (FFW.TTS.aborted) {
                    FFW.TTS.sendError(SDL.SDLModel.resultCode["ABORTED"], FFW.TTS.requestId, "TTS.Speak", "TTS Speak request aborted");
                } else {
                    FFW.TTS.sendTTSResult(SDL.SDLModel.resultCode["SUCCESS"], FFW.TTS.requestId, "TTS.Speak");
                }
                FFW.TTS.requestId = null;
                FFW.TTS.aborted = false;
            }
        },

        /**
         * Move VR list to right side when VRHelpList was activated
         * 
         * @type {String}
         */
        VRMove: function() {

            if (SDL.VRHelpListView.active || SDL.InteractionChoicesView.active) {
                SDL.SDLModel.set('VRHelpListActivated', true);
            } else {
                SDL.SDLModel.set('VRHelpListActivated', false);
            }
        },

        /**
         * Activate navigationApp method to set navigationApp data to controlls on main screen
         */
        navigationAppUpdate: function() {
            SDL.BaseNavigationView.update(SDL.SDLAppController.model.appID);
        },

        /**
         * Default action for SoftButtons: closes window, popUp or clears
         * applications screen
         * 
         * @param {Object}
         */
        defaultActionSoftButton: function(element) {

            switch (element.groupName) {
                case "AlertPopUp": {
                    SDL.AlertPopUp.deactivate();
                    break;
                }
                case "ScrollableMessage": {
                    SDL.ScrollableMessage.deactivate(true);
                    break;
                }
            }
        },

        /**
         * SDL notification call function
         * to notify that SDL Core should reset timeout for some method
         */
        onResetTimeout: function (appID, methodName) {
            FFW.UI.onResetTimeout(appID, methodName);
        },
        /**
         * Action to show Voice Recognition PopUp
         */
        activateVRPopUp: function() {

            SDL.SDLModel.toggleProperty('VRActive');
        },
        /**
         * Action for SoftButtons that closes popUp or window and opens
         * applications screen
         * 
         * @param {Object}
         */
        stealFocusSoftButton: function(element) {

            switch (element.groupName) {
                case "AlertPopUp": {
                    SDL.AlertPopUp.deactivate();
                    this.onActivateSDLApp(element);
                    break;
                }
                case "ScrollableMessage": {
                    SDL.ScrollableMessage.deactivate();
                    this.onActivateSDLApp(element);
                    break;
                }
            }
        },
        /**
         * Action for SoftButtons that clears popUps timer and it become visible
         * all the time until user user closes it
         * 
         * @param {Object}
         */
        keepContextSoftButton: function(element) {

            switch (element.groupName) {
                case "AlertPopUp": {
                    clearTimeout(SDL.AlertPopUp.timer);
                    SDL.AlertPopUp.timer = setTimeout(function() {
                        SDL.AlertPopUp.deactivate();
                    }, SDL.AlertPopUp.timeout);
                    this.onResetTimeout(element.appID, "UI.Alert");
                    break;
                }
                case "ScrollableMessage": {
                    clearTimeout(SDL.ScrollableMessage.timer);
                    SDL.ScrollableMessage.timer = setTimeout(function() {
                        SDL.ScrollableMessage.deactivate();
                    }, SDL.ScrollableMessage.timeout);
                    this.onResetTimeout(element.appID, "UI.ScrollableMessage");
                    break;
                }
            }
        },
        /**
         * Action for ClosePopUp request that triggers deactivate function from
         * opened popUp
         */
        closePopUp: function() {

            if (SDL.AlertPopUp.active) {
                SDL.AlertPopUp.deactivate();
            }
            if (SDL.AudioPassThruPopUp.active) {
                SDL.AudioPassThruPopUp.deactivate();
                this.performAudioPassThruResponse(SDL.SDLModel.resultCode["SUCCESS"]);
            }
            if (SDL.InteractionChoicesView.active) {
                SDL.InteractionChoicesView.deactivate("ABORTED");
            }
            if (SDL.ScrollableMessage.active) {
                SDL.ScrollableMessage.deactivate(true);
            }
            if (SDL.SliderView.active) {
                SDL.SliderView.deactivate(true);
            }
            if (SDL.VRHelpListView.active) {
                SDL.VRHelpListView.deactivate();
            }
        },

        /**
         * Method to close InteractionChoices view
         */
        InteractionChoicesDeactivate: function() {

            SDL.InteractionChoicesView.deactivate("ABORTED");
        },
        /**
         * Method to open Turn List view from TBT
         * 
         * @param {Number}
         *            appID AppID of activated sdl application
         */
        tbtTurnList: function(appID) {

            SDL.TBTTurnList.activate(appID);
        },
        /**
         * Method to sent notification with selected state of TBT Client State
         * 
         * @param {String}
         */
        tbtClientStateSelected: function(state) {

            FFW.Navigation.onTBTClientState(state);
        },
        /**
         * Method to sent notification with selected reason of Exit Application
         * 
         * @param {String}
         */
        exitAppViewSelected: function(state) {

            FFW.BasicCommunication.ExitAllApplications(state);
        },
        /**
         * Method to sent notification ABORTED for PerformInteractionChoise
         */
        interactionChoiseCloseResponse: function(appID, result, choiceID, manualTextEntry) {

            FFW.UI.interactionResponse(SDL.SDLController.getApplicationModel(appID).activeRequests.uiPerformInteraction, result, choiceID, manualTextEntry);
            SDL.SDLModel.set('interactionData.vrHelpTitle', null);
            SDL.SDLModel.set('interactionData.vrHelp', null);

            SDL.SDLController.getApplicationModel(appID).activeRequests.uiPerformInteraction = null;
        },
        /**
         * Method to sent notification for Alert
         * 
         * @param {String}
         *            result
         * @param {Number}
         *            alertRequestID
         */
        alertResponse: function(result, alertRequestID) {

            FFW.UI.alertResponse(result, alertRequestID);
        },
        /**
         * Method to sent notification for Scrollable Message
         * 
         * @param {String}
         *            result
         * @param {Number}
         *            messageRequestId
         */
        scrollableMessageResponse: function(result, messageRequestId) {

            if (result == SDL.SDLModel.resultCode['SUCCESS']) {
                FFW.UI.sendUIResult(result,
                    messageRequestId,
                    'UI.ScrollableMessage');
            } else {
                FFW.UI.sendError(result,
                    messageRequestId,
                    'UI.ScrollableMessage',
                    "ScrollableMessage aborted!");
            }
        },
        /**
         * Method to do necessary actions when user navigate throught the menu
         */
        userStateAction: function() {
            if (SDL.ScrollableMessage.active) {
                SDL.ScrollableMessage.deactivate(true);
            }
        },
        /**
         * Method to sent notification for Slider
         * 
         * @param {String}
         *            result
         * @param {Number}
         *            sliderRequestId
         */
        sliderResponse: function(result, sliderRequestId) {

            FFW.UI.sendUIResult(result, sliderRequestId, 'UI.Slider');
        },
        /**
         * Method to call performAudioPassThruResponse with Result code
         * parameters
         * 
         * @param {Object}
         *            element Button object
         */
        callPerformAudioPassThruPopUpResponse: function(element) {

            this.performAudioPassThruResponse(element.responseResult);
        },
        /**
         * Method close PerformAudioPassThruPopUp and call response from UI RPC
         * back to SDLCore
         * 
         * @param {String}
         *            result Result code
         */
        performAudioPassThruResponse: function(result) {

            SDL.SDLModel.set('AudioPassThruState', false);
            FFW.UI.sendUIResult(result,
                FFW.UI.performAudioPassThruRequestID,
                "UI.PerformAudioPassThru");
        },
        /**
         * Method close PerformAudioPassThruPopUp and call error response from
         * UI RPC back to SDLCore
         * 
         * @param {String}
         *            result Result code
         */
        callPerformAudioPassThruPopUpErrorResponse: function(element) {

            SDL.SDLModel.set('AudioPassThruState', false);
            FFW.UI.sendError(element.responseResult,
                FFW.UI.performAudioPassThruRequestID,
                "UI.PerformAudioPassThru",
                "PerformAudioPassThru was not completed successfuly!");
        },
        /**
         * Method to set language for UI component with parameters sent from
         * SDLCore to UIRPC
         */
        onLanguageChangeUI: function() {

            FFW.UI.OnLanguageChange(SDL.SDLModel.hmiUILanguage);
        }.observes('SDL.SDLModel.hmiUILanguage'),
        /**
         * Method to set language for TTS and VR components with parameters sent
         * from SDLCore to UIRPC
         */
        onLanguageChangeTTSVR: function() {

            FFW.TTS.OnLanguageChange(SDL.SDLModel.hmiTTSVRLanguage);
            FFW.VR.OnLanguageChange(SDL.SDLModel.hmiTTSVRLanguage);
        }.observes('SDL.SDLModel.hmiTTSVRLanguage'),
        /**
         * Register application
         * 
         * @param {Object}
         *            params
         * @param {Number}
         *            applicationType
         */
        registerApplication: function(params, applicationType) {

            SDL.SDLModel.get('registeredApps')
                .pushObject(this.applicationModels[applicationType].create( {
                    appID: params.appID,
                    appName: params.appName,
                    deviceName: params.deviceName,
                    appType: params.appType
                }));
        },
        /**
         * Unregister application
         * 
         * @param {Number}
         *            appID
         */
        unregisterApplication: function(appID) {

            //this.getApplicationModel(appID).set('unregistered', true);
            this.getApplicationModel(appID).onDeleteApplication(appID);
            SDL.VRPopUp.DeleteActivateApp(appID);
            SDL.SDLAppController.set('model', null);
        },
        /**
         * SDL Driver Distraction ON/OFF switcher
         */
        selectDriverDistraction: function() {

            if (SDL.SDLModel.driverDistractionState) {
                FFW.UI.onDriverDistraction("DD_ON");
            } else {
                FFW.UI.onDriverDistraction("DD_OFF");
            }
        }.observes('SDL.SDLModel.driverDistractionState'),

        /**
         * Ondisplay keyboard event handler
         * Sends notification on SDL Core with changed value
         */
        onKeyboardChanges: function() {
            if (null !== SDL.SDLModel.keyboardInputValue) {

                var str = SDL.SDLModel.keyboardInputValue;

                if (SDL.SDLAppController.model.globalProperties.keyboardProperties.keypressMode) {
                    switch (SDL.SDLAppController.model.globalProperties.keyboardProperties.keypressMode) {
                        case 'SINGLE_KEYPRESS':{
                            FFW.UI.OnKeyboardInput(str.charAt( str.length-1 ));
                            break;
                        }
                        case 'QUEUE_KEYPRESS':{
                            break;
                        }
                        case 'RESEND_CURRENT_ENTRY':{
                            FFW.UI.OnKeyboardInput(str);
                            break;
                        }
                    }
                }
            }
        }.observes('SDL.SDLModel.keyboardInputValue'),

        /**
         * Get application model
         * 
         * @param {Number}
         */
        getApplicationModel: function(applicationId) {

            return SDL.SDLModel.registeredApps.filterProperty('appID',
                applicationId)[0];
        },
        /**
         * Function returns ChangeDeviceView back to previous state
         */
        turnChangeDeviceViewBack: function() {

            SDL.States.goToStates('info.apps');
        },
        /**
         * Enter screen vith list of devices application model
         */
        onGetDeviceList: function() {

            SDL.States.goToStates('info.devicelist');
            SDL.SDLModel.set('deviceSearchProgress', true);
        },
        /**
         * Send notification if device was choosed
         * 
         * @param element:
         *            SDL.Button
         */
        onDeviceChoosed: function(element) {

            SDL.SDLModel.set('CurrDeviceInfo.name', element.deviceName);
            SDL.SDLModel.set('CurrDeviceInfo.id', element.id);
            FFW.BasicCommunication.OnDeviceChosen(element.deviceName,
                element.id);
            this.turnChangeDeviceViewBack();
        },
        /**
         * Method creates list of Application ID's Then call HMI method for
         * display a list of Applications
         * 
         * @param {Object}
         */
        onGetAppList: function(appList) {

            SDL.SDLModel.onGetAppList(appList);
        },
        /**
         * Method call's request to get list of applications
         */
        findNewApps: function() {

            FFW.BasicCommunication.OnFindApplications();
        },
        /**
         * Method activates selected registered application
         * 
         * @param {Object}
         */
        onActivateSDLApp: function(element) {

            FFW.BasicCommunication.OnAppActivated(element.appID);
        },
        /**
         * Method sent custom softButtons pressed and event status to RPC
         * 
         * @param {Object}
         */
        onSoftButtonActionUpCustom: function(element) {

            if (element.time > 0) {
                FFW.Buttons.buttonEventCustom("CUSTOM_BUTTON",
                    "BUTTONUP",
                    element.softButtonID);
            } else {
                FFW.Buttons.buttonEventCustom("CUSTOM_BUTTON",
                    "BUTTONUP",
                    element.softButtonID);
                FFW.Buttons.buttonPressedCustom("CUSTOM_BUTTON",
                    "SHORT",
                    element.softButtonID);
            }
            clearTimeout(element.timer);
            element.time = 0;
        },
        /**
         * Method sent custom softButtons pressed and event status to RPC
         * 
         * @param {Object}
         */
        onSoftButtonActionDownCustom: function(element) {

            FFW.Buttons.buttonEventCustom("CUSTOM_BUTTON",
                "BUTTONDOWN",
                element.softButtonID);
            element.time = 0;
            element.timer = setTimeout(function() {

                FFW.Buttons.buttonPressedCustom("CUSTOM_BUTTON",
                    "LONG",
                    element.softButtonID);
                element.time++;
            }, 2000);
        },
        /**
         * Method sent softButtons pressed and event status to RPC
         * 
         * @param {String}
         * @param {Object}
         */
        onSoftButtonActionUp: function(element) {

            if (element.time > 0) {
                FFW.Buttons.buttonEvent(element.presetName, "BUTTONUP");
            } else {
                FFW.Buttons.buttonEvent(element.presetName, "BUTTONUP");
                FFW.Buttons.buttonPressed(element.presetName, "SHORT");
            }
            clearTimeout(element.timer);
            element.time = 0;
        },
        /**
         * Method sent softButtons Ok pressed and event status to RPC
         * 
         * @param {String}
         */
        onSoftButtonOkActionDown: function(name) {

            FFW.Buttons.buttonEvent(name, "BUTTONDOWN");
        },
        /**
         * Method sent softButton OK pressed and event status to RPC
         * 
         * @param {String}
         */
        onSoftButtonOkActionUp: function(name) {

            FFW.Buttons.buttonEvent(name, "BUTTONUP");
            FFW.Buttons.buttonPressed(name, "SHORT");
            if (SDL.SDLAppController.model) {
                SDL.SDLAppController.model.set('isPlaying',
                    !SDL.SDLAppController.model.isPlaying);
            }
        },
        /**
         * Method sent softButtons pressed and event status to RPC
         * 
         * @param {String}
         * @param {Object}
         */
        onSoftButtonActionDown: function(element) {

            FFW.Buttons.buttonEvent(element.presetName, "BUTTONDOWN");
            element.time = 0;
            element.timer = setTimeout(function() {

                FFW.Buttons.buttonPressed(element.presetName, "LONG");
                element.time++;
            }, 2000);
        },
        /**
         * Send system context
         */
        onSystemContextChange: function() {

            FFW.UI.OnSystemContext(this.get('sysContext'));
        }
    });