control SJ4000 wifi through HTTP
http://sj4000programming.sourceforge.net/0.7.0/html/book.html
you can communicate with the camera through HTTP service, including changing camera mode, and shooting photo...etc.
you can communicate with the camera through HTTP service, including changing camera mode, and shooting photo...etc.
Checking Camera Mode
To check for current mode the camera is operating in,default is video mode, open your web browser to the following URL:
http://192.168.1.254/?custom=1&cmd=3016
The camera will return HTTP 200 response, using
text/xml
content type with appropriate content length, and following XML content:<?xml version="1.0" encoding="UTF-8" ?> <Function> <Cmd>3016</Cmd> <Status>MODENUMBER</Status> </Function>
Each line is terminated by a single LF (ASCII 10) character except the last line (which is not terminated). and
MODENUMBER
part will be one of these camera mode numbers:
Table 7.2. List of returned camera mode numbers
Camera mode number | Camera mode |
---|---|
0 | Photo shooting mode |
1 | Video recording mode |
3 | Time lapse video recording mode |
4 | Time lapse photo shooting mode |
Shooting a Photo
In photo shooting mode, to shoot a photo, open your web browser to the following URL:
http://192.168.1.254/?custom=1&cmd=1001
The camera will return HTTP 200 response, using
text/xml
content type with appropriate content length, and following XML content:<?xml version="1.0" encoding="UTF-8" ?> <Function> <Cmd>1001</Cmd> <Status>STATUS</Status> </Function>
Each line is terminated by a single LF (ASCII 10) character except the last line (which is not terminated).
STATUS
part of the response will be one of the following photo shoot command status values:
Table 8.1. List of photo shooting command status values
Command status value | Command status meaning |
---|---|
0 | A photo is shot and saved. |
-13 | Shooting failed: the camera is not in photo shooting mode. |
-22 | Shooting failed: there's no MicroSD card in the camera. |
Important notes:
- If storage space left on MicroSD card is not enough for saving photo, the camera will not will not give HTTP response and will no longer respond to any commands. You would need to manually turn off WiFi access and turn it back on again if you wish to send more commands. See “Remaining Photos Status” section for how to check number of remaining photos the camera can take before the storage is full.
Also change date and time is also important
http://192.168.1.254/?custom=1&cmd=3005&str=YYYY-MM-DD
http://192.168.1.254/?custom=1&cmd=3006&str=HH:MM:SSSo, it's possible to use a esp32 to control the sjcam through wifi
and HTTP using the httpclient library.
some one also made a python command,
https://github.com/AdamLaurie/sjcam
or there is some one hacked with pins...http://www.homebuiltrovs.com/rovforum/viewtopic.php?f=4&t=1768
I wish to use a esp8266 and take the camera command from Ardupilot,
then control the sj cam to ta a photo shot.
If possible, add a gps on esp and record the gps info in sd card when the photo is
taken, so that we can geotag the photo after the flight.
I need to know how to parsing the response from sjcam, I was looking for http decoder,
but it turns out that it's a xml,there are lot of xml parser for arduino on the net.
Considering I only need a simple one, I found:
https://stackoverflow.com/questions/37694440/parse-xml-data-in-arduino/39832846
there is a simple funciton by xSx:
String xmlTakeParam(String inStr,String needParam) { if(inStr.indexOf("<"+needParam+">")>0){ int CountChar=needParam.length(); int indexStart=inStr.indexOf("<"+needParam+">"); int indexStop= inStr.indexOf("</"+needParam+">"); return inStr.substring(indexStart+CountChar+2, indexStop); } return "not found"; }
This is using evil String, but...it works...
Here are what I wish esp to do:
1.get current state of sjcam, it it's not in photo mode, make it in photo mode
2.get command from ardupilot and control sjcam to take photo, make sure it does.
留言
張貼留言