From 30aff186df2e4a1146748c9d29902d27583862ce Mon Sep 17 00:00:00 2001 From: Mr-Dave Date: Sat, 21 Jan 2023 16:46:28 -0700 Subject: [PATCH] Revise camera_id to device_id --- doc/motionplus_config.html | 10 ++++---- man/motionplus.1 | 6 ++--- src/conf.cpp | 26 +++++++++++++-------- src/conf.hpp | 2 +- src/dbse.cpp | 48 +++++++++++++++++++------------------- src/dbse.hpp | 4 ++-- src/motion_loop.cpp | 4 ++-- src/motionplus.cpp | 38 +++++++++++++++--------------- src/motionplus.hpp | 2 +- src/util.cpp | 4 ++-- src/webu.cpp | 8 +++---- src/webu_file.cpp | 2 +- src/webu_json.cpp | 12 +++++----- src/webu_post.cpp | 12 +++++----- 14 files changed, 92 insertions(+), 86 deletions(-) diff --git a/doc/motionplus_config.html b/doc/motionplus_config.html index 945c8444..03665964 100644 --- a/doc/motionplus_config.html +++ b/doc/motionplus_config.html @@ -113,7 +113,7 @@ camera_name - camera_id + device_id camera camera_dir @@ -579,7 +579,7 @@ %t - camera id number + device id number %D changed pixels %N @@ -704,10 +704,10 @@

-

camera_id

+

device_id

diff --git a/man/motionplus.1 b/man/motionplus.1 index 8a285888..330b6de4 100644 --- a/man/motionplus.1 +++ b/man/motionplus.1 @@ -167,11 +167,11 @@ User specified string to describe the camera. .RE .TP -.B camera_id +.B device_id .RS .nf -Values: Numeric identification number for the camera -Default: The order in which the camera is opened by MotionPlus +Values: Numeric identification number for the device +Default: The order in which the device is opened by MotionPlus Description: .fi .RS diff --git a/src/conf.cpp b/src/conf.cpp index 007e0e7f..db3f3aff 100644 --- a/src/conf.cpp +++ b/src/conf.cpp @@ -47,7 +47,7 @@ ctx_parm config_parms[] = { {"native_language", PARM_TYP_BOOL, PARM_CAT_00, WEBUI_LEVEL_LIMITED }, {"camera_name", PARM_TYP_STRING, PARM_CAT_01, WEBUI_LEVEL_LIMITED }, - {"camera_id", PARM_TYP_INT, PARM_CAT_01, WEBUI_LEVEL_LIMITED }, + {"device_id", PARM_TYP_INT, PARM_CAT_01, WEBUI_LEVEL_LIMITED }, {"camera_tmo", PARM_TYP_INT, PARM_CAT_01, WEBUI_LEVEL_LIMITED }, {"target_dir", PARM_TYP_STRING, PARM_CAT_01, WEBUI_LEVEL_ADVANCED }, {"watchdog_tmo", PARM_TYP_INT, PARM_CAT_01, WEBUI_LEVEL_LIMITED }, @@ -403,6 +403,12 @@ ctx_parm_depr config_parms_depr[] = { "\"movie_codec\" replaced with \"movie_container\"", "movie_container" }, + { + "camera_id", + "0.0.1", + "\"camera_id\" replaced with \"device_id\"", + "device_id" + }, { "","","",""} }; @@ -584,24 +590,24 @@ static void conf_edit_camera_name(ctx_config *conf, std::string &parm, enum PARM MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","camera_name",_("camera_name")); } -static void conf_edit_camera_id(ctx_config *conf, std::string &parm, enum PARM_ACT pact) +static void conf_edit_device_id(ctx_config *conf, std::string &parm, enum PARM_ACT pact) { int parm_in; if (pact == PARM_ACT_DFLT) { - conf->camera_id = 1; + conf->device_id = 1; } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if (parm_in < 1) { - MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid camera_id %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid device_id %d"),parm_in); } else { - conf->camera_id = parm_in; + conf->device_id = parm_in; } } else if (pact == PARM_ACT_GET) { - parm = std::to_string(conf->camera_id); + parm = std::to_string(conf->device_id); } return; - MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","camera_id",_("camera_id")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","device_id",_("device_id")); } static void conf_edit_camera_tmo(ctx_config *conf, std::string &parm, enum PARM_ACT pact) @@ -2829,7 +2835,7 @@ static void conf_edit_cat01(ctx_config *conf, std::string parm_nm if (parm_nm == "camera_dir") { conf_edit_camera_dir(conf, parm_val, pact); } else if (parm_nm == "camera") { conf_edit_camera(conf, parm_val, pact); } else if (parm_nm == "camera_name") { conf_edit_camera_name(conf, parm_val, pact); - } else if (parm_nm == "camera_id") { conf_edit_camera_id(conf, parm_val, pact); + } else if (parm_nm == "device_id") { conf_edit_device_id(conf, parm_val, pact); } else if (parm_nm == "camera_tmo") { conf_edit_camera_tmo(conf, parm_val, pact); } else if (parm_nm == "target_dir") { conf_edit_target_dir(conf, parm_val, pact); } else if (parm_nm == "watchdog_tmo") { conf_edit_watchdog_tmo(conf, parm_val, pact); @@ -3431,7 +3437,7 @@ void conf_camera_add(ctx_motapp *motapp) indx = 0; while (config_parms[indx].parm_name != "") { - if (mystrne(config_parms[indx].parm_name.c_str(),"camera_id")) { + if (mystrne(config_parms[indx].parm_name.c_str(),"device_id")) { conf_edit_get(motapp->conf, config_parms[indx].parm_name , parm_val, config_parms[indx].parm_cat); conf_edit_set(motapp->cam_list[motapp->cam_cnt-1]->conf @@ -3594,7 +3600,7 @@ void conf_parms_log(ctx_motapp *motapp) for (indx=0; indxcam_cnt; indx++) { motion_log(INF, TYPE_ALL, NO_ERRNO, 0 , _("Camera %d - Config file: %s") - , motapp->cam_list[indx]->conf->camera_id + , motapp->cam_list[indx]->conf->device_id , motapp->cam_list[indx]->conf->conf_filename.c_str()); i = 0; while (config_parms[i].parm_name != "") { diff --git a/src/conf.hpp b/src/conf.hpp index 40c6c5fe..46e7f4e6 100644 --- a/src/conf.hpp +++ b/src/conf.hpp @@ -38,7 +38,7 @@ bool native_language; std::string camera_name; - int camera_id; + int device_id; std::string camera_dir; std::string target_dir; int watchdog_tmo; diff --git a/src/dbse.cpp b/src/dbse.cpp index 0073d82e..aa4f3aec 100644 --- a/src/dbse.cpp +++ b/src/dbse.cpp @@ -123,7 +123,7 @@ static void dbse_cols_list(ctx_motapp *motapp) } indx=0; - snprintf(motapp->dbse->cols_list[indx].col_nm, 30, "%s", "camera_id"); + snprintf(motapp->dbse->cols_list[indx].col_nm, 30, "%s", "device_id"); snprintf(motapp->dbse->cols_list[indx].col_typ, 30, "%s", "int"); indx++; @@ -177,7 +177,7 @@ static void dbse_rec_default(ctx_dbse_rec *rec) { rec->found = false; rec->record_id = -1; - rec->camera_id = -1; + rec->device_id = -1; rec->movie_nm = (char*)mymalloc(5); snprintf(rec->movie_nm, 5,"%s", "null"); @@ -213,8 +213,8 @@ static void dbse_rec_assign(ctx_dbse_rec *rec, char *col_nm, char *col_val) if (mystrceq(col_nm,"record_id")) { rec->record_id = atoi(col_val); - } else if (mystrceq(col_nm,"camera_id")) { - rec->camera_id = atoi(col_val); + } else if (mystrceq(col_nm,"device_id")) { + rec->device_id = atoi(col_val); } else if (mystrceq(col_nm,"movie_nm")) { free(rec->movie_nm); @@ -332,7 +332,7 @@ static void dbse_sql_motpls(ctx_dbse *dbse, std::string &sql) } -static void dbse_sql_motpls(ctx_dbse *dbse, std::string &sql, int camera_id) +static void dbse_sql_motpls(ctx_dbse *dbse, std::string &sql, int device_id) { sql = ""; @@ -341,14 +341,14 @@ static void dbse_sql_motpls(ctx_dbse *dbse, std::string &sql, int camera_id) sql += " count(*) as movie_cnt "; sql += " from motionplus "; sql += " where "; - sql += " camera_id = " + std::to_string(camera_id); + sql += " device_id = " + std::to_string(device_id); sql += ";"; } else if (dbse->dbse_action == DBSE_MOV_SELECT) { sql = " select * "; sql += " from motionplus "; sql += " where "; - sql += " camera_id = " + std::to_string(camera_id); + sql += " device_id = " + std::to_string(device_id); sql += " order by "; sql += " movie_dtl, movie_tml;"; @@ -549,14 +549,14 @@ static void dbse_sqlite3_init(ctx_motapp *motapp) } -static void dbse_sqlite3_movlst(ctx_motapp *motapp, int camera_id) +static void dbse_sqlite3_movlst(ctx_motapp *motapp, int device_id) { int retcd; char *errmsg = NULL; std::string sql; motapp->dbse->dbse_action = DBSE_MOV_COUNT; - dbse_sql_motpls(motapp->dbse, sql, camera_id); + dbse_sql_motpls(motapp->dbse, sql, device_id); retcd = sqlite3_exec( motapp->dbse->database_sqlite3 , sql.c_str(), dbse_sqlite3_cb, motapp, &errmsg); @@ -573,7 +573,7 @@ static void dbse_sqlite3_movlst(ctx_motapp *motapp, int camera_id) motapp->dbse->rec_indx = 0; motapp->dbse->dbse_action = DBSE_MOV_SELECT; - dbse_sql_motpls(motapp->dbse, sql, camera_id); + dbse_sql_motpls(motapp->dbse, sql, device_id); retcd = sqlite3_exec( motapp->dbse->database_sqlite3 , sql.c_str(), dbse_sqlite3_cb, motapp, &errmsg); @@ -585,7 +585,7 @@ static void dbse_sqlite3_movlst(ctx_motapp *motapp, int camera_id) } motapp->dbse->dbse_action = DBSE_MOV_CLEAN; - dbse_sql_motpls(motapp->dbse, sql, camera_id); + dbse_sql_motpls(motapp->dbse, sql, device_id); dbse_sqlite3_exec(motapp, sql.c_str()); sql = " vacuum;"; @@ -872,12 +872,12 @@ static void dbse_mariadb_close(ctx_motapp *motapp) } } -static void dbse_mariadb_movlst(ctx_motapp *motapp, int camera_id ) +static void dbse_mariadb_movlst(ctx_motapp *motapp, int device_id ) { std::string sql; motapp->dbse->dbse_action = DBSE_MOV_COUNT; - dbse_sql_motpls(motapp->dbse, sql, camera_id); + dbse_sql_motpls(motapp->dbse, sql, device_id); dbse_mariadb_recs(motapp, sql.c_str()); if (motapp->dbse->movie_cnt > 0) { @@ -885,7 +885,7 @@ static void dbse_mariadb_movlst(ctx_motapp *motapp, int camera_id ) mymalloc(sizeof(ctx_dbse_rec)*motapp->dbse->movie_cnt); motapp->dbse->dbse_action = DBSE_MOV_SELECT; - dbse_sql_motpls(motapp->dbse, sql, camera_id); + dbse_sql_motpls(motapp->dbse, sql, device_id); dbse_mariadb_recs(motapp, sql.c_str()); motapp->dbse->dbse_action = DBSE_MOV_CLEAN; @@ -1116,12 +1116,12 @@ static void dbse_pgsql_init(ctx_motapp *motapp) , motapp->dbse->database_dbname.c_str() ); } -static void dbse_pgsql_movlst(ctx_motapp *motapp, int camera_id) +static void dbse_pgsql_movlst(ctx_motapp *motapp, int device_id) { std::string sql; motapp->dbse->dbse_action = DBSE_MOV_COUNT; - dbse_sql_motpls(motapp->dbse, sql, camera_id); + dbse_sql_motpls(motapp->dbse, sql, device_id); dbse_pgsql_recs(motapp, sql.c_str()); if (motapp->dbse->movie_cnt > 0) { @@ -1129,7 +1129,7 @@ static void dbse_pgsql_movlst(ctx_motapp *motapp, int camera_id) mymalloc(sizeof(ctx_dbse_rec)*motapp->dbse->movie_cnt); motapp->dbse->dbse_action = DBSE_MOV_SELECT; - dbse_sql_motpls(motapp->dbse, sql, camera_id); + dbse_sql_motpls(motapp->dbse, sql, device_id); dbse_pgsql_recs(motapp, sql.c_str()); motapp->dbse->dbse_action = DBSE_MOV_CLEAN; @@ -1185,7 +1185,7 @@ void dbse_init(ctx_motapp *motapp) } /* Populate the list of the movies from the database*/ -void dbse_movies_getlist(ctx_motapp *motapp, int camera_id) +void dbse_movies_getlist(ctx_motapp *motapp, int device_id) { if (motapp->dbse->database_type == "") { @@ -1197,21 +1197,21 @@ void dbse_movies_getlist(ctx_motapp *motapp, int camera_id) pthread_mutex_lock(&motapp->dbse->mutex_dbse); #ifdef HAVE_MARIADB if (motapp->dbse->database_type == "mariadb") { - dbse_mariadb_movlst(motapp, camera_id); + dbse_mariadb_movlst(motapp, device_id); } #endif #ifdef HAVE_PGSQL if (motapp->dbse->database_type == "postgresql") { - dbse_pgsql_movlst(motapp, camera_id); + dbse_pgsql_movlst(motapp, device_id); } #endif #ifdef HAVE_SQLITE3 if (motapp->dbse->database_type == "sqlite3") { - dbse_sqlite3_movlst(motapp, camera_id); + dbse_sqlite3_movlst(motapp, device_id); } #endif #ifndef HAVE_DBSE - (void)camera_id; + (void)device_id; #endif pthread_mutex_unlock(&motapp->dbse->mutex_dbse); @@ -1362,9 +1362,9 @@ void dbse_movies_addrec(ctx_dev *cam, ctx_movie *movie, timespec *ts1) } sqlquery = "insert into motionplus "; - sqlquery += " (camera_id, movie_nm, movie_dir, full_nm, movie_sz, movie_dtl"; + sqlquery += " (device_id, movie_nm, movie_dir, full_nm, movie_sz, movie_dtl"; sqlquery += " , movie_tmc, movie_tml, diff_avg, sdev_min, sdev_max, sdev_avg)"; - sqlquery += " values ("+std::to_string(cam->camera_id); + sqlquery += " values ("+std::to_string(cam->device_id); sqlquery += " ,'" + std::string(movie->movie_nm) + "'"; sqlquery += " ,'" + std::string(movie->movie_dir) + "'"; sqlquery += " ,'" + std::string(movie->full_nm) + "'"; diff --git a/src/dbse.hpp b/src/dbse.hpp index 5f4b78ee..20d2114f 100644 --- a/src/dbse.hpp +++ b/src/dbse.hpp @@ -67,7 +67,7 @@ struct ctx_dbse_rec { bool found; /*Bool for whether the file exists*/ int64_t record_id; /*record_id*/ - int camera_id; /*camera id */ + int device_id; /*camera id */ char *movie_nm; /*Name of the movie file*/ char *movie_dir; /*Directory of the movie file */ char *full_nm; /*Full name of the movie file with dir*/ @@ -127,7 +127,7 @@ void dbse_deinit_motpls(ctx_motapp *motapp); void dbse_exec(ctx_dev *cam, char *filename , int sqltype, timespec *ts1, const char *cmd); - void dbse_movies_getlist(ctx_motapp *motapp, int camera_id); + void dbse_movies_getlist(ctx_motapp *motapp, int device_id); void dbse_movies_addrec(ctx_dev *cam, ctx_movie *movie, timespec *ts1); #endif /* _INCLUDE_DBSE_HPP_ */ \ No newline at end of file diff --git a/src/motion_loop.cpp b/src/motion_loop.cpp index d849fc91..353ab43b 100644 --- a/src/motion_loop.cpp +++ b/src/motion_loop.cpp @@ -196,7 +196,7 @@ static void mlp_detected_trigger(ctx_dev *cam, ctx_image_data *img) time(&raw_time); localtime_r(&raw_time, &evt_tm); - sprintf(cam->eventid, "%05d", cam->camera_id); + sprintf(cam->eventid, "%05d", cam->device_id); strftime(cam->eventid+5, 15, "%Y%m%d%H%M%S", &evt_tm); MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion detected - starting event %d"), @@ -701,7 +701,7 @@ static void mlp_init(ctx_dev *cam) if (cam->camera_status == STATUS_OPENED) { MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Camera %d started: motion detection %s"), - cam->camera_id, cam->pause ? _("Disabled"):_("Enabled")); + cam->device_id, cam->pause ? _("Disabled"):_("Enabled")); if (cam->conf->emulate_motion) { MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, _("Emulating motion")); diff --git a/src/motionplus.cpp b/src/motionplus.cpp index 626f530c..68062989 100644 --- a/src/motionplus.cpp +++ b/src/motionplus.cpp @@ -272,7 +272,7 @@ static void motion_shutdown(ctx_motapp *motapp) } -static void motion_camera_ids(ctx_dev **cam_list) +static void motion_device_ids(ctx_dev **cam_list) { /* Set the camera id's on the ctx_dev. They must be unique */ int indx, indx2; @@ -281,10 +281,10 @@ static void motion_camera_ids(ctx_dev **cam_list) /* Set defaults */ indx = 0; while (cam_list[indx] != NULL){ - if (cam_list[indx]->conf->camera_id > 0) { - cam_list[indx]->camera_id = cam_list[indx]->conf->camera_id; + if (cam_list[indx]->conf->device_id > 0) { + cam_list[indx]->device_id = cam_list[indx]->conf->device_id; } else { - cam_list[indx]->camera_id = indx; + cam_list[indx]->device_id = indx; } indx++; } @@ -292,12 +292,12 @@ static void motion_camera_ids(ctx_dev **cam_list) invalid_ids = false; indx = 0; while (cam_list[indx] != NULL){ - if (cam_list[indx]->camera_id > 32000) { + if (cam_list[indx]->device_id > 32000) { invalid_ids = true; } indx2 = indx + 1; while (cam_list[indx2] != NULL){ - if (cam_list[indx]->camera_id == cam_list[indx2]->camera_id) { + if (cam_list[indx]->device_id == cam_list[indx2]->device_id) { invalid_ids = true; } indx2++; @@ -309,7 +309,7 @@ static void motion_camera_ids(ctx_dev **cam_list) ,_("Camara IDs are not unique or have values over 32,000. Falling back to thread numbers")); indx = 0; while (cam_list[indx] != NULL){ - cam_list[indx]->camera_id = indx+1; + cam_list[indx]->device_id = indx+1; indx++; } } @@ -399,7 +399,7 @@ static void motion_startup(ctx_motapp *motapp, int daemonize) motion_ntc(); - motion_camera_ids(motapp->cam_list); + motion_device_ids(motapp->cam_list); dbse_init(motapp); @@ -463,7 +463,7 @@ static void motion_watchdog(ctx_motapp *motapp, int camindx) MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Camera %d - Watchdog timeout.") - , motapp->cam_list[camindx]->camera_id); + , motapp->cam_list[camindx]->device_id); /* Shut down all the cameras */ indx = 0; @@ -510,7 +510,7 @@ static void motion_watchdog(ctx_motapp *motapp, int camindx) if (motapp->cam_list[indx]->netcam->handler_finished == false) { MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Camera %d - Watchdog netcam kill.") - , motapp->cam_list[indx]->camera_id); + , motapp->cam_list[indx]->device_id); pthread_kill(motapp->cam_list[indx]->netcam->thread_id, SIGVTALRM); } } @@ -518,14 +518,14 @@ static void motion_watchdog(ctx_motapp *motapp, int camindx) if (motapp->cam_list[indx]->netcam_high->handler_finished == false) { MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Camera %d - Watchdog netcam_high kill.") - , motapp->cam_list[indx]->camera_id); + , motapp->cam_list[indx]->device_id); pthread_kill(motapp->cam_list[indx]->netcam_high->thread_id, SIGVTALRM); } } if (motapp->cam_list[indx]->running_dev == true) { MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Camera %d - Watchdog kill.") - , motapp->cam_list[indx]->camera_id); + , motapp->cam_list[indx]->device_id); pthread_kill(motapp->cam_list[indx]->thread_id, SIGVTALRM); }; motapp->cam_list[indx]->running_dev = false; @@ -619,16 +619,16 @@ static void motion_cam_add(ctx_motapp *motapp) indx_cam = 0; indx = 1; while (motapp->cam_list[indx_cam] != NULL) { - if (indx < motapp->cam_list[indx_cam]->camera_id) { - indx = motapp->cam_list[indx_cam]->camera_id; + if (indx < motapp->cam_list[indx_cam]->device_id) { + indx = motapp->cam_list[indx_cam]->device_id; } indx_cam++; } indx++; indx_cam--; - motapp->cam_list[indx_cam]->camera_id = indx; - motapp->cam_list[indx_cam]->conf->camera_id = indx; + motapp->cam_list[indx_cam]->device_id = indx; + motapp->cam_list[indx_cam]->conf->device_id = indx; motapp->cam_list[indx_cam]->conf->webcontrol_port = 0; motapp->cam_add = false; @@ -655,8 +655,8 @@ static void motion_cam_delete(ctx_motapp *motapp) cam = motapp->cam_list[motapp->cam_delete]; - MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Stopping %s camera_id %d") - , cam->conf->camera_name.c_str(), cam->camera_id); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Stopping %s device_id %d") + , cam->conf->camera_name.c_str(), cam->device_id); cam->restart_dev = false; cam->finish_dev = true; @@ -740,7 +740,7 @@ int main (int argc, char **argv) (motapp->cam_list[indx]->restart_dev == true)) { MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("MotionPlus camera %d restart") - , motapp->cam_list[indx]->camera_id); + , motapp->cam_list[indx]->device_id); motion_start_thread(motapp, indx); } motion_watchdog(motapp, indx); diff --git a/src/motionplus.hpp b/src/motionplus.hpp index 98672a15..e4880157 100644 --- a/src/motionplus.hpp +++ b/src/motionplus.hpp @@ -325,7 +325,7 @@ struct ctx_dev { bool algsec_inuse; /*Bool for whether we have secondary detection*/ int track_posx; int track_posy; - int camera_id; + int device_id; enum CAMERA_TYPE camera_type; enum CAM_STATUS camera_status; unsigned int new_img; diff --git a/src/util.cpp b/src/util.cpp index 869a3337..8c03f8d3 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -452,8 +452,8 @@ size_t mystrftime(ctx_dev *cam, char *s, size_t max, const char *userformat, cam->current_image->total_labels); break; - case 't': // camera id - sprintf(tempstr, "%*d", width, cam->camera_id); + case 't': // device id + sprintf(tempstr, "%*d", width, cam->device_id); break; case 'C': // text_event diff --git a/src/webu.cpp b/src/webu.cpp index e7c01a74..d4f88821 100644 --- a/src/webu.cpp +++ b/src/webu.cpp @@ -115,9 +115,9 @@ static void webu_context_free(ctx_webui *webui) /* Edit the parameters specified in the url sent */ static void webu_parms_edit(ctx_webui *webui) { - int indx, is_nbr, camera_id; + int indx, is_nbr, device_id; - camera_id = -1; + device_id = -1; if (webui->uri_camid.length() > 0) { is_nbr = true; for (indx=0; indx < (int)webui->uri_camid.length(); indx++) { @@ -126,12 +126,12 @@ static void webu_parms_edit(ctx_webui *webui) } } if (is_nbr) { - camera_id = atoi(webui->uri_camid.c_str()); + device_id = atoi(webui->uri_camid.c_str()); } } for (indx=0; indxmotapp->cam_cnt; indx++) { - if (webui->motapp->cam_list[indx]->camera_id == camera_id) { + if (webui->motapp->cam_list[indx]->device_id == device_id) { webui->threadnbr = indx; webui->cam = webui->motapp->cam_list[indx]; } diff --git a/src/webu_file.cpp b/src/webu_file.cpp index bf075a0a..7bb4784c 100644 --- a/src/webu_file.cpp +++ b/src/webu_file.cpp @@ -59,7 +59,7 @@ mhdrslt webu_file_main(ctx_webui *webui) } if (webui->cam->motapp->dbse->movie_cnt == 0) { - dbse_movies_getlist(webui->cam->motapp, webui->cam->camera_id); + dbse_movies_getlist(webui->cam->motapp, webui->cam->device_id); } wact = webui->motapp->webcontrol_actions; diff --git a/src/webu_json.cpp b/src/webu_json.cpp index 1b01d924..544f3dc2 100644 --- a/src/webu_json.cpp +++ b/src/webu_json.cpp @@ -167,7 +167,7 @@ static void webu_json_config_cam_parms(ctx_webui *webui) indx_cam = 0; while (webui->motapp->cam_list[indx_cam] != NULL) { webui->resp_page += ",\"cam" + - std::to_string(webui->motapp->cam_list[indx_cam]->camera_id) + "\": "; + std::to_string(webui->motapp->cam_list[indx_cam]->device_id) + "\": "; webu_json_config_parms(webui, webui->motapp->cam_list[indx_cam]->conf); indx_cam++; } @@ -189,7 +189,7 @@ static void webu_json_config_cam_list(ctx_webui *webui) indx_cam = 0; while (webui->motapp->cam_list[indx_cam] != NULL) { cam = webui->motapp->cam_list[indx_cam]; - strid =std::to_string(cam->camera_id); + strid =std::to_string(cam->device_id); webui->resp_page += ",\"" + std::to_string(indx_cam) + "\":"; if (cam->conf->camera_name == "") { webui->resp_page += "{\"name\": \"camera " + strid + "\""; @@ -266,7 +266,7 @@ static void webu_json_movies_list(ctx_webui *webui) indx_cam = 0; indx_req = -1; while (webui->motapp->cam_list[indx_cam] != NULL) { - if (webui->cam->camera_id == webui->motapp->cam_list[indx_cam]->camera_id){ + if (webui->cam->device_id == webui->motapp->cam_list[indx_cam]->device_id){ indx_req = indx_cam; } indx_cam++; @@ -296,7 +296,7 @@ static void webu_json_movies_list(ctx_webui *webui) } } - dbse_movies_getlist(webui->motapp, webui->cam->camera_id); + dbse_movies_getlist(webui->motapp, webui->cam->device_id); movie_cnt = webui->motapp->dbse->movie_cnt; webui->resp_page += "{"; @@ -378,7 +378,7 @@ static void webu_json_status_vars(ctx_webui *webui, int indx_cam) webui->resp_page += "{"; webui->resp_page += "\"name\":\"" + cam->conf->camera_name+"\""; - webui->resp_page += ",\"id\":" + std::to_string(cam->camera_id); + webui->resp_page += ",\"id\":" + std::to_string(cam->device_id); webui->resp_page += ",\"width\":" + std::to_string(cam->imgs.width); webui->resp_page += ",\"height\":" + std::to_string(cam->imgs.height); webui->resp_page += ",\"fps\":" + std::to_string(cam->lastrate); @@ -437,7 +437,7 @@ void webu_json_status(ctx_webui *webui) indx_cam = 0; while (webui->motapp->cam_list[indx_cam] != NULL) { webui->resp_page += ",\"cam" + - std::to_string(webui->motapp->cam_list[indx_cam]->camera_id) + "\": "; + std::to_string(webui->motapp->cam_list[indx_cam]->device_id) + "\": "; webu_json_status_vars(webui, indx_cam); indx_cam++; } diff --git a/src/webu_post.cpp b/src/webu_post.cpp index 54fdc56a..217244cc 100644 --- a/src/webu_post.cpp +++ b/src/webu_post.cpp @@ -139,7 +139,7 @@ void webu_post_cmdthrd(ctx_webui *webui) indx = 0; while (webui->motapp->cam_list[indx] != NULL) { - if (webui->motapp->cam_list[indx]->camera_id == camid) { + if (webui->motapp->cam_list[indx]->device_id == camid) { webui->threadnbr = indx; break; } @@ -326,7 +326,7 @@ void webu_post_action_restart(ctx_webui *webui) } else { MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Restarting camera %d") - , webui->motapp->cam_list[webui->threadnbr]->camera_id); + , webui->motapp->cam_list[webui->threadnbr]->device_id); webui->motapp->cam_list[webui->threadnbr]->restart_dev = true; webui->motapp->cam_list[webui->threadnbr]->finish_dev = true; } @@ -354,7 +354,7 @@ void webu_post_action_stop(ctx_webui *webui) while (webui->motapp->cam_list[indx]) { MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Stopping cam %d") - , webui->motapp->cam_list[indx]->camera_id); + , webui->motapp->cam_list[indx]->device_id); webui->motapp->cam_list[indx]->restart_dev = false; webui->motapp->cam_list[indx]->event_stop = true; webui->motapp->cam_list[indx]->event_user = false; @@ -364,7 +364,7 @@ void webu_post_action_stop(ctx_webui *webui) } else { MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Stopping cam %d") - , webui->motapp->cam_list[webui->threadnbr]->camera_id); + , webui->motapp->cam_list[webui->threadnbr]->device_id); webui->motapp->cam_list[webui->threadnbr]->restart_dev = false; webui->motapp->cam_list[webui->threadnbr]->event_stop = true; webui->motapp->cam_list[webui->threadnbr]->event_user = false; @@ -414,7 +414,7 @@ void webu_post_action_user(ctx_webui *webui) snprintf(cam->action_user, 20, "%s", tmp.c_str()); MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Executing user action on cam %d") - , cam->camera_id); + , cam->device_id); util_exec_command(cam, cam->conf->on_action_user.c_str(), NULL, 0); indx++; } @@ -438,7 +438,7 @@ void webu_post_action_user(ctx_webui *webui) MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Executing user action on cam %d") - , cam->camera_id); + , cam->device_id); util_exec_command(cam, cam->conf->on_action_user.c_str(), NULL, 0); }