* @param[in] state a pointer to a structure containing current state
* @return 0 if the recording finished successfully and negative error code otherwise
*/
intcamogm_start(camogm_state*state)
intcamogm_start(camogm_state*state,boolrestart)
{
inttimestamp_start;
intrslt;
...
...
@@ -357,10 +357,15 @@ int camogm_start(camogm_state *state)
returnCAMOGM_FRAME_OTHER;
}
if(state->rawdev_op){
copy_state_file(state);// copy camogm.disk to named state file, fill be used when downloading data as file_start parameter
D1(fprintf(debug_file,"Starting raw data recording, marked %s, state->path='%s'\n",get_state_path(state),state->path));
D1(syslog(LOG_INFO,"Starting raw data recording, marked %s",get_state_path(state)));
next_state_path(state);// increment path so next time will use different one.
if(!restart){
copy_state_file(state);// copy camogm.disk to named state file, it will be used when downloading data as file_start parameter
D1(fprintf(debug_file,"Starting raw data recording, marked %s, state->path='%s'\n",get_state_path(state),state->path));
D1(syslog(LOG_INFO,"Starting raw data recording, marked %s",get_state_path(state)));
next_state_path(state);// increment path so next time will use different one.
}else{
D1(fprintf(debug_file,"Re-starting raw data recording, using the same state file, text will be %s, state->path='%s'\n",get_state_path(state),state->path));
D1(syslog(LOG_INFO,"Re-starting raw data recording, next will be %s",get_state_path(state)));
}
}else{
D1(fprintf(debug_file,"Starting file system recording to %s\n",state->path));
D1(syslog(LOG_INFO,"Starting file system recording to %s",state->path));
...
...
@@ -1538,10 +1543,13 @@ int parse_cmd(camogm_state *state, FILE* npipe)
}
// now cmd is trimmed, arg is NULL or a pointer to trimmed command arguments
if(strcmp(cmd,"start")==0){
if(state->prog_state!=STATE_STOPPED){
return-1;// can not start if it is already running
}
check_compressors(state);
get_disk_info(state);
D6(fprintf(debug_file,"camogm_start() from %s:%d: @ %07d\n",__FILE__,__LINE__,get_fpga_usec(state->fd_fparmsall[0],0)));
camogm_start(state);
camogm_start(state,false);
return1;
}elseif(strcmp(cmd,"reset")==0){// will reset pointer to the last acquired frame (if any)
camogm_reset(state);
...
...
@@ -1874,7 +1882,7 @@ int listener_loop(camogm_state *state)
state->prog_state=STATE_RESTARTING;
D6(fprintf(debug_file,"camogm_start() from %s:%d: @ %07d\n", \