diff options
author | Joey Grover <joeygrover@gmail.com> | 2016-11-01 16:56:11 -0400 |
---|---|---|
committer | Joey Grover <joeygrover@gmail.com> | 2016-11-01 16:56:11 -0400 |
commit | a0ac7b22634788cf0d40b275324231559ac86d0c (patch) | |
tree | 94235c98b5717054e0a0c2a9032b70a692f04d06 | |
parent | d74df176d73daabec1558e9b88a0e285680a04b8 (diff) | |
parent | f0821b3e1146e19c026495792e691465675f7a6f (diff) | |
download | sdl_android-a0ac7b22634788cf0d40b275324231559ac86d0c.tar.gz |
Merge branch 'feature/sendlocation_updates' of https://github.com/smartdevicelink/sdl_android into develop
# Conflicts:
# sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OasisAddress.java
4 files changed, 459 insertions, 2 deletions
diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DateTime.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DateTime.java new file mode 100644 index 000000000..aeb302ffb --- /dev/null +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/DateTime.java @@ -0,0 +1,251 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; + +import java.util.Hashtable; + +public class DateTime extends RPCStruct{ + public static final String KEY_MILLISECOND = "millisecond"; + public static final String KEY_SECOND = "second"; + public static final String KEY_MINUTE = "minute"; + public static final String KEY_HOUR = "hour"; + public static final String KEY_DAY = "day"; + public static final String KEY_MONTH = "month"; + public static final String KEY_YEAR = "year"; + public static final String KEY_TZ_HOUR = "tz_hour"; + public static final String KEY_TZ_MINUTE = "tz_minute"; + + public DateTime() { + } + + public DateTime(Hashtable<String, Object> hash) { + super(hash); + } + + + /** + * Gets the Milliseconds portion of the DateTime class + * + * @return Integer - Milliseconds associated with this DateTime class + * + */ + public Integer getMilliSecond() { + return (Integer) store.get(KEY_MILLISECOND); + } + + /** + * Sets the Milliseconds portion of the DateTime class + * + * @param milliSecond + * The milliseconds associated with this DateTime class + * + */ + public void setMilliSecond(Integer milliSecond) { + if (milliSecond != null) { + store.put(KEY_MILLISECOND, milliSecond); + } else { + store.remove(KEY_MILLISECOND); + } + } + + + /** + * Gets the Seconds portion of the DateTime class + * + * @return Integer - Seconds associated with this DateTime class + * + */ + public Integer getSecond() { + return (Integer) store.get(KEY_SECOND); + } + + /** + * Sets the Seconds portion of the DateTime class + * + * @param second + * The Seconds associated with this DateTime class + * + */ + public void setSecond(Integer second) { + if (second != null) { + store.put(KEY_SECOND, second); + } else { + store.remove(KEY_SECOND); + } + } + + + /** + * Gets the Minutes portion of the DateTime class + * + * @return Integer - Minutes associated with this DateTime class + * + */ + public Integer getMinute() { + return (Integer) store.get(KEY_MINUTE); + } + + /** + * Sets the Minutes portion of the DateTime class + * + * @param minute + * The Minutes associated with this DateTime class + * + */ + public void setMinute(Integer minute) { + if (minute != null) { + store.put(KEY_MINUTE, minute); + } else { + store.remove(KEY_MINUTE); + } + } + + /** + * Gets the Hours portion of the DateTime class. + * + * @return Integer - Hours associated with this DateTime class. + * + */ + public Integer getHour() { + return (Integer) store.get(KEY_HOUR); + } + + /** + * Sets the Hours portion of the DateTime class. + * + * @param hour + * The Hours associated with this DateTime class. This structure is used to store hours in a 24 hour format. + * + */ + public void setHour(Integer hour) { + if (hour != null) { + store.put(KEY_HOUR, hour); + } else { + store.remove(KEY_HOUR); + } + } + + /** + * Gets the Day portion of the DateTime class. + * + * @return Integer - Day of the month associated with this DateTime class + * + */ + public Integer getDay() { + return (Integer) store.get(KEY_DAY); + } + + /** + * Sets the Day portion of the DateTime class + * + * @param day + * The Day of the month associated with this DateTime class + * + */ + public void setDay(Integer day) { + if (day != null) { + store.put(KEY_DAY, day); + } else { + store.remove(KEY_DAY); + } + } + + /** + * Gets the Month portion of the DateTime class. + * + * @return Integer - Month of the year associated with this DateTime class + * + */ + public Integer getMonth() { + return (Integer) store.get(KEY_MONTH); + } + + /** + * Sets the Month portion of the DateTime class + * + * @param month + * The Month of the year associate with this DateTime class + * + */ + public void setMonth(Integer month) { + if (month != null) { + store.put(KEY_MONTH, month); + } else { + store.remove(KEY_MONTH); + } + } + + /** + * Gets the Year portion of the DateTime class. + * + * @return Integer - The year in YYYY format associated with this DateTime class + * + */ + public Integer getYear() { + return (Integer) store.get(KEY_YEAR); + } + + /** + * Sets the Year portion of the DateTime class + * + * @param year + * The Year in YYYY format associated with this DateTime class + * + */ + public void setYear(Integer year) { + if (year != null) { + store.put(KEY_YEAR, year); + } else { + store.remove(KEY_YEAR); + } + } + + /** + * Gets the Time Zone Hours portion of the DateTime class. + * + * @return Integer - The time zone offset in Hours with regard to UTC time associated with this DateTime class + * + */ + public Integer getTzHour() { + return (Integer) store.get(KEY_TZ_HOUR); + } + + /** + * Sets the Time Zone Hours portion of the DateTime class + * + * @param tzHour + * The time zone offset in Hours with regard to UTC time associated with this DateTime class + * + */ + public void setTzHour(Integer tzHour) { + if (tzHour != null) { + store.put(KEY_TZ_HOUR, tzHour); + } else { + store.remove(KEY_TZ_HOUR); + } + } + + /** + * Gets the Time Zone Minutes portion of the DateTime class. + * + * @return Integer - The time zone offset in minutes with regard to UTC associated with this DateTime class + * + */ + public Integer getTzMinute() { + return (Integer) store.get(KEY_TZ_MINUTE); + } + + /** + * Sets the Time Zone Minutes portion of the DateTime class + * + * @param tzMinute + * The time zone offset in Minutes with regard to UTC associated with this DateTime class + */ + public void setTzMinute(Integer tzMinute) { + if (tzMinute != null) { + store.put(KEY_TZ_MINUTE, tzMinute); + } else { + store.remove(KEY_TZ_MINUTE); + } + } +} diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OasisAddress.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OasisAddress.java index a20086c35..131edaa9a 100644 --- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OasisAddress.java +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/OasisAddress.java @@ -15,6 +15,12 @@ public class OasisAddress extends RPCStruct{ public static final String KEY_THOROUGH_FARE = "thoroughfare"; public static final String KEY_SUB_THOROUGH_FARE = "subThoroughfare"; + /** + * OASIS Address - A standard based address class that has been established by The Organization for the Advancement of Structured Information Standards (OASIS). + * Oasis is a global nonprofit consortium that works on the development, convergence, and adoption of standards for security, + * Internet of Things, energy, content technologies, emergency management, and other areas. + * + */ public OasisAddress() { } @@ -22,10 +28,23 @@ public class OasisAddress extends RPCStruct{ super(hash); } + /** + * Gets the localized Name of the country associated with the OasisAddress class. + * + * @return String - The localized Name of the country associated with the OasisAddress class. + * + */ public String getCountryName() { return (String) store.get(KEY_COUNTRY_NAME); } + /** + * Sets the localized Name of the country associated with the OasisAddress class. + * + * @param countryName + * The localized Name of the country associated with the OasisAddress class. + * + */ public void setCountryName(String countryName) { if (countryName != null) { store.put(KEY_COUNTRY_NAME, countryName); @@ -34,10 +53,23 @@ public class OasisAddress extends RPCStruct{ } } + /** + * Gets the country code in ISO 3166-2 format associated with the OasisAddress class. + * + * @return String - The country code in ISO 3166-2 format associated with the OasisAddress class. + * + */ public String getCountryCode() { return (String) store.get(KEY_COUNTRY_CODE); } + /** + * Sets the country code in ISO 3166-2 format associated with the OasisAddress class. + * + * @param countryCode + * The country code in ISO 3166-2 format associated with the OasisAddress class. + * + */ public void setCountryCode(String countryCode) { if (countryCode != null) { store.put(KEY_COUNTRY_CODE, countryCode); @@ -46,10 +78,23 @@ public class OasisAddress extends RPCStruct{ } } + /** + * Gets the Postal Code associated with the OasisAddress class. + * + * @return String - The Postal Code associated with the OasisAddress class. + * + */ public String getPostalCode() { return (String) store.get(KEY_POSTAL_CODE); } + /** + * Sets the Postal Code associated with the OasisAddress class. + * + * @param postalCode + * The Postal Code associated with the OasisAddress class. + * + */ public void setPostalCode(String postalCode) { if (postalCode != null) { store.put(KEY_POSTAL_CODE, postalCode); @@ -58,10 +103,23 @@ public class OasisAddress extends RPCStruct{ } } + /** + * Gets the Administrative Area associated with the OasisAddress class. A portion of the country - Administrative Area's can include details of the top-level area division in the country, such as state, district, province, island, region, etc. + * + * @return String - The Administrative Area associated with the OasisAddress class. + * + */ public String getAdministrativeArea() { return (String) store.get(KEY_ADMINISTRATIVE_AREA); } + /** + * Sets the Administrative Area associated with the OasisAddress class. A portion of the country - Administrative Area can include details of the top-level area division in the country, such as state, district, province, island, region, etc. + * + * @param administrativeArea + * The Administrative Area associated with the OasisAddress class. + * + */ public void setAdministrativeArea(String administrativeArea) { if (administrativeArea != null) { store.put(KEY_ADMINISTRATIVE_AREA, administrativeArea); @@ -70,10 +128,23 @@ public class OasisAddress extends RPCStruct{ } } + /** + * Gets the SubAdministrative Area associated with the OasisAddress class. A portion of the administrativeArea - The next level down division of the area. E.g. state / county, province / reservation. + * + * @return String - The SubAdministrative Area associated with the OasisAddress class. + * + */ public String getSubAdministrativeArea() { return (String) store.get(KEY_SUB_ADMINISTRATIVE_AREA); } + /** + * Sets the SubAdministrative Area associated with the OasisAddress class. A portion of the administrativeArea - The next level down division of the area. E.g. state / county, province / reservation. + * + * @param subAdministrativeArea + * The SubAdministrative Area associated with the OasisAddress class. + * + */ public void setSubAdministrativeArea(String subAdministrativeArea) { if (subAdministrativeArea != null) { store.put(KEY_SUB_ADMINISTRATIVE_AREA, subAdministrativeArea); @@ -82,10 +153,23 @@ public class OasisAddress extends RPCStruct{ } } + /** + * Gets the Locality associated with the OasisAddress class. - A hypernym for city/village + * + * @return String - The Locality associated with the OasisAddress class. + * + */ public String getLocality() { return (String) store.get(KEY_LOCALITY); } + /** + * Sets the Locality associated with the OasisAddress class. - A hypernym for city/village. + * + * @param locality + * The Locality associated with the OasisAddress class. + * + */ public void setLocality(String locality) { if (locality != null) { store.put(KEY_LOCALITY, locality); @@ -94,10 +178,23 @@ public class OasisAddress extends RPCStruct{ } } + /** + * Gets the Sub-Locality associated with the OasisAddress class. - Hypernym for district. + * + * @return String - The Sub-Locality associated with the OasisAddress class. + * + */ public String getSubLocality() { return (String) store.get(KEY_SUB_LOCALITY); } + /** + * Sets the Sub-Locality associated with the OasisAddress class. A hypernym for district. + * + * @param subLocality + * The Sub-Locality associated with the OasisAddress class. + * + */ public void setSubLocality(String subLocality) { if (subLocality != null) { store.put(KEY_SUB_LOCALITY, subLocality); @@ -106,10 +203,23 @@ public class OasisAddress extends RPCStruct{ } } + /** + * Gets the Thoroughfare associated with the OasisAddress class. - A hypernym for street, road etc. + * + * @return String - The Thoroughfare associated with the OasisAddress class. + * + */ public String getThoroughfare() { return (String) store.get(KEY_THOROUGH_FARE); } + /** + * Sets the Thoroughfare associated with the OasisAddress class. A hypernym for street, road etc. + * + * @param thoroughFare + * The Thoroughfare associated with the OasisAddress class. + * + */ public void setThoroughfare(String thoroughFare) { if (thoroughFare != null) { store.put(KEY_THOROUGH_FARE, thoroughFare); @@ -117,11 +227,23 @@ public class OasisAddress extends RPCStruct{ store.remove(KEY_THOROUGH_FARE); } } - + + /** + * Gets the Sub-Thoroughfare associated with the OasisAddress class. - A Portion of thoroughfare (e.g. house number). + * + * @return String - The Sub-Thoroughfare associated with the OasisAddress class. + */ public String getSubThoroughfare() { return (String) store.get(KEY_SUB_THOROUGH_FARE); } - + + /** + * Sets the Sub-Thoroughfare associated with the OasisAddress class. - A Portion of thoroughfare (e.g. house number). + * + * @param subThoroughfare + * The Sub-Thoroughfare associated with the OasisAddress class. + * + */ public void setSubThoroughfare(String subThoroughfare) { if (subThoroughfare != null) { store.put(KEY_SUB_THOROUGH_FARE, subThoroughfare); diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java index dc77058de..2a9108e47 100644 --- a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/SendLocation.java @@ -5,6 +5,8 @@ import java.util.List; import com.smartdevicelink.protocol.enums.FunctionID; import com.smartdevicelink.proxy.RPCRequest; +import com.smartdevicelink.proxy.rpc.enums.DeliveryMode; +import com.smartdevicelink.util.DebugTool; import com.smartdevicelink.util.SdlDataTypeConverter; @@ -23,6 +25,9 @@ public class SendLocation extends RPCRequest{ public static final String KEY_PHONE_NUMBER = "phoneNumber"; public static final String KEY_ADDRESS_LINES = "addressLines"; public static final String KEY_LOCATION_IMAGE = "locationImage"; + public static final String KEY_DELIVERY_MODE = "deliveryMode"; + public static final String KEY_TIME_STAMP = "timeStamp"; + public static final String KEY_ADDRESS = "address"; /** * Constructs a new SendLocation object @@ -221,4 +226,67 @@ public class SendLocation extends RPCRequest{ } } + public DeliveryMode getDeliveryMode() { + Object obj = parameters.get(KEY_DELIVERY_MODE); + if (obj instanceof DeliveryMode) { + return (DeliveryMode) obj; + } else if (obj instanceof String) { + return DeliveryMode.valueForString((String) obj); + } + return null; + } + + public void setDeliveryMode(DeliveryMode deliveryMode) { + if (deliveryMode != null) { + parameters.put(KEY_DELIVERY_MODE, deliveryMode); + } else { + parameters.remove(KEY_DELIVERY_MODE); + } + } + + @SuppressWarnings("unchecked") + public DateTime getTimeStamp() { + Object obj = parameters.get(KEY_TIME_STAMP); + if (obj instanceof DateTime) { + return (DateTime) obj; + } else if (obj instanceof Hashtable) { + try { + return new DateTime((Hashtable<String, Object>) obj); + } catch (Exception e) { + DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + KEY_TIME_STAMP, e); + } + } + return null; + } + + public void setTimeStamp(DateTime timeStamp) { + if (timeStamp != null) { + parameters.put(KEY_TIME_STAMP, timeStamp); + } else { + parameters.remove(KEY_TIME_STAMP); + } + } + + @SuppressWarnings("unchecked") + public OasisAddress getAddress() { + Object obj = parameters.get(KEY_ADDRESS); + if (obj instanceof OasisAddress) { + return (OasisAddress) obj; + } else if (obj instanceof Hashtable) { + try { + return new OasisAddress((Hashtable<String, Object>) obj); + } catch (Exception e) { + DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + KEY_ADDRESS, e); + } + } + return null; + } + + public void setAddress(OasisAddress address) { + if (address != null) { + parameters.put(KEY_ADDRESS, address); + } else { + parameters.remove(KEY_ADDRESS); + } + } } diff --git a/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/DeliveryMode.java b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/DeliveryMode.java new file mode 100644 index 000000000..52361a97d --- /dev/null +++ b/sdl_android_lib/src/com/smartdevicelink/proxy/rpc/enums/DeliveryMode.java @@ -0,0 +1,16 @@ +package com.smartdevicelink.proxy.rpc.enums; + +public enum DeliveryMode { + PROMPT, + DESTINATION, + QUEUE, + ; + + public static DeliveryMode valueForString(String value) { + try{ + return valueOf(value); + }catch(Exception e){ + return null; + } + } +} |