ReeCam IP Camera ajax v1.0
ipcamerea ajax document
Version / Author / Date | Modify |
---|---|
1.0/Jos/2013-03-23 | First edition |
1.1/Jos/2013-04-20 | Simplify return parameters |
1.2/Jos/2013-04-23 | Repair asynchronously Method |
1.3/Jos/2013-05-22 | Return tag value |
1.4/Jos/2013-05-24 | Add get a dictionary attacks |
Outline
ReeCam IP Camera ajax library is available to users of a web development applications ReeCam IP Camera CGI interface operation library, improve efficiency, and simplify the code
Generic function
ipcamera_ajax(obj);
obj parameter
*m:Request Method get or post,default:get *u:Request URL,can by parameter,ex.:close_session.cgi?session=1891048766 *d:Request Data,Format is json and auto to encodeURIComponent the data *f:A function to be called,The function gets passed third arguments *t:timeout for the request. default:0(not check) *a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. *h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode.If you use the https protocol, you need to add "https://" *j:Incoming tag value,Back in the third parameter of the function is executed on
Example
ipcamera_ajax({m:'get',u:'set_params.cgi?session=1891048766',d:{alias:'test'},f:function(error,d,j){ if(error==0){ alert(j+"success!"); }else{ alert("error NO.:"+error); } },t:4,a:false,h:'https://192.168.0.123:1081',j:3}); like visit 'https://192.168.0.123:1081/set_params.cgi?session=1891048766&alias='+encodeURIComponent('test')
back data
back two arguments 1.error NO:Equal to or less than 0 2.error NO = 0: back data is json mode error NO: 0 Operation success -1 Operation failed:Authentication error -2 Operation failed:Parameter error -3 Operation failed:To achieve the maximum number of the session -4 Operation failed:camera internal error -5 Operation failed:Execution timeout -6 Operation failed:Error or unsupported operating request -11 Operation failed:Return Data anomalies -12 Operation failed:The perform callback error occurred or return data format error -13 Operation failed:timeout for the request -14 Operation failed:Failed to initialize ajax---Please feedback version of the browser you use -15 Operation failed:File not found. (cross-domain can not be detected)
Package Function
- create session
create_session(user,pwd,f,t,a,h)
Parameter
user/pwd:Parameter authentication methods required to login username / password f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Example
create_session("admin","admin88",f:function(error,d){ if(error==0){ alert("success session:"+d.session+" group:"+d.group); }else{ alert("Error NO:"+error); } })
Return Data
session:create Session ID group:create Session permissions
Refer create_session.cgiSession CGI
- close session
close_session(s,f,t,a,h)
Parameter
s:close session ID f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer close_session.cgiSession CGI
- Get IP Camera's Sessions
get_session_list(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer get_session_list.cgiSession CGI
- Check IP Camera has set MJPEG
is_mjpeg_stream_exist(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer is_mjpeg_stream_exist.cgiProperties CGI
- get IP Camera properties
get_properties(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer get_properties.cgiProperties CGI
- get IP Camera Parameter
get_params(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer get_params.cgiParams CGI
- set IP Camera Parameter
set_params(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer set_params.cgiParams CGI
- get IP Camera status
get_status(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer get_status.cgiStatus CGI
- get IP Camera logs
get_log(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer get_log.cgi
- get IP Camera AV
request_av(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer request_av.cgi
- PTZ control
ptz_control(command,d,f,t,a,h)
Parameter
command:PTZ command d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer ptz_control.cgiControls CGI
- start record
start_record(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer start_record.cgiRecord CGI
- stop record
stop_record(task,d,f,t,a,h)
Parameter
task:task id d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer stop_record.cgiRecord CGI
- search SD record's file
search_record(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer search_record.cgiRecord CGI
- del SD record's file
del_record(name,d,f,t,a,h)
Parameter
name:record name d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer del_record.cgiRecord CGI
- restore factory
restore_factory(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer restore_factory.cgiMaintain CGI
- test IP Camera mail work
mail_test(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer mail_test.cgiOthers CGI
- search Wi-Fi
wifi_scan(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer wifi_scan.cgiOthers CGI
- set user Authentication
check_user(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer check_user.cgi
- register skype user
register_skype_user(name,pwd,mail,d,f,t,a,h)
Parameter
name/pwd/mail:register new skype user of Information d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer register_skype_user.cgiSkype CGI
- get skype Friends
get_skype_contacts_list(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer get_skype_contacts_list.cgiSkype CGI
- search skype contact
search_skype_contact(key,d,f,t,a,h)
Parameter
key:keywrod d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer search_skype_contact.cgiSkype CGI
- add skype new friend
add_skype_contact(key,d,f,t,a,h)
Parameter
key:friend name d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer add_skype_contact.cgiSkype CGI
- remove skype friend
remove_skype_contact(key,d,f,t,a,h)
Parameter
key:friend name d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer remove_skype_contact.cgiSkype CGI
- Get a dictionary attack information
get_badauth(d,f,t,a,h)
Parameter
d:Request Data,Format is json and auto to encodeURIComponent the data f:A function to be called,The function gets passed two arguments t:timeout for the request. default:0(not check) a:By default, all requests are sent asynchronously(i.e. this is set to true by default).If you need synchronous requests, set this option to false. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. h:Request the domain name (or IP) and port. the value is not empty to use by the jsonp mode
Return Data
Refer get_badauth.cgiget_badauth CGI?
Library with two functions
$id(id) Get the object for id in_array(a,b) Array (b) whether there is a
Attach:ajax-mini.js 5.56kb Compressed
Attach:ajax.js 6.90kb