diff --git a/README.md b/README.md index e5d1706..2eb426f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,21 @@ camera.setSharpness(90); ... ``` +## Maven dependency +```xml + + foscamlib-mvn-repo + https://raw.github.com/hypothermic/foscamlib/mvn-repo/ + + + + nl.hypothermic + foscamlib + + LATEST + +``` + ## Features Here is a full list of commands: @@ -96,12 +111,23 @@ Here is a full list of commands: - isTalkSupported(); - isWPSSupported(); +// Camera streams +- getMainVideoStreamType(); +- getSubVideoStreamType(); +- setMainVideoStreamType(0-3); +- setSubStreamFormat(0-1); +- getMJStreamURL(); + // Deprecated - doesCameraSupportOnvif(); - doesCameraSupportRtsp(); ``` ## Changelog +v1.04 +- Added camera stream controls. +- Created Maven Repository. See above for details. (branch "mvn-repo") + v1.03 - Added all info flags - Added DeviceInfo diff --git a/pom.xml b/pom.xml index 1327ec1..e0f6b29 100644 --- a/pom.xml +++ b/pom.xml @@ -2,9 +2,9 @@ 4.0.0 nl.hypothermic foscamlib - 1.03-RELEASE + 1.04-RELEASE FoscamLib - https://github.com/hypothermic/FoscamLib + https://github.com/hypothermic/foscamlib Java Library for Foscam IP camera's. See README.md for legal disclaimer. @@ -12,11 +12,14 @@ See README.md for legal disclaimer. 1.6 1.6 + github + hypothermic + ${env.githubpass} - + + + maven-deploy-plugin + 2.8.1 + + internal.repo::default::file://${project.build.directory}/mvn-repo + + + com.github.github + site-maven-plugin + 0.11 + + Maven artifacts for ${project.version} + true + ${project.build.directory}/mvn-repo + refs/heads/mvn-repo + **/* + foscamlib + hypothermic + true + + + + + site + + deploy + + + \ No newline at end of file diff --git a/src/main/java/nl/hypothermic/foscamlib/Foscam.java b/src/main/java/nl/hypothermic/foscamlib/Foscam.java index aa85b9e..c6781c5 100644 --- a/src/main/java/nl/hypothermic/foscamlib/Foscam.java +++ b/src/main/java/nl/hypothermic/foscamlib/Foscam.java @@ -728,6 +728,73 @@ public ArrayList getLogEntries(int count, int offset) { return list; } + /** + * Get Foscam's main video stream type + * @return Main video stream type + */ + public String getMainVideoStreamType() { + RxData out = nm.exec("getMainVideoStreamType"); + if (out.result != Result.SUCCESS) { + return null; + } + return p.getTagValue(out.xml, "streamType"); + } + + /** + * Get Foscam's sub video stream type + * @return Sub video stream type + */ + public String getSubVideoStreamType() { + RxData out = nm.exec("getSubVideoStreamType"); + if (out.result != Result.SUCCESS) { + return null; + } + return p.getTagValue(out.xml, "streamType"); + } + + /** + * Set Foscam's main video stream type + * @param streamType (int 0-3) + * @return True if succeeded + */ + public Boolean setMainVideoStreamType(int streamType) { + if (streamType < 0 || streamType > 3) { + return null; + } + RxData out = nm.exec("setMainVideoStreamType", "streamType", streamType + ""); + if (out.result != Result.SUCCESS) { + return null; + } + return true; + } + + /** + * Set Foscam's main video stream type

+ * > 0 = H264
+ * > 1 = MotionJpeg + * @param format (0=H264, 1=MJ) + * @return True if succeeded + */ + public Boolean setSubStreamFormat(int format) { + if (format < 0 || format > 1) { + return null; + } + RxData out = nm.exec("setSubStreamFormat", "format", format + ""); + if (out.result != Result.SUCCESS) { + return null; + } + return true; + } + + /** + * Get Foscam's MotionJpeg stream URL + * @return This Foscam's MotionJpeg stream URL as String + */ + // Hardcoded, should be the same for every camera. + public String getMJStreamURL() { + return protocol + "://" + address + ":" + port + "/cgi-bin/CGIStream.cgi?cmd=GetMJStream"; + } + /** * Get Foscam's device info * @return DeviceInfo object