Skip to content

Commit

Permalink
Merge pull request #1 from LuxoftSDL/APPLINK-21614
Browse files Browse the repository at this point in the history
APPLINK-21614: GetWayPoints request and response implemented
  • Loading branch information
CallousOdesa committed Apr 6, 2016
2 parents b2357ed + 16c416d commit 172edbf
Show file tree
Hide file tree
Showing 27 changed files with 502 additions and 296 deletions.
62 changes: 62 additions & 0 deletions app/controller/NavigationController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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.NavigationController
* @desc Navigation module logic
* @category Controller
* @filesource app/controller/NavigationController.js
* @version 1.0
*/

SDL.NavigationController = Em.Object.create({

/**
* Model binding
*/
modelBinding: 'SDL.NavigationModel',

/**
* GetWayPoints request handler method
*
* @param {Object} request
*/
getWayPoint: function(request) {
if (model.appReqPull.indexOf(request.params.appID) == -1) {

model.appReqPull.push(request.params.appID);
setTimeout(function() {
FFW.Navigation.wayPointSend(SDL.SDLModel.data.resultCode.SUCCESS,
model.LocationDetails,
request.id);
model.appReqPull.
splice(model.appReqPull.indexOf(request.params.appID), 1);
},
model.wpProcessTime);
} else {
FFW.Navigation.wayPointSend(SDL.SDLModel.data.resultCode.IN_USE);
}
}
});
10 changes: 5 additions & 5 deletions app/controller/sdl/Abstract/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ SDL.ABSController = Em.Object.extend({
*/
VRPerformAction: function(element) {

SDL.SDLController.vrInteractionResponse(SDL.SDLModel.data.resultCode['SUCCESS'], element.commandID);
SDL.SDLController.vrInteractionResponse(SDL.SDLModel.data.resultCode.SUCCESS, element.commandID);

if (SDL.SDLModel.data.VRActive) {
SDL.SDLModel.data.toggleProperty('VRActive');
Expand Down Expand Up @@ -438,7 +438,7 @@ SDL.ABSController = Em.Object.extend({
if (FFW.TTS.aborted) {
FFW.TTS.sendError(SDL.SDLModel.data.resultCode['ABORTED'], FFW.TTS.requestId, 'TTS.Speak', 'TTS Speak request aborted');
} else {
FFW.TTS.sendTTSResult(SDL.SDLModel.data.resultCode['SUCCESS'], FFW.TTS.requestId, 'TTS.Speak');
FFW.TTS.sendTTSResult(SDL.SDLModel.data.resultCode.SUCCESS, FFW.TTS.requestId, 'TTS.Speak');
}
FFW.TTS.requestId = null;
FFW.TTS.aborted = false;
Expand Down Expand Up @@ -567,7 +567,7 @@ SDL.ABSController = Em.Object.extend({
}
if (methodName == 'UI.PerformAudioPassThru') {
SDL.AudioPassThruPopUp.deactivate();
this.performAudioPassThruResponse(SDL.SDLModel.data.resultCode['SUCCESS']);
this.performAudioPassThruResponse(SDL.SDLModel.data.resultCode.SUCCESS);
}
if (methodName == 'UI.PerformInteraction') {
SDL.InteractionChoicesView.deactivate('ABORTED');
Expand Down Expand Up @@ -696,7 +696,7 @@ SDL.ABSController = Em.Object.extend({
*/
scrollableMessageResponse: function(result, messageRequestId) {

if (result == SDL.SDLModel.data.resultCode['SUCCESS']) {
if (result == SDL.SDLModel.data.resultCode.SUCCESS) {
FFW.UI.sendUIResult(result,
messageRequestId,
'UI.ScrollableMessage');
Expand Down Expand Up @@ -748,7 +748,7 @@ SDL.ABSController = Em.Object.extend({
performAudioPassThruResponse: function(result) {

SDL.SDLModel.data.set('AudioPassThruState', false);
if (result === SDL.SDLModel.data.resultCode['SUCCESS']) {
if (result === SDL.SDLModel.data.resultCode.SUCCESS) {

FFW.UI.sendUIResult(result,
FFW.UI.performAudioPassThruRequestID,
Expand Down
86 changes: 47 additions & 39 deletions app/controller/sdl/RController.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,22 @@ SDL.RController = SDL.ABSController.extend({
ControlAccessAction: function(appID, value) {
if (value) {
FFW.RC.sendRCResult(
SDL.SDLModel.data.resultCode['SUCCESS'],
SDL.SDLModel.data.resultCode.SUCCESS,
SDL.SDLModel.controlRequestID,
'RC.GrantAccess'
);
SDL.SDLModel.set('givenControl', appID);
SDL.SDLModel.set('givenControlFlag', true);
//FFW.CAN.OnRadioDetails({"radioStation": SDL.RadioModel.radioDetails.radioStation});

FFW.RC.onInteriorVehicleDataNotification('RADIO', null, SDL.RadioModel.get('radioControlData'));
FFW.RC.onInteriorVehicleDataNotification(
'RADIO',
null,
SDL.RadioModel.get('radioControlData')
);
} else {
FFW.RC.sendError(
SDL.SDLModel.data.resultCode['REJECTED'],
SDL.SDLModel.dataresultCode.REJECTED,
SDL.SDLModel.controlRequestID,
'RC.GrantAccess',
'Request cancelled.'
Expand Down Expand Up @@ -89,7 +93,7 @@ SDL.RController = SDL.ABSController.extend({

/**
* Send notification to SDL about changes of SDL functionality
* @param element
* @param {Object} element
* @constructor
*/
OnReverseAppsAllowing: function(element) {
Expand Down Expand Up @@ -118,46 +122,50 @@ SDL.RController = SDL.ABSController.extend({

/**
* Register application method
*
* @param {Object}
* params
* @param {Number}
* applicationType
* @param {Object} params
* @param {Object} applicationType
*/
registerApplication: function(params, applicationType) {

if (applicationType === undefined || applicationType === null) {

SDL.SDLModel.data.get('registeredApps').pushObject(this.applicationModels[0].create({ //Magic number 0 - Default media model for not initialized applications
appID: params.appID,
appName: params.appName,
deviceName: params.deviceName,
appType: params.appType,
isMedia: 0,
disabledToActivate: params.greyOut ? true : false
}));
} else if (applicationType === 2) {//Magic number 2 - Default RC application with non-media model

SDL.SDLModel.data.get('registeredApps').pushObject(this.applicationModels[1].create({//Magic number 1 - Default non-media model
appID: params.appID,
appName: params.appName,
deviceName: params.deviceName,
appType: params.appType,
isMedia: false,
initialized: true,
disabledToActivate: params.greyOut ? true : false
}));
SDL.SDLModel.data.get('registeredApps').pushObject(
this.applicationModels[0].create({
//Magic number 0 - Default media model
// for not initialized applications
appID: params.appID,
appName: params.appName,
deviceName: params.deviceName,
appType: params.appType,
isMedia: 0,
disabledToActivate: params.greyOut ? true : false
}));
} else if (applicationType === 2) {
//Magic number 2 - Default RC application with non-media model

SDL.SDLModel.data.get('registeredApps').pushObject(
this.applicationModels[1].create({
//Magic number 1 - Default non-media model
appID: params.appID,
appName: params.appName,
deviceName: params.deviceName,
appType: params.appType,
isMedia: false,
initialized: true,
disabledToActivate: params.greyOut ? true : false
}));
} else {

SDL.SDLModel.data.get('registeredApps').pushObject(this.applicationModels[applicationType].create({
appID: params.appID,
appName: params.appName,
deviceName: params.deviceName,
appType: params.appType,
isMedia: applicationType == 0 ? true : false,
initialized: true,
disabledToActivate: params.greyOut ? true : false
}));
SDL.SDLModel.data.get('registeredApps').pushObject(
this.applicationModels[applicationType].create({
appID: params.appID,
appName: params.appName,
deviceName: params.deviceName,
appType: params.appType,
isMedia: applicationType == 0,
initialized: true,
disabledToActivate: params.greyOut ? true : false
}));
}

var exitCommand = {
Expand Down Expand Up @@ -305,7 +313,7 @@ SDL.RController = SDL.ABSController.extend({

if (request.params.moduleType === 'RADIO') {
if (SDL.RadioModel.consentedApp) {
FFW.RC.sendError(SDL.SDLModel.data.resultCode['REJECTED'], request.id, request.method, 'Already consented!');
FFW.RC.sendError(SDL.SDLModel.data.resultCode.REJECTED, request.id, request.method, 'Already consented!');
} else {
popUp = SDL.PopUp.create().appendTo('body').popupActivate(
'Would you like to grant access for ' + appName + ' application - moduleType: Radio?',
Expand All @@ -321,7 +329,7 @@ SDL.RController = SDL.ABSController.extend({
}
} else {
if (SDL.ClimateController.model.consentedApp) {
FFW.RC.sendError(SDL.SDLModel.data.resultCode['REJECTED'], request.id, request.method, 'Already consented!');
FFW.RC.sendError(SDL.SDLModel.data.resultCode.REJECTED, request.id, request.method, 'Already consented!');
} else {
popUp = SDL.PopUp.create().appendTo('body').popupActivate(
'Would you like to grant access for ' + appName + ' application - moduleType: Climate?',
Expand Down
Loading

0 comments on commit 172edbf

Please sign in to comment.