Skip to content

Commit

Permalink
v1.08
Browse files Browse the repository at this point in the history
  • Loading branch information
hypothermic committed Apr 30, 2018
1 parent faea0cd commit f2bb8cd
Show file tree
Hide file tree
Showing 7 changed files with 724 additions and 3 deletions.
57 changes: 55 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FoscamAPI
Easily connect to Foscam IP camera's with this lightweight Java library. One command is all it takes.
FoscamAPI is suitable for all the HD cameras, including FI9821W, FI9818W, FI9801W, FI9802W and FI9805W.
Easily connect to Foscam IP cameras with this lightweight Java library. One command is all it takes.
FoscamAPI is suitable for all the IP cameras, including FI9821W, FI9818W, FI9801W, FI9802W, FI9805W and FosBaby P1.
It is tested on the FI9900P.

## Example
Expand Down Expand Up @@ -28,6 +28,20 @@ camera.setSharpness(90);
</dependency>
```

## Gradle dependency
```gradle
repositories {
maven {
url "https://raw.github.com/hypothermic/foscamapi/mvn-repo/"
}
}
dependencies {
// Note: use 'api' instead of 'compile' if you're using Android Studio.
compile group: 'nl.hypothermic', name: 'foscamlib', version: '1.07-RELEASE'
}
```

## Features
Here is a full list of commands:

Expand Down Expand Up @@ -193,6 +207,36 @@ Here is a full list of commands:
- getPTZPrePointForSelfTest();
- setPTZPrePointForSelfTest(name);

// Cloud & push controls (not supported by 3518A based cameras)
- getCloudConfig();
- setCloudConfig(...);
- getCloudServer();
- setCloudServer(...);
- testCloudServer();
- refreshCloudToken();
- refreshCloudQuota();
- getCloudStreamLevel();
- setCloudStreamLevel(0-100);
- getCloudAuthcode();
- isCloudEnabled();

- getPushConfig();
- setPushConfig(...);
- getPushServer();
- setPushServer(...);
- testPushServer();
- sendPush(...);
- isPushEnabled();

// Miscellaneous controls (not supported by all platforms, see javadoc!)
- getHumidity();
- getNightlightState();
- setNightlightState(true/false);
- getLedState();
- setLedState(true/false);
- getHDRState();
- setHDRState(true/false);

// Deprecated, kept for backwards compatibility
- doesCameraSupportOnvif();
- doesCameraSupportRtsp();
Expand All @@ -201,6 +245,13 @@ Here is a full list of commands:
See [javadoc](https://hypothermic.nl/foscamlib/javadoc/) for more information and details about these features.

## Changelog
v1.08
- Added cloud controls
- Added push controls
- Added night light controls
- Added humidity getter
- Added HDR controls

v1.07
- Added storage controls
- Added audio volume controls
Expand Down Expand Up @@ -264,6 +315,8 @@ If you are having issues with FoscamAPI or any component:
## Mentions
FoscamAPI (previously named FoscamLib) is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Shenzhen Foscam Intelligent Technology Limited, or any of its subsidiaries or its affiliates. The official Foscam website can be found at https://www.foscam.com. The name “Foscam” as well as related names, marks, emblems and images are registered trademarks of Shenzhen Foscam Intelligent Technology Limited.

If there are any legal issues, please contact me via GitHub or email ([email protected])

## License
The license can be found [here](./LICENSE.txt) or in the root folder of the project.

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>nl.hypothermic</groupId>
<artifactId>foscamlib</artifactId>
<version>1.07-RELEASE</version>
<version>1.08-RELEASE</version>
<name>FoscamAPI</name>
<url>https://github.com/hypothermic/foscamapi</url>
<description>Java Library for Foscam IP camera's.
Expand Down
Loading

7 comments on commit f2bb8cd

@jasonbuechler
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @hypothermic I just discovered the cloud commands when looking through their CGI guide... since it smells very much like one could use their own dropbox account, I went looking for more info but yours is the only resource I could find mentioning it!

Have you used any of the 'set' cloud commands? Can you give me any more info at all? Thanks!

@hypothermic
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @jasonbuechler ,

I've never used dropbox but from the CGI guide it seems like you need an OAuth token. The command was added to the guide around 2012-11-21 so it may be outdated and no longer work.

I have a spare camera available at home, I'll try it out next weekend.

@jasonbuechler
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you!
So I made a little write-up about my interest in these functions, if you'd like to take a gander: https://github.com/jasonbuechler/fosbox/blob/master/background.md

Oh and the commands do basically work! (e.g. I can set the 'code' parameter in the cloud config, to whatever end that gets me) They may fully work, but since I don't fully understand how to use them... :)

@hypothermic
Copy link
Owner Author

@hypothermic hypothermic commented on f2bb8cd Sep 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's what I've tried:

  1. getCloudConfig() returns authAddr = https%3A%2F%2Fwww.dropbox.com%2F1%2Foauth2%2Fauthorize%3Fresponse_type%3Dcode%26client_id%3D9bpwfjxoqbduf39
    (decoded: https://www.dropbox.com/1/oauth2/authorize?response_type=code&client_id=9bpwfjxoqbduf39)
    The client_id belongs to Foscam and is the same on every camera.
  2. Visit the address in web browser, create a dropbox account, and click "Allow" when the authorization message is shown. This returns an access token.
  3. setCloudConfig() with the code=<access token>

In the next few seconds, the statusMsg will change three times: status%3A+set+token+ok to status%3A+get+token+ok, and then will stay at invalid_grant.

It has created a folder in dropbox named Apps/ipcamera, but no video files are appearing. Judging by the statusMsg something has gone wrong.

Maybe I'm doing something wrong? I've tried entering the token URL-encoded as well, nope.
By the way, your project looks great. I want to try getting a shell via UART but the camera's are expensive so it's a risk to take. Though, UART would most likely give root access to the device, and give more insight to what's going on inside. (config files, maybe source code that wasn't removed after launch, I've seen it all.)

P.S. Have you considered using an FTP service instead of Dropbox? My security camera's upload to a simple NAS in the attic using FTP and it works perfectly.

@jasonbuechler
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha sorry to necro this! I keep meaning to get back to you, but incredibly busy life got in the way. Thanks for your responses!! And YOUR project looks great -- I have a couple Q's for you about it later, too.

The dropbox thing is more of a personal challenge than anything: I do have a NAS but don't even use it as an FTP target, preferring to depend on SD cards and gather the files off the cameras via their own (undocumented-ish) FTP servers. That said, though -- do your FTP'd files actually have sound? As I understood it, the only way to get files with an audio track was SD card!

I don't think you're doing anything wrong with the token stuff -- I think it just wasn't intended to have a user facing section. Since we're logged into our respective dropbox's, we're confounding variables. But along those lines, I've actually made quite a bit of progress here and there in the past while -- enough actually to help you out, I think, with your interest in root access to get some privileged insight! At least I think the odds are good that I could.

At this moment I'm actually telnet'd into a C1 as the root user, and pretty sure I could show you how to get there too. I'll send you an email at your MIT license address so we can trade info better :)
--jason

@hypothermic
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonbuechler Just to confirm: have you received my mail? I've been having lots of problems with my mailserver lately.

@jasonbuechler
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I got your email, my bad! I just suddenly got super busy! Feel free to email me whenever!

Please sign in to comment.