com.smartdevicelink.proxy.rpc.NavigationInstruction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sdl_java_se Show documentation
Show all versions of sdl_java_se Show documentation
The app library component of SDL is meant to run on the end userâs smart-device from within SDL enabled apps, as an embedded app, or connected to the cloud. App libraries allow the apps to connect to SDL enabled head-units and hardware through bluetooth, USB, and TCP for Android, and cloud and embedded apps can connect through web sockets, Java Beans, and other custom transports. Once the library establishes a connection between the smart device and head-unit through the preferred method of transport, the two components are able to communicate using the SDL defined protocol. The app integrating this library project is then able to expose its functionality to the head-unit through text, media, and other interactive elements.
/*
* Copyright (c) 2019 Livio, Inc.
* 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 Livio Inc. 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.
*/
package com.smartdevicelink.proxy.rpc;
import androidx.annotation.NonNull;
import com.smartdevicelink.proxy.RPCStruct;
import com.smartdevicelink.proxy.rpc.enums.Direction;
import com.smartdevicelink.proxy.rpc.enums.NavigationAction;
import com.smartdevicelink.proxy.rpc.enums.NavigationJunction;
import java.util.Hashtable;
public class NavigationInstruction extends RPCStruct {
public static final String KEY_LOCATION_DETAILS = "locationDetails";
public static final String KEY_ACTION = "action";
public static final String KEY_ETA = "eta";
public static final String KEY_BEARING = "bearing";
public static final String KEY_JUNCTION_TYPE = "junctionType";
public static final String KEY_DRIVING_SIDE = "drivingSide";
public static final String KEY_DETAILS = "details";
public static final String KEY_IMAGE = "image";
// Constructors
public NavigationInstruction() {
}
public NavigationInstruction(Hashtable hash) {
super(hash);
}
public NavigationInstruction(@NonNull LocationDetails locationDetails, @NonNull NavigationAction action) {
this();
setLocationDetails(locationDetails);
setAction(action);
}
// Setters and Getters
/**
* @param locationDetails -
*/
public NavigationInstruction setLocationDetails(@NonNull LocationDetails locationDetails) {
setValue(KEY_LOCATION_DETAILS, locationDetails);
return this;
}
/**
* @return locationDetails
*/
public LocationDetails getLocationDetails() {
return (LocationDetails) getObject(LocationDetails.class, KEY_LOCATION_DETAILS);
}
/**
* @param action -
*/
public NavigationInstruction setAction(@NonNull NavigationAction action) {
setValue(KEY_ACTION, action);
return this;
}
/**
* @return action
*/
public NavigationAction getAction() {
return (NavigationAction) getObject(NavigationAction.class, KEY_ACTION);
}
/**
* @param eta -
*/
public NavigationInstruction setEta(DateTime eta) {
setValue(KEY_ETA, eta);
return this;
}
/**
* @return eta
*/
public DateTime getEta() {
return (DateTime) getObject(DateTime.class, KEY_ETA);
}
/**
* The angle at which this instruction takes place. For example, 0 would mean straight, <=45
* is bearing right, >= 135 is sharp right, between 45 and 135 is a regular right, and 180 is
* a U-Turn, etc.
*
* @param bearing - minValue="0" maxValue="359"
*/
public NavigationInstruction setBearing(Integer bearing) {
setValue(KEY_BEARING, bearing);
return this;
}
/**
* The angle at which this instruction takes place. For example, 0 would mean straight, <=45
* is bearing right, >= 135 is sharp right, between 45 and 135 is a regular right, and 180 is
* a U-Turn, etc.
*
* @return bearing - minValue="0" maxValue="359"
*/
public Integer getBearing() {
return getInteger(KEY_BEARING);
}
/**
* @param junctionType -
*/
public NavigationInstruction setJunctionType(NavigationJunction junctionType) {
setValue(KEY_JUNCTION_TYPE, junctionType);
return this;
}
/**
* @return junctionType
*/
public NavigationJunction getJunctionType() {
return (NavigationJunction) getObject(NavigationJunction.class, KEY_JUNCTION_TYPE);
}
/**
* Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this
* will determine which direction the turn should take place.
*
* @param drivingSide - Direction enum value that represents the driving side
*/
public NavigationInstruction setDrivingSide(Direction drivingSide) {
setValue(KEY_DRIVING_SIDE, drivingSide);
return this;
}
/**
* Used to infer which side of the road this instruction takes place. For a U-Turn (action=TURN, bearing=180) this
* will determine which direction the turn should take place.
*
* @return drivingSide
*/
public Direction getDrivingSide() {
return (Direction) getObject(Direction.class, KEY_DRIVING_SIDE);
}
/**
* This is a string representation of this instruction, used to display instructions to the
* users. This is not intended to be read aloud to the users, see the param prompt in
* NavigationServiceData for that.
*
* @param details -
*/
public NavigationInstruction setDetails(String details) {
setValue(KEY_DETAILS, details);
return this;
}
/**
* This is a string representation of this instruction, used to display instructions to the
* users. This is not intended to be read aloud to the users, see the param prompt in
* NavigationServiceData for that.
*
* @return details
*/
public String getDetails() {
return getString(KEY_DETAILS);
}
/**
* An image representation of this instruction.
*
* @param image -
*/
public NavigationInstruction setImage(Image image) {
setValue(KEY_IMAGE, image);
return this;
}
/**
* An image representation of this instruction.
*
* @return image
*/
public Image getImage() {
return (Image) getObject(Image.class, KEY_IMAGE);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy