Skip to content

Implemented Missing RPC APIs #121

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

Merged
merged 4 commits into from
Mar 9, 2015
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public class FunctionID {
public static final String SLIDER = "Slider";
public static final String ON_LOCK_SCREEN_STATUS = "OnLockScreenStatus";
public static final String ON_SDL_CHOICE_CHOSEN = "OnSdlChoiceChosen";

public static final String SEND_LOCATION = "SendLocation";

public FunctionID() {
}
Expand Down Expand Up @@ -141,6 +143,7 @@ static public void initFunctionIds() {
put(FunctionID.SET_DISPLAY_LAYOUT, 36);
put(FunctionID.DIAGNOSTIC_MESSAGE, 37);
put(FunctionID.SYSTEM_REQUEST, 38);
put(FunctionID.SEND_LOCATION, 39);

/*
Base Notifications
Expand Down
139 changes: 139 additions & 0 deletions sdl_android_lib/src/com/smartdevicelink/proxy/rpc/AlertManeuver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package com.smartdevicelink.proxy.rpc;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;

/**
* This will bring up an alert with information related to the next navigation maneuver including potential voice
* navigation instructions. Shown information will be taken from the ShowConstantTBT function
* <p>
* Function Group: Navigation
* <p>
* <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
* <p>
*
* @since SmartDeviceLink 2.0
* @see ShowConstantTbt
*/
public class AlertManeuver extends RPCRequest{

public static final String KEY_TTS_CHUNKS = "ttsChunks";
public static final String KEY_SOFT_BUTTONS = "softButtons";

/**
* Constructs a new AlertManeuver object
*/
public AlertManeuver(){
super(FunctionID.ALERT_MANEUVER);
}

/**
* <p>
* Constructs a new AlertManeuver object indicated by the Hashtable parameter
* </p>
*
* @param hash
* The Hashtable to use
*/
public AlertManeuver(Hashtable<String, Object> hash){
super(hash);
}

/**
* Gets the SoftButton List object
*
* @return List<SoftButton> -a List<SoftButton> representing the List object
* @since SmartDeviceLink 2.0
*/
@SuppressWarnings("unchecked")
public List<SoftButton> getSoftButtons(){
if(parameters.get(KEY_SOFT_BUTTONS) instanceof List<?>){
List<?> list = (List<?>) parameters.get(KEY_SOFT_BUTTONS);
if(list != null && list.size() > 0){
Object obj = list.get(0);
if(obj instanceof SoftButton){
return (List<SoftButton>) list;
}
else if(obj instanceof Hashtable){
List<SoftButton> newList = new ArrayList<SoftButton>();
for(Object hashObj : list){
newList.add(new SoftButton((Hashtable<String, Object>) hashObj));
}
return newList;
}
}
}
return null;
}

/**
* Sets the SoftButtons
*
* @param softButtons
* a List<SoftButton> value
* <p>
* <b>Notes: </b><br/>
* <ul>
* <li>If omitted on supported displays, the alert will not have any SoftButton</li>
* <li>ArrayMin: 0</li>
* <li>ArrayMax: 4</li>
* </ul>
* @since SmartDeviceLink 2.0
*/

public void setSoftButtons(List<SoftButton> softButtons){
if(softButtons != null){
parameters.put(KEY_SOFT_BUTTONS, softButtons);
}
else{
parameters.remove(KEY_SOFT_BUTTONS);
}
}

/**
* Gets TTSChunk[], the Array of type TTSChunk which, taken together, specify what is to be spoken to the user
*
* @return List -a List<TTSChunk> value specify what is to be spoken to the user
*/
@SuppressWarnings("unchecked")
public List<TTSChunk> getTtsChunks(){
if(parameters.get(KEY_TTS_CHUNKS) instanceof List<?>){
List<?> list = (List<?>) parameters.get(KEY_TTS_CHUNKS);
if(list != null && list.size() > 0){
Object obj = list.get(0);
if(obj instanceof TTSChunk){
return (List<TTSChunk>) list;
}
else if(obj instanceof Hashtable){
List<TTSChunk> newList = new ArrayList<TTSChunk>();
for(Object hashObj : list){
newList.add(new TTSChunk((Hashtable<String, Object>) hashObj));
}
return newList;
}
}
}
return null;
}

/**
* Sets array of type TTSChunk which, taken together, specify what is to be spoken to the user
*
* @param ttsChunks
* <p>
* <b>Notes: </b>Array must have a least one element
*/
public void setTtsChunks(List<TTSChunk> ttsChunks){
if(ttsChunks != null){
parameters.put(KEY_TTS_CHUNKS, ttsChunks);
}
else{
parameters.remove(KEY_TTS_CHUNKS);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package com.smartdevicelink.proxy.rpc;

import java.util.Hashtable;

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCResponse;

/**
* Alert Maneuver Response is sent, when AlertManeuver has been called
*
* @since SmartDeviceLink 2.0
*/
public class AlertManeuverResponse extends RPCResponse{

/**
* Constructs a new AlertManeuverResponse object
*/
public AlertManeuverResponse() {
super(FunctionID.ALERT_MANEUVER);
}

/**
* <p>
* Constructs a new AlertManeuverResponse object indicated by the Hashtable
* parameter
* </p>
*
* @param hash
* The Hashtable to use
*/
public AlertManeuverResponse(Hashtable<String, Object> hash) {
super(hash);
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.smartdevicelink.proxy.rpc;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;

import com.smartdevicelink.protocol.enums.FunctionID;
import com.smartdevicelink.proxy.RPCRequest;
Expand All @@ -23,7 +25,11 @@
*/
public class ChangeRegistration extends RPCRequest {
public static final String KEY_LANGUAGE = "language";
public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
public static final String KEY_HMI_DISPLAY_LANGUAGE = "hmiDisplayLanguage";
public static final String KEY_APP_NAME = "appName";
public static final String KEY_TTS_NAME = "ttsName";
public static final String KEY_NGN_MEDIA_SCREEN_NAME = "ngnMediaScreenAppName";
public static final String KEY_VR_SYNONYMS = "vrSynonyms";

/**
* Constructs a new ChangeRegistration object
Expand Down Expand Up @@ -113,4 +119,136 @@ public Language getHmiDisplayLanguage() {
}
return null;
}

/**
* Sets app name
*
* @param appName App name to set
*/
public void setAppName(String appName){
if(appName != null){
parameters.put(KEY_APP_NAME, appName);
}
else{
parameters.remove(KEY_APP_NAME);
}
}

/**
* Gets app name
*
* @return The app name
*/
public String getAppName(){
return (String) parameters.get(KEY_APP_NAME);
}

/**
* Sets NGN media screen app name
*
* @param ngnAppName The NGN app name
*/
public void setNgnMediaScreenAppName(String ngnAppName){
if(ngnAppName != null){
parameters.put(KEY_NGN_MEDIA_SCREEN_NAME, ngnAppName);
}
else{
parameters.remove(KEY_NGN_MEDIA_SCREEN_NAME);
}
}

/**
* Gets NGN media screen app name
*
* @return The NGN app name
*/
public String getNgnMediaScreenAppName(){
return (String) parameters.get(KEY_NGN_MEDIA_SCREEN_NAME);
}

/**
* Sets the TTS name
*
* @param ttsName The TTS name to set
*/
public void setTtsName(List<TTSChunk> ttsName){
if(ttsName != null){
parameters.put(KEY_TTS_NAME, ttsName);
}
else{
parameters.remove(KEY_TTS_NAME);
}
}

/**
* Gets the TTS name
*
* @return The TTS name
*/
@SuppressWarnings("unchecked")
public List<TTSChunk> getTtsName(){
if (parameters.get(KEY_TTS_NAME) instanceof List<?>) {
List<?> list = (List<?>)parameters.get(KEY_TTS_NAME);
if (list != null && list.size() > 0) {
Object obj = list.get(0);
if (obj instanceof TTSChunk) {
return (List<TTSChunk>) list;
} else if (obj instanceof Hashtable) {
List<TTSChunk> newList = new ArrayList<TTSChunk>();
for (Object hashObj : list) {
newList.add(new TTSChunk((Hashtable<String, Object>)hashObj));
}
return newList;
}
}
}
return null;
}

/**
* Gets the List<String> representing the an array of 1-100 elements, each
* element containing a voice-recognition synonym
*
* @return List<String> -a List value representing the an array of
* 1-100 elements, each element containing a voice-recognition
* synonym
*/
@SuppressWarnings("unchecked")
public List<String> getVrSynonyms() {
if (parameters.get(KEY_VR_SYNONYMS) instanceof List<?>) {
List<?> list = (List<?>)parameters.get(KEY_VR_SYNONYMS);
if (list != null && list.size()>0) {
Object obj = list.get(0);
if (obj instanceof String) {
return (List<String>) list;
}
}
}
return null;
}

/**
* Sets a vrSynonyms representing the an array of 1-100 elements, each
* element containing a voice-recognition synonym
*
* @param vrSynonyms
* a List<String> value representing the an array of 1-100
* elements
* <p>
* <b>Notes: </b>
* <ul>
* <li>Each vr synonym is limited to 40 characters, and there can
* be 1-100 synonyms in array</li>
* <li>May not be the same (by case insensitive comparison) as
* the name or any synonym of any currently-registered
* application</li>
* </ul>
*/
public void setVrSynonyms(List<String> vrSynonyms) {
if (vrSynonyms != null) {
parameters.put(KEY_VR_SYNONYMS, vrSynonyms);
} else {
parameters.remove(KEY_VR_SYNONYMS);
}
}
}
Loading