Skip to content

Commit

Permalink
v1.04
Browse files Browse the repository at this point in the history
  • Loading branch information
hypothermic committed Mar 31, 2018
1 parent 9e2f9cf commit 41a989f
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 3 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ camera.setSharpness(90);
...
```

## Maven dependency
```xml
<repository>
<id>foscamlib-mvn-repo</id>
<url>https://raw.github.com/hypothermic/foscamlib/mvn-repo/</url>
</repository>

<dependency>
<groupId>nl.hypothermic</groupId>
<artifactId>foscamlib</artifactId>
<!-- If you're using Maven3, specify version num -->
<version>LATEST</version>
</dependency>
```

## Features
Here is a full list of commands:

Expand Down Expand Up @@ -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
Expand Down
39 changes: 36 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@
<modelVersion>4.0.0</modelVersion>
<groupId>nl.hypothermic</groupId>
<artifactId>foscamlib</artifactId>
<version>1.03-RELEASE</version>
<version>1.04-RELEASE</version>
<name>FoscamLib</name>
<url>https://github.com/hypothermic/FoscamLib</url>
<url>https://github.com/hypothermic/foscamlib</url>
<description>Java Library for Foscam IP camera's.

See README.md for legal disclaimer.</description>

<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<github.global.server>github</github.global.server>
<github.global.userName>hypothermic</github.global.userName>
<github.global.password>${env.githubpass}</github.global.password>
</properties>

<build>
<plugins>
<plugin>
<!--<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.1</version>
<configuration>
Expand All @@ -33,7 +36,37 @@ See README.md for legal disclaimer.</description>
</goals>
</execution>
</executions>
</plugin>-->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.11</version>
<configuration>
<message>Maven artifacts for ${project.version}</message>
<noJekyll>true</noJekyll>
<outputDirectory>${project.build.directory}/mvn-repo</outputDirectory>
<branch>refs/heads/mvn-repo</branch>
<includes><include>**/*</include></includes>
<repositoryName>foscamlib</repositoryName>
<repositoryOwner>hypothermic</repositoryOwner>
<merge>true</merge>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
67 changes: 67 additions & 0 deletions src/main/java/nl/hypothermic/foscamlib/Foscam.java
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,73 @@ public ArrayList<String> 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<br><br>
* > 0 = H264<br>
* > 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
Expand Down

0 comments on commit 41a989f

Please sign in to comment.