Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UNSUPPORTED_RESOURCE result code for images #450

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/controller/sdl/Abstract/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,15 @@ SDL.SDLController = Em.Object.extend(
* Method to sent notification ABORTED for PerformInteractionChoise
*/
interactionChoiseCloseResponse: function(appID, result, choiceID,
manualTextEntry) {
manualTextEntry, info) {
FFW.UI.interactionResponse(
SDL.SDLController.getApplicationModel(
appID
).activeRequests.uiPerformInteraction, result, choiceID, manualTextEntry
).activeRequests.uiPerformInteraction,
result,
choiceID,
manualTextEntry,
info
);
SDL.SDLModel.data.set('interactionData.vrHelpTitle', null);
SDL.SDLModel.data.set('interactionData.vrHelp', null);
Expand Down
2 changes: 1 addition & 1 deletion app/controller/sdl/RPCController.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ SDL.RPCController = Em.Object.create(
capabilitiesCheck: function(key, value) {
if (key == 'imageType' && value == 'STATIC') {
SDL.RPCController.capabilityCheckResult = {
code: SDL.SDLModel.data.resultCode['WARNINGS'],
code: SDL.SDLModel.data.resultCode['UNSUPPORTED_RESOURCE'],
type: value
};
}
Expand Down
6 changes: 4 additions & 2 deletions app/model/sdl/Abstract/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1453,10 +1453,12 @@ SDL.SDLModel = Em.Object.extend({
SDL.TTSPopUp.ActivateTTS(message, files, appID);
} else {
FFW.TTS.sendError(
SDL.SDLModel.data.resultCode.WARNINGS, this.requestId, 'TTS.Speak',
SDL.SDLModel.data.resultCode.WARNINGS,
FFW.TTS.requestId,
'TTS.Speak',
'No TTS Chunks provided in Speak request'
);
this.requestId = null;
FFW.TTS.requestId = null;
}
},

Expand Down
1 change: 0 additions & 1 deletion app/view/sdl/TTSPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ SDL.TTSPopUp = Em.ContainerView.create(
'checkBoxLabel',
'checkBox'
],
requestId: null,
content: 'Messaage',
active: false,
timer: null,
Expand Down
48 changes: 45 additions & 3 deletions app/view/sdl/shared/interactionChoicesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create(
search: false,
list: false,
icon: false,
areAllImagesValid: true,
/**
* Id of app initiated performInteraction request
*/
Expand Down Expand Up @@ -172,6 +173,7 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create(
this.set('caption', message.params.initialText.fieldText);
}
this.appID = message.params.appID;
this.set('areAllImagesValid', true);
if (message.params.interactionLayout) {
switch (message.params.interactionLayout) {
case 'ICON_ONLY' :
Expand Down Expand Up @@ -266,18 +268,25 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create(
this.set('active', false);
SDL.SDLController.VRMove();
SDL.Keyboard.deactivate();

if (!this.areAllImagesValid && result == 'SUCCESS') {
result = 'WARNINGS';
}

switch (result) {
case 'ABORTED':
{
SDL.SDLController.interactionChoiseCloseResponse(
this.appID, SDL.SDLModel.data.resultCode['ABORTED']
this.appID, SDL.SDLModel.data.resultCode['ABORTED'], null, null,
"UI.PerformInteraction has been aborted"
);
break;
}
case 'TIMED_OUT':
{
SDL.SDLController.interactionChoiseCloseResponse(
this.appID, SDL.SDLModel.data.resultCode['TIMED_OUT']
this.appID, SDL.SDLModel.data.resultCode['TIMED_OUT'], null, null,
"UI.PerformInteraction has been timed out"
);
break;
}
Expand All @@ -291,9 +300,10 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create(
}
case 'WARNINGS':
{
const info = !this.areAllImagesValid ? "Requested image(s) not found" : null;
SDL.SDLController.interactionChoiseCloseResponse(
this.appID, SDL.SDLModel.data.resultCode.WARNINGS, choiceID,
this.input.value
this.input.value, info
);
break;
}
Expand Down Expand Up @@ -335,6 +345,7 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create(
preformChoices: function(data, timeout) {
this.set('timeout', timeout);
if (data) {
var imageList = [];

// temp for testing
for (var i = 0; i < data.length; i++) {
Expand All @@ -353,7 +364,22 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create(
}
}
);

if (data[i].image) {
imageList.push(data[i].image.value);
}
}

var model = SDL.SDLController.getApplicationModel(this.appID);
if (model){
var that = this;
var callback = function(failed) {
that.set('areAllImagesValid', !failed);
};

SDL.SDLModel.validateImages(model.activeRequests.uiPerformInteraction, callback, imageList);
}

this.listOfChoices.list.refresh();
}
var self = this;
Expand All @@ -379,6 +405,7 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create(
preformChoicesNavigation: function(data, timeout) {
this.set('timeout', timeout);
if (data) {
var imageList = [];

// temp for testing
for (var i = 0; i < data.length; i++) {
Expand All @@ -401,8 +428,23 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create(
}
)
);

if (data[i].image) {
imageList.push(data[i].image.value);
}
}

var model = SDL.SDLController.getApplicationModel(this.appID);
if (model){
var that = this;
var callback = function(failed) {
that.set('areAllImagesValid', !failed);
};

SDL.SDLModel.validateImages(model.activeRequests.uiPerformInteraction, callback, imageList);
}
}

var self = this;
setTimeout(
function() {
Expand Down
80 changes: 3 additions & 77 deletions ffw/NavigationRPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,75 +218,17 @@ FFW.Navigation = FFW.RPCObserver.create(
}
case 'Navigation.AlertManeuver':
{

// Verify if there is an unsupported data in request
if (this.errorResponsePull[request.id] != null) {
//
////Check if there is any available data to process the request
//if ("softButtons" in request.params) {
//
// this.errorResponsePull[request.id].code =
// SDL.SDLModel.data.resultCode["WARNINGS"]; } else { If no
// available data sent error response and stop process current
// request
this.sendError(
this.errorResponsePull[
request.id].code,
request.id,
request.method,
'Unsupported ' + this.errorResponsePull[request.id].type +
' type. Request was not processed.'
);
this.errorResponsePull[request.id] = null;
return;
//}
}
SDL.AlertManeuverPopUp.AlertManeuverActive(request)
break;
}
case 'Navigation.ShowConstantTBT':
{

// Verify if there is an unsupported data in request
if (this.errorResponsePull[request.id] != null) {
this.sendError(
this.errorResponsePull[
request.id].code,
request.id,
request.method,
'Unsupported ' + this.errorResponsePull[request.id].type +
' type. Request was not processed.'
);
this.errorResponsePull[request.id] = null;
} else {
SDL.NavigationController.validateIcons(request);
SDL.SDLModel.tbtActivate(request.params);
}
SDL.NavigationController.validateIcons(request);
SDL.SDLModel.tbtActivate(request.params);
break;
}
case 'Navigation.UpdateTurnList':
{

// Verify if there is an unsupported data in request
if (this.errorResponsePull[request.id] != null) {
//
////Check if there is any available data to process the request
//if ("turnList" in request.params || "softButtons" in
// request.params) { this.errorResponsePull[request.id].code =
// SDL.SDLModel.data.resultCode["WARNINGS"]; } else { If no
// available data sent error response and stop process current
// request
this.sendError(
this.errorResponsePull[
request.id].code,
request.id,
request.method,
'Unsupported ' + this.errorResponsePull[request.id].type +
' type. Request was not processed.'
);
this.errorResponsePull[request.id] = null;
//}
}
SDL.NavigationController.validateIcons(request);
SDL.SDLModel.tbtTurnListUpdate(request.params);
break;
Expand Down Expand Up @@ -428,23 +370,7 @@ FFW.Navigation = FFW.RPCObserver.create(
}
case 'Navigation.SendLocation':
{

// Verify if there is an unsupported data in request
if (this.errorResponsePull[request.id] != null) {
this.sendError(
this.errorResponsePull[
request.id].code,
request.id,
request.method,
'Unsupported ' + this.errorResponsePull[request.id].type +
' type. Request was not processed.'
);
this.errorResponsePull[request.id] = null;
//this.errorResponsePull[request.id].code =
// SDL.SDLModel.data.resultCode["WARNINGS"];
} else {
SDL.NavigationController.sendLocation(request);
}
SDL.NavigationController.sendLocation(request);
break;
}
}
Expand Down
56 changes: 1 addition & 55 deletions ffw/TTSRPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,6 @@ FFW.TTS = FFW.RPCObserver.create(
switch (request.method) {
case 'TTS.Speak':
{

// Verify if there is an unsupported data in request
if (this.errorResponsePull[request.id] != null) {
//
////Check if there is any available data to process the request
if (!('ttsChunks' in request.params)) {
//
// this.errorResponsePull[request.id].code =
// SDL.SDLModel.data.resultCode["WARNINGS"]; } else { If no
// available data sent error response and stop process current
// request
this.sendError(
this.errorResponsePull[request.id].code, request.id,
request.method,
'Unsupported ' + this.errorResponsePull[request.id].type +
' type. Request was not processed.'
);
this.errorResponsePull[request.id] = null;
//
return;
}
}
if (SDL.TTSPopUp.active) {
FFW.TTS.sendError(
SDL.SDLModel.data.resultCode.REJECTED, request.id, 'TTS.Speak',
Expand All @@ -185,30 +163,14 @@ FFW.TTS = FFW.RPCObserver.create(
}
case 'TTS.SetGlobalProperties':
{

// Verify if there is an unsupported data in request
//if (this.errorResponsePull[request.id] != null) {
//
////Check if there is any available data to process the request
//if ("helpPrompt" in request.params
// || "timeoutPrompt" in request.params) {
//
// this.errorResponsePull[request.id].code =
// SDL.SDLModel.data.resultCode["WARNINGS"]; } else { If no available
// data sent error response and stop process current request
// this.sendError(this.errorResponsePull[request.id].code,
// request.id, request.method, "Unsupported " +
// this.errorResponsePull[request.id].type + " type. Request was not
// processed."); this.errorResponsePull[request.id] = null; return;
// } }
resultCode = FFW.RPCHelper.getCustomResultCode(request.params.appID, 'ttsSetGlobalProperties');
if ('DO_NOT_RESPOND' == resultCode) {
Em.Logger.log('Do not respond on this request');
return;
}

let info = null;

if(FFW.RPCHelper.isSuccessResultCode(resultCode)){
SDL.SDLModel.setProperties(request.params);
} else {
Expand Down Expand Up @@ -295,22 +257,6 @@ FFW.TTS = FFW.RPCObserver.create(
}
case 'TTS.ChangeRegistration':
{

// Verify if there is an unsupported data in request
//if (this.errorResponsePull[request.id] != null) {
//
////Check if there is any available data to process the request
//if ("ttsName" in request.params
// || "language" in request.params) {
//
// this.errorResponsePull[request.id].code =
// SDL.SDLModel.data.resultCode["WARNINGS"]; } else { If no available
// data sent error response and stop process current request
// this.sendError(this.errorResponsePull[request.id].code,
// request.id, request.method, "Unsupported " +
// this.errorResponsePull[request.id].type + " type. Request was not
// processed."); this.errorResponsePull[request.id] = null; return; }
// }
SDL.SDLModel.changeRegistrationTTSVR(
request.params.language, request.params.appID
);
Expand Down
Loading