Skip to content

Commit

Permalink
Add parameter for network camera interrupt seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Dave committed Aug 29, 2024
1 parent a29812b commit f02a27e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 8 additions & 0 deletions doc/motionplus_config.html
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,14 @@ <h3><a name="netcam_params"></a>netcam_params</h3>
</div>
<p></p>

<div>
<i><h4>interrupt</h4></i>
The duration in seconds permitted for reading an image from the netcam source. For the initial connection
to the camera, the maximum duration is set equal to three times the interrupt specified. The default
number of seconds is 20.
</div>
<p></p>

<div>
<i><h4> params_file </h4></i>
<ul>
Expand Down
11 changes: 6 additions & 5 deletions src/netcam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ int cls_netcam::read_image()

interrupted=false;
clock_gettime(CLOCK_MONOTONIC, &ist_tm);
idur = 10;
idur = cfg_idur;

status = NETCAM_READINGIMAGE;
img_recv->used = 0;
Expand Down Expand Up @@ -1543,8 +1543,6 @@ void cls_netcam::set_options()
std::to_string(cfg_height);
util_parms_add_default(params,"video_size", tmp);

idur = 55;

} else if (service == "file") {
MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO
,_("%s:Setting up movie file")
Expand Down Expand Up @@ -1689,6 +1687,7 @@ void cls_netcam::set_parms ()
filenbr = 0;
filelist.clear();
filedir = "";
cfg_idur = 20;

for (it = params->params_array.begin();
it != params->params_array.end(); it++) {
Expand All @@ -1702,6 +1701,9 @@ void cls_netcam::set_parms ()
capture_rate = mtoi(it->param_value);
}
}
if (it->param_name == "interrupt") {
cfg_idur = mtoi(it->param_value);
}
}

/* If this is the norm and we have a highres, then disable passthru on the norm */
Expand All @@ -1720,7 +1722,6 @@ void cls_netcam::set_parms ()
clock_gettime(CLOCK_MONOTONIC, &ist_tm);
clock_gettime(CLOCK_MONOTONIC, &icur_tm);

idur = 5;
interrupted = false;

set_path();
Expand Down Expand Up @@ -1784,7 +1785,7 @@ int cls_netcam::open_context()

clock_gettime(CLOCK_MONOTONIC, &ist_tm);

idur = 20;
idur = cfg_idur * 3; /*3 is arbritrary multiplier to give connect more time than other steps*/

set_options();

Expand Down
1 change: 1 addition & 0 deletions src/netcam.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class cls_netcam {
int cfg_width;
int cfg_height;
int cfg_framerate;
int cfg_idur;
std::string cfg_params;

std::vector<ctx_filelist_item> filelist;
Expand Down

0 comments on commit f02a27e

Please sign in to comment.