diff options
author | Austin Kirk <askirk@umich.edu> | 2017-07-10 13:15:22 -0400 |
---|---|---|
committer | Austin Kirk <askirk@umich.edu> | 2017-07-31 14:42:25 -0400 |
commit | 88d03f12e69bdf120ff300918af3f10e2dd25b15 (patch) | |
tree | 1fbb2576fc7a1e96c2a272040eac13cc9296a358 /sdl_android/src/main/java/com/smartdevicelink/proxy/rpc | |
parent | 23acbc1fdcdef287b696a5f92984ac33d60ec015 (diff) | |
download | sdl_android-88d03f12e69bdf120ff300918af3f10e2dd25b15.tar.gz |
Added structs, enums, RPCs in accordance with EP#58
- Note that these changes focus on the RPC-related features of the evolution proposal and avoid the BSON changes
Diffstat (limited to 'sdl_android/src/main/java/com/smartdevicelink/proxy/rpc')
9 files changed, 296 insertions, 1 deletions
diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java index 7a1a37a1e..77c534c9f 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/HMICapabilities.java @@ -7,6 +7,7 @@ import java.util.Hashtable; public class HMICapabilities extends RPCStruct{ public static final String KEY_NAVIGATION = "navigation"; public static final String KEY_PHONE_CALL = "phoneCall"; + public static final String KEY_VIDEO_STREAMING = "videoStreaming"; public HMICapabilities() { } @@ -38,4 +39,17 @@ public class HMICapabilities extends RPCStruct{ setValue(KEY_PHONE_CALL, available); } + public boolean isVideoStreamingAvailable(){ + Object available = getValue(KEY_VIDEO_STREAMING); + if(available == null){ + return false; + } + return (Boolean)available; + } + + public void setVideoStreamingAvailable(Boolean available){ + setValue(KEY_VIDEO_STREAMING, available); + } + + } diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetVideoConfig.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetVideoConfig.java new file mode 100644 index 000000000..e05410365 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetVideoConfig.java @@ -0,0 +1,39 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCRequest; +import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec; +import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol; + +import java.util.Hashtable; + +/** + * Request from SDL to HMI to ask whether HMI accepts a video stream with given configuration. + */ + +public class SetVideoConfig extends RPCRequest{ + public static final String KEY_CONFIG = "config"; + public static final String KEY_APPID = "appID"; + + public SetVideoConfig() { + super(FunctionID.SET_VIDEO_CONFIG.toString()); + } + + public SetVideoConfig(Hashtable<String, Object> hash){super(hash);} + + public void setConfig(VideoConfig config){ + setValue(KEY_CONFIG, config); + } + + public VideoConfig getConfig(){ + return (VideoConfig) getObject(VideoConfig.class, KEY_CONFIG); + } + + public void setAppID(String appID){ + setValue(KEY_APPID, appID); + } + + public String getAppID(){ + return getString(KEY_APPID); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetVideoConfigResponse.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetVideoConfigResponse.java new file mode 100644 index 000000000..08f1ce469 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/SetVideoConfigResponse.java @@ -0,0 +1,31 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.protocol.enums.FunctionID; +import com.smartdevicelink.proxy.RPCResponse; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; + +/** + * Response from HMI to SDL whether the configuration is accepted. In a negative response, a list of rejected parameters are supplied. + */ + +public class SetVideoConfigResponse extends RPCResponse { + public static final String KEY_REJECTED_PARAMS = "rejectedParams"; + + public SetVideoConfigResponse() { + super(FunctionID.SET_VIDEO_CONFIG.toString()); + } + public SetVideoConfigResponse(Hashtable<String, Object> hash) { + super(hash); + } + + public void setRejectedParams(List<String> rejectedParams){ + setValue(KEY_REJECTED_PARAMS, rejectedParams); + } + + public List<String> getRejectedParams(){ + return (List<String>) getObject(String.class, KEY_REJECTED_PARAMS); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoConfig.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoConfig.java new file mode 100644 index 000000000..9268e5824 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoConfig.java @@ -0,0 +1,54 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec; +import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol; + +import java.util.Hashtable; + +/** + * Configuration of a video stream. + */ + +public class VideoConfig extends RPCStruct{ + public static final String KEY_PROTOCOL = "protocol"; + public static final String KEY_CODEC = "codec"; + public static final String KEY_WIDTH = "width"; + public static final String KEY_HEIGHT = "height"; + + + public VideoConfig(){} + public VideoConfig(Hashtable<String, Object> hash){super(hash);} + + public void setProtocol(VideoStreamingProtocol protocol){ + setValue(KEY_PROTOCOL, protocol); + } + + public VideoStreamingProtocol getProtocol(){ + return (VideoStreamingProtocol) getObject(VideoStreamingProtocol.class, KEY_PROTOCOL); + } + + public void setCodec(VideoStreamingCodec codec){ + setValue(KEY_CODEC, codec); + } + + public VideoStreamingCodec getCodec(){ + return (VideoStreamingCodec) getObject(VideoStreamingCodec.class, KEY_CODEC); + } + + public void setWidth(Integer width){ + setValue(KEY_WIDTH, width); + } + + public Integer getWidth(){ + return getInteger(KEY_WIDTH); + } + + public void setHeight(Integer height){ + setValue(KEY_HEIGHT, height); + } + + public Integer getHeight(){ + return getInteger(KEY_HEIGHT); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java new file mode 100644 index 000000000..761f4d17c --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingCapability.java @@ -0,0 +1,42 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; + +import java.util.Hashtable; + +/** + * Contains information about this system's video streaming capabilities. + */ + +public class VideoStreamingCapability extends RPCStruct { + public static final String KEY_PREFERRED_RESOLUTION = "preferredResolution"; + public static final String KEY_MAX_BITRATE = "maxBitrate"; + public static final String KEY_SUPPORTED_FORMATS = "supportedFormats"; + + public VideoStreamingCapability(){} + public VideoStreamingCapability(Hashtable<String, Object> hash){super(hash);} + + public void setPreferredResolution(ImageResolution res){ + setValue(KEY_PREFERRED_RESOLUTION, res); + } + + public ImageResolution getPreferredResolution(){ + return (ImageResolution) getObject(ImageResolution.class, KEY_PREFERRED_RESOLUTION); + } + + public void setMaxBitrate(Integer maxBitrate){ + setValue(KEY_MAX_BITRATE, maxBitrate); + } + + public Integer getMaxBitrate(){ + return getInteger(KEY_MAX_BITRATE); + } + + public void setSupportedFormats(VideoStreamingFormat formats){ + setValue(KEY_SUPPORTED_FORMATS, formats); + } + + public VideoStreamingFormat getSupportedFormats(){ + return (VideoStreamingFormat) getObject(VideoStreamingFormat.class, KEY_SUPPORTED_FORMATS); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java new file mode 100644 index 000000000..274c076c5 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/VideoStreamingFormat.java @@ -0,0 +1,35 @@ +package com.smartdevicelink.proxy.rpc; + +import com.smartdevicelink.proxy.RPCStruct; +import com.smartdevicelink.proxy.rpc.enums.VideoStreamingCodec; +import com.smartdevicelink.proxy.rpc.enums.VideoStreamingProtocol; + +import java.util.Hashtable; + +/** + * Video streaming formats and their specifications. + */ + +public class VideoStreamingFormat extends RPCStruct { + public static final String KEY_PROTOCOL = "protocol"; + public static final String KEY_CODEC = "codec"; + + public VideoStreamingFormat(){} + public VideoStreamingFormat(Hashtable<String, Object> hash){super(hash);} + + public void setProtocol(VideoStreamingProtocol protocol){ + setValue(KEY_PROTOCOL, protocol); + } + + public VideoStreamingProtocol getProtocol(){ + return (VideoStreamingProtocol) getObject(VideoStreamingProtocol.class, KEY_PROTOCOL); + } + + public void setCodec(VideoStreamingCodec codec){ + setValue(KEY_CODEC, codec); + } + + public VideoStreamingCodec getCodec(){ + return (VideoStreamingCodec) getObject(VideoStreamingCodec.class, KEY_CODEC); + } +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java index 5e3b6e676..ebd7ddcf8 100644 --- a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/SystemCapabilityType.java @@ -7,7 +7,9 @@ package com.smartdevicelink.proxy.rpc.enums; public enum SystemCapabilityType { NAVIGATION, - PHONE_CALL; + PHONE_CALL, + + VIDEO_STREAMING; public static SystemCapabilityType valueForString(String value) { try{ diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java new file mode 100644 index 000000000..8f45f9a23 --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingCodec.java @@ -0,0 +1,42 @@ +package com.smartdevicelink.proxy.rpc.enums; + +/** + * Enum for each type of video streaming codec. + */ + +public enum VideoStreamingCodec { + /** + * A block-oriented motion-compensation-based video compression standard. As of 2014 it is one + * of the most commonly used formats for the recording, compression, and distribution of video + * content. + */ + H264, + /** + * High Efficiency Video Coding (HEVC), also known as H.265 and MPEG-H Part 2, is a video + * compression standard, one of several potential successors to the widely used AVC + * (H.264 or MPEG-4 Part 10). In comparison to AVC, HEVC offers about double the data + * compression ratio at the same level of video quality, or substantially improved video quality + * at the same bit rate. It supports resolutions up to 8192x4320, including 8K UHD. + */ + H265, + /** + * Theora is derived from the formerly proprietary VP3 codec, released into the public domain by + * On2 Technologies. It is broadly comparable in design and bitrate efficiency to MPEG-4 Part 2, + * early versions of Windows Media Video, and RealVideo while lacking some of the features + * present in some of these other codecs. It is comparable in open standards philosophy to the + * BBC's Dirac codec. + */ + Theora, + /** + * VP8 can be multiplexed into the Matroska-based container format WebM along with Vorbis and + * Opus audio. The image format WebP is based on VP8's intra-frame coding. VP8's direct + * successor, VP9, and the emerging royalty-free internet video format AV1 from the Alliance + * for Open Media (AOMedia) are based on VP8. + */ + VP8, + /** + * Similar to VP8, but VP9 is customized for video resolutions beyond high-definition video + * (UHD) and also enables lossless compression. + */ + VP9; +} diff --git a/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java new file mode 100644 index 000000000..085ae8acc --- /dev/null +++ b/sdl_android/src/main/java/com/smartdevicelink/proxy/rpc/enums/VideoStreamingProtocol.java @@ -0,0 +1,36 @@ +package com.smartdevicelink.proxy.rpc.enums; + +/** + * Enum for each type of video streaming protocol type. + */ + +public enum VideoStreamingProtocol { + /** + * Raw stream bytes that contains no timestamp data and is the lowest supported video streaming + */ + RAW, + /** + * RTP facilitates the transfer of real-time data. Information provided by this protocol include + * timestamps (for synchronization), sequence numbers (for packet loss and reordering detection) + * and the payload format which indicates the encoded format of the data. + */ + RTP, + /** + * The transmission of streaming data itself is not a task of RTSP. Most RTSP servers use the + * Real-time Transport Protocol (RTP) in conjunction with Real-time Control Protocol (RTCP) for + * media stream delivery. However, some vendors implement proprietary transport protocols. + */ + RTSP, + /** + * Real-Time Messaging Protocol (RTMP) was initially a proprietary protocol developed by + * Macromedia for streaming audio, video and data over the Internet, between a Flash player and + * a server. Macromedia is now owned by Adobe, which has released an incomplete version of the + * specification of the protocol for public use. + */ + RTMP, + /** + * The WebM container is based on a profile of Matroska. WebM initially supported VP8 video and + * Vorbis audio streams. In 2013 it was updated to accommodate VP9 video and Opus audio. + */ + WEBM; +} |