fvdm / nodejs-foscam

Remote control, view and config a Foscam or compatible IP camera
https://www.npmjs.com/package/foscam
The Unlicense
124 stars 31 forks source link

Foscam firmware #4

Open scaret opened 9 years ago

scaret commented 9 years ago

I think the project depends on some specific foscam firmware version.

The project doesn't work for my foscam 2.51.1.30 Since I had a look at the cgi api URLs and found them different in the source code of the project.

fvdm commented 9 years ago

That's quiet possible and what I wanted to use the setup function for, to figure out the endpoints. I kind of reverse engineered mine.

Can you list the urls and their expected function for your camera?

scaret commented 9 years ago

I tried to update the status() function here:

https://github.com/scaret/nodejs-foscam/commit/20ba886b435945555f42a75d67bc0b8f9ab51e60

My foscam camera is EH8135 V3, System firmware 1.9.1.11, Application firmware 2.51.1.30

sjlynch commented 8 years ago

Yeah it looks like they changed their SDK and then hid it from the public. http://foscam.us/forum/new-sdk-cgi-application-t13426.html

Really disgusting of them. I definitely won't buy from them and I'll urge my company to find alternatives next time.

EDIT: So you can reverse engineer the API by using their plugin. I might add a pull request later that allows you to specify an application version. I don't know however if the application version or the firmware version directly correlates to the API version. For example, is it possible for application versions 2.11 and 1.9 to share the same API? Not sure what value to key off of.

@scaret if you're still working on this it might be useful to work together to figure out what is safe to key off of.

For application version 2.11.1.10, firmware 1.4.1.9 and model FI9821W V2 I have the following commands to move right and then stop:

http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzMoveRight http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzStopRun

sjlynch commented 8 years ago

Here is everything I could extract with the plugin for application version 2.11.1.10, firmware 1.4.1.9 and model FI9821W V2. Not sure yet how to take a picture or stream video to a web frontend.

// http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzStopRun // http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzMoveRight // http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzMoveTopLeft%261444940677501 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzMoveBottomRight%261444940695376 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzReset%261444940710780

//IR http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DopenInfraLed%261444940739802 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DcloseInfraLed%261444940751175

//Preset http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzGotoPresetPoint%26name%3DBottomMost%261444940777824 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DptzAddPresetPoint%26name%3Daaa%261444940808088

http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DsetMainVideoStreamType%26streamType%3D0%261444940885709 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DsetMainVideoStreamType%26streamType%3D1%261444940870138 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DsetMainVideoStreamType%26streamType%3D2%261444940902215 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DsetMainVideoStreamType%26streamType%3D3%261444940915238

http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DsetPwrFreq%26freq%3D1%261444940923726 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DsetPwrFreq%26freq%3D0%261444940933890

http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DlogIn%26usrName%3Dadmin%26pwd%3Dadmin%26groupId%3D939486238%261444939491825 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DgetProductAllInfo%261444939492035 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DgetGuideMode%261444939492409 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DmirrorVideo%26isMirror%3D1%261444941091355 http://ip:port/cgi-bin/CGIProxy.fcgi?usr%3Dadmin%26pwd%3Dadmin%26cmd%3DgetDevInfo%261444941126511

scaret commented 8 years ago

Thank you for your information.

Actually foscam tech support gives a good documentation for the new cgi api. For example, to take the snapshot you can visit /cgi-bin/CGIProxy.fcgi?cmd=snapPicture2. This will be helpful to you. You can give me an email address and I send the doc to you.

I don't like the idea to support different versions of Foscam firmware. But since functionalities for PTZ cameras are nearly the same, it's reasonable to do that. For me, I'll just start another repo and ignore the old one.

About whether I'm still working on this area, I'll say, yes. But foscam CGI API is not enough for me, so I tried some other stuff like ONVIF. Actually I'm not using foscam now, because foscam is lack of an important feature for me, which is getting the current PTZ status.

lightswitch05 commented 8 years ago

I just published foscam-client which is made to work with the newer cameras. It is just a v0.0.1 release, but the basics are all there.

scaret commented 8 years ago

https://s3.cn-north-1.amazonaws.com.cn/scaret/abc/Foscam+IPCamera+CGI+User+Guide-3518+Ver.+1.0.6.pdf

lightswitch05 commented 8 years ago

@scaret there is a newer version of that documentation in my repo: https://github.com/lightswitch05/foscam-client/blob/master/HD%20cameras%20SDK%20CGI%20(1)/Foscam%20IPCamera%20CGI%20User%20Guide-3518%20Ver.1.0.10.pdf

I've implemented most of the get functions. I haven't had time to do a lot of the set functions. Pull requests welcome.